use const for IP and USERNAME

This commit is contained in:
Aaron Honeycutt 2025-07-03 18:10:38 -06:00
parent c0d58cd349
commit 26bcc8fb80

View file

@ -1,18 +1,19 @@
use std::net::TcpStream;
use ssh2::Session;
const EDI_IP: &str = "100.94.173.5";
const USER: &str = "aaronh";
const EDI: &str = "100.94.173.5:22";
fn main() {
// Connect to the local SSH server
let tcp = TcpStream::connect("100.94.173.5:22").unwrap();
let tcp = TcpStream::connect(EDI).unwrap();
let mut sess = Session::new().unwrap();
sess.set_tcp_stream(tcp);
sess.handshake().unwrap();
// Try to authenticate with the first identity in the agent.
sess.userauth_agent("aaronh").unwrap();
sess.userauth_agent(USER).unwrap();
// Make sure we succeeded
assert!(sess.authenticated());