Skip to content

Commit

Permalink
add: rustls native cert for roots
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscaOrtegaG committed Sep 4, 2024
1 parent ace99aa commit 1a7bde3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
24 changes: 24 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 @@ -27,5 +27,6 @@ openssl = "0.10.66"
tokio-rustls = "0.26.0"
webpki = "0.22.4"
webpki-roots = "0.26.3"
rustls-native-certs = "0.8.0"
[lib]
doctest = false
6 changes: 5 additions & 1 deletion src/client/tls_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ impl ClientConnection for ClientTLSConnection {
/// creates socket tcp, sends query and receive response
async fn send(self, dns_query: DnsMessage) -> Result<Vec<u8>, ClientError> {
// async fn send(self, dns_query: DnsMessage) -> Result<(Vec<u8>, IpAddr), ClientError> {

let root_store = RootCertStore::empty();
let mut roots = rustls::RootCertStore::empty();
for cert in rustls_native_certs::load_native_certs().expect("could not load platform certs") {
roots.add(cert).unwrap();
}
let conn_timeout: Duration = self.get_timeout();
let bytes: Vec<u8> = dns_query.to_bytes();
let server_addr:SocketAddr = SocketAddr::new(self.get_server_addr(), 53);
Expand Down

0 comments on commit 1a7bde3

Please sign in to comment.