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 1
1
use std:: fs:: File ;
2
2
use std:: io:: Write ;
3
+ use std:: net:: IpAddr ;
3
4
use std:: net:: SocketAddr ;
4
5
use std:: path:: PathBuf ;
5
6
use std:: process:: ExitCode ;
@@ -79,9 +80,12 @@ fn main() -> Result<ExitCode, anyhow::Error> {
79
80
let exit_code = match matches. subcommand ( ) {
80
81
Some ( ( "start" , sub_matches) ) => {
81
82
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
+
82
86
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 ) ;
85
89
86
90
let maybe_tls =
87
91
if let Some ( port) = sub_matches. get_one :: < u16 > ( "tls" ) . copied ( ) {
You can’t perform that action at this time.
0 commit comments