File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -62,13 +62,22 @@ fn convert_service_port(svcport: ServicePort) -> String {
6262/// The function `generate_remote_arg` is returning a `String`. The `String`
6363/// contains the formatted remote argument which is a combination of the `lb_ip` and `chisel_port`
6464/// values obtained from the `node` parameter.
65+ use std:: net:: IpAddr ;
66+
6567pub fn generate_remote_arg ( node : & ExitNode ) -> String {
6668 // todo: what about ECDSA keys?
6769
6870 let host = node. get_host ( ) ;
6971
7072 debug ! ( host = ?host, "Host" ) ;
71- let output = format ! ( "{}:{}" , host, node. spec. port) ;
73+
74+ // Determine if the host is an IPv6 address and format accordingly
75+ let formatted_host = match host. parse :: < IpAddr > ( ) {
76+ Ok ( IpAddr :: V6 ( _) ) => format ! ( "[{}]" , host) ,
77+ _ => host. to_string ( ) ,
78+ } ;
79+
80+ let output = format ! ( "{}:{}" , formatted_host, node. spec. port) ;
7281 debug ! ( output = ?output, "Output" ) ;
7382 output
7483}
You can’t perform that action at this time.
0 commit comments