File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11use std:: fs:: File ;
22use std:: io:: Write ;
3+ use std:: net:: IpAddr ;
34use std:: net:: SocketAddr ;
45use std:: path:: PathBuf ;
56use std:: process:: ExitCode ;
@@ -79,9 +80,12 @@ fn main() -> Result<ExitCode, anyhow::Error> {
7980 let exit_code = match matches. subcommand ( ) {
8081 Some ( ( "start" , sub_matches) ) => {
8182 let ip = sub_matches. get_one :: < String > ( "ip" ) . cloned ( ) . unwrap ( ) ;
83+ let ip = IpAddr :: from_str ( & ip)
84+ . context ( "failed to parse the IP address to bind the server" ) ?;
85+
8286 let port = sub_matches. get_one :: < u16 > ( "port" ) . copied ( ) . unwrap ( ) ;
83- let addr = SocketAddr :: from_str ( & format ! ( "{ip}:{port}" ) )
84- . context ( "failed to parse the address to bind the server" ) ? ;
87+
88+ let addr = SocketAddr :: new ( ip , port ) ;
8589
8690 let maybe_tls =
8791 if let Some ( port) = sub_matches. get_one :: < u16 > ( "tls" ) . copied ( ) {
You can’t perform that action at this time.
0 commit comments