summaryrefslogtreecommitdiffstats
path: root/vendor/curl/examples/doh.rs
blob: 77ebe385cc19b256966e0caae943f42f6f1a4cd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use curl::easy::Easy;
use std::io::{stdout, Write};

fn main() -> Result<(), curl::Error> {
    let mut curl = Easy::new();

    curl.url("https://example.com")?;
    curl.doh_url(Some("https://cloudflare-dns.com/dns-query"))?;
    curl.write_function(|data| {
        stdout().write_all(data).unwrap();
        Ok(data.len())
    })?;

    curl.perform()?;

    Ok(())
}