Skip to content

Commit

Permalink
Use hyper-native-tls for https
Browse files Browse the repository at this point in the history
Related issue: <hyperium/hyper#1009>
  • Loading branch information
yvt committed Jan 2, 2019
1 parent dc90968 commit 36f456f
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
103 changes: 103 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors = ["Cole Mickens <cole.mickens@gmail.com>"]
[dependencies]
env_logger = "^0.3"
hyper = "^0.10"
hyper-native-tls = "0.2.2"
log = "^0.3"
serde = "^0.8"
serde_json = "^0.8"
Expand Down
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ extern crate serde;
extern crate serde_json;
extern crate trust_dns;

extern crate hyper_native_tls;

use hyper::Client;
use hyper::net::HttpsConnector;
use hyper::header::Connection;

use hyper_native_tls::NativeTlsClient;

use log::{LogLevelFilter};
use env_logger::LogBuilder;

Expand Down Expand Up @@ -107,7 +112,11 @@ fn main() {
init();
let current_ip = get_current_ip().ok().expect("Was unable to determine current IP address.");
info!("{}", current_ip);
let client = Client::new();

let ssl = NativeTlsClient::new().unwrap();
let connector = HttpsConnector::new(ssl);
let mut client = Client::with_connector(connector);

let cloudflare_records_env = env_var("CLOUDFLARE_RECORDS");
let cloudflare_records: Vec<&str> = cloudflare_records_env.split(|c: char| c == ',').collect();

Expand Down

0 comments on commit 36f456f

Please sign in to comment.