diff --git a/src/lib.rs b/src/lib.rs index 1b05921..3212372 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,13 +80,17 @@ pub fn parse_arguments() -> Vec { None => panic!("No listening socket"), }; - let client_parse: Vec<&str> = client.split(":").collect(); + let client_parse: Vec<&str> = client.rsplitn(2,":") + .collect::>() + .into_iter().rev().collect(); if client_parse.len() != 2 { panic!("client address is incorrect!"); } let listening_address = String::from_str(client_parse[0]).unwrap(); - let remote_parse: Vec<&str> = remote.split(":").collect(); + let remote_parse: Vec<&str> = remote.rsplitn(2,":") + .collect::>() + .into_iter().rev().collect(); if remote_parse.len() != 2 { panic!("remote address is incorrect!"); }