From d6eef1738c3e2ad4c8a40073e364d79df1613bf1 Mon Sep 17 00:00:00 2001 From: ArchBlood <35392110+ArchBlood@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:59:06 -0400 Subject: [PATCH] Update main.rs Signed-off-by: ArchBlood <35392110+ArchBlood@users.noreply.github.com> --- src/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3c76597..9d493ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,8 @@ use std::net::TcpStream; use std::io::{self, Read}; use std::fs::File; - -use ssh2::Session; -use trust_dns_resolver::{Resolver, config::ResolverConfig}; +use serde::{Deserialize}; +use trust_dns_resolver::{Resolver, config::ResolverConfig, ResolverOpts}; #[derive(Debug, Deserialize)] struct Config { @@ -25,14 +24,14 @@ fn run() -> io::Result<()> { let config_file = File::open("config.json")?; let config: Config = serde_json::from_reader(config_file)?; - let resolver = Resolver::new(ResolverConfig::default())?; + let resolver = Resolver::new(ResolverConfig::default(), ResolverOpts::default())?; let response = resolver.lookup_ip(&config.domain_name)?; println!("DNS record updated successfully: {:?}", response); let tcp = TcpStream::connect(format!("{}:22", config.host))?; - let mut sess = Session::new()?; - if let Err(err) = sess.handshake() { + let mut sess = ssh2::Session::new()?; + if let Err(err) = sess.handshake(&tcp) { return Err(io::Error::new(io::ErrorKind::Other, err)); }