Skip to content

Commit caecbde

Browse files
authored
Ipv6 address encased in a bracket (TheWaWaR#81)
* Show correct ipv6 addr * fix indent * remove needless borrow on ip variable
1 parent 46dc108 commit caecbde

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ fn main() {
244244
let printer = Printer::new();
245245
let color_blue = Some(build_spec(Some(Color::Blue), false));
246246
let color_red = Some(build_spec(Some(Color::Red), false));
247-
let addr = format!("{}:{}", ip, port);
247+
let addr = if IpAddr::from_str(ip).unwrap().is_ipv4() {
248+
format!("{}:{}", ip, port)
249+
} else {
250+
format!("[{}]:{}", ip, port)
251+
};
248252
let compression_exts = compress
249253
.clone()
250254
.unwrap_or_default()

0 commit comments

Comments
 (0)