Fixed getting IP address from CLI
This commit is contained in:
		@@ -9,15 +9,15 @@ fn main() {
 | 
			
		||||
    loop {
 | 
			
		||||
        let mut ip = String::new();
 | 
			
		||||
        io::stdin().read_line(&mut ip).unwrap();
 | 
			
		||||
        let ip_address = match IpAddr::from_str(x) {
 | 
			
		||||
        
 | 
			
		||||
        let ip_address = match IpAddr::from_str(&ip.trim()) {
 | 
			
		||||
            Err(_) => {
 | 
			
		||||
                println!("fucked it");
 | 
			
		||||
                IpAddr::V4(0, 0, 0, 0)
 | 
			
		||||
                println!("{} is an invalid IP Address... Please try again", ip);
 | 
			
		||||
                continue;
 | 
			
		||||
            },
 | 
			
		||||
            Ok(ip) => ip,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        println!("you entered, {:?}", ip_address);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user