use const for IP and USERNAME
This commit is contained in:
parent
c0d58cd349
commit
26bcc8fb80
1 changed files with 4 additions and 3 deletions
|
@ -1,18 +1,19 @@
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use ssh2::Session;
|
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() {
|
fn main() {
|
||||||
|
|
||||||
// Connect to the local SSH server
|
// 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();
|
let mut sess = Session::new().unwrap();
|
||||||
sess.set_tcp_stream(tcp);
|
sess.set_tcp_stream(tcp);
|
||||||
sess.handshake().unwrap();
|
sess.handshake().unwrap();
|
||||||
|
|
||||||
// Try to authenticate with the first identity in the agent.
|
// Try to authenticate with the first identity in the agent.
|
||||||
sess.userauth_agent("aaronh").unwrap();
|
sess.userauth_agent(USER).unwrap();
|
||||||
|
|
||||||
// Make sure we succeeded
|
// Make sure we succeeded
|
||||||
assert!(sess.authenticated());
|
assert!(sess.authenticated());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue