Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
Signed-off-by: ArchBlood <[email protected]>
  • Loading branch information
ArchBlood authored Mar 28, 2024
1 parent 01558bc commit d6eef17
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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));
}

Expand Down

0 comments on commit d6eef17

Please sign in to comment.