File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change 55 clippy:: panic
66) ]
77use std:: io:: Read ;
8- use std:: net:: ToSocketAddrs ;
98use std:: path:: Path ;
109
1110use globset:: Glob ;
@@ -19,8 +18,6 @@ pub enum Error {
1918 HostNotFound ,
2019 #[ error( "No home directory" ) ]
2120 NoHome ,
22- #[ error( "Cannot resolve the address" ) ]
23- NotResolvable ,
2421 #[ error( "{}" , 0 ) ]
2522 Io ( #[ from] std:: io:: Error ) ,
2623}
@@ -80,11 +77,9 @@ impl Config {
8077 . await
8178 . map_err ( Into :: into)
8279 } else {
83- let address = ( self . host_name . as_str ( ) , self . port )
84- . to_socket_addrs ( ) ?
85- . next ( )
86- . ok_or ( Error :: NotResolvable ) ?;
87- Stream :: tcp_connect ( & address) . await . map_err ( Into :: into)
80+ Stream :: tcp_connect ( ( self . host_name . as_str ( ) , self . port ) )
81+ . await
82+ . map_err ( Into :: into)
8883 }
8984 }
9085}
Original file line number Diff line number Diff line change 1- use std:: net:: SocketAddr ;
21use std:: pin:: Pin ;
32use std:: process:: Stdio ;
43
54use futures:: ready;
65use futures:: task:: * ;
76use tokio:: io:: ReadBuf ;
87use tokio:: net:: TcpStream ;
8+ use tokio:: net:: ToSocketAddrs ;
99use tokio:: process:: Command ;
1010
1111/// A type to implement either a TCP socket, or proxying through an external command.
@@ -18,8 +18,8 @@ pub enum Stream {
1818
1919impl Stream {
2020 /// Connect a direct TCP stream (as opposed to a proxied one).
21- pub async fn tcp_connect ( addr : & SocketAddr ) -> Result < Stream , std:: io:: Error > {
22- Ok ( Stream :: Tcp ( tokio:: net:: TcpStream :: connect ( addr ) . await ?) )
21+ pub async fn tcp_connect ( addrs : impl ToSocketAddrs ) -> Result < Stream , std:: io:: Error > {
22+ Ok ( Stream :: Tcp ( tokio:: net:: TcpStream :: connect ( addrs ) . await ?) )
2323 }
2424 /// Connect through a proxy command.
2525 pub async fn proxy_command ( cmd : & str , args : & [ & str ] ) -> Result < Stream , std:: io:: Error > {
You can’t perform that action at this time.
0 commit comments