mirror of
https://github.com/zhboner/realm.git
synced 2026-11-17 08:15:55 +00:00
Merge pull request #37 from zephyrchien/fix-cmd-ipv6
correctly parse ipv6 address
This commit is contained in:
+6
-2
@@ -80,13 +80,17 @@ pub fn parse_arguments() -> Vec<RelayConfig> {
|
||||
None => panic!("No listening socket"),
|
||||
};
|
||||
|
||||
let client_parse: Vec<&str> = client.split(":").collect();
|
||||
let client_parse: Vec<&str> = client.rsplitn(2,":")
|
||||
.collect::<Vec<&str>>()
|
||||
.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::<Vec<&str>>()
|
||||
.into_iter().rev().collect();
|
||||
if remote_parse.len() != 2 {
|
||||
panic!("remote address is incorrect!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user