@@ -37,9 +37,7 @@ fn read_addr<R: Read>(socket: &mut R) -> io::Result<TargetAddr> {
3737 ip, port, 0 , 0 ,
3838 ) ) ) )
3939 }
40- _ => Err ( io:: Error :: other (
41- "unsupported address type" ,
42- ) ) ,
40+ _ => Err ( io:: Error :: other ( "unsupported address type" ) ) ,
4341 }
4442}
4543
@@ -53,30 +51,14 @@ fn read_response(socket: &mut TcpStream) -> io::Result<TargetAddr> {
5351
5452 match socket. read_u8 ( ) ? {
5553 0 => { }
56- 1 => {
57- return Err ( io:: Error :: other (
58- "general SOCKS server failure" ,
59- ) )
60- }
61- 2 => {
62- return Err ( io:: Error :: other (
63- "connection not allowed by ruleset" ,
64- ) )
65- }
54+ 1 => return Err ( io:: Error :: other ( "general SOCKS server failure" ) ) ,
55+ 2 => return Err ( io:: Error :: other ( "connection not allowed by ruleset" ) ) ,
6656 3 => return Err ( io:: Error :: other ( "network unreachable" ) ) ,
6757 4 => return Err ( io:: Error :: other ( "host unreachable" ) ) ,
6858 5 => return Err ( io:: Error :: other ( "connection refused" ) ) ,
6959 6 => return Err ( io:: Error :: other ( "TTL expired" ) ) ,
70- 7 => {
71- return Err ( io:: Error :: other (
72- "command not supported" ,
73- ) )
74- }
75- 8 => {
76- return Err ( io:: Error :: other (
77- "address kind not supported" ,
78- ) )
79- }
60+ 7 => return Err ( io:: Error :: other ( "command not supported" ) ) ,
61+ 8 => return Err ( io:: Error :: other ( "address kind not supported" ) ) ,
8062 _ => return Err ( io:: Error :: other ( "unknown error" ) ) ,
8163 }
8264
@@ -222,9 +204,7 @@ impl Socks5Stream {
222204 }
223205
224206 if selected_method == 0xff {
225- return Err ( io:: Error :: other (
226- "no acceptable auth methods" ,
227- ) ) ;
207+ return Err ( io:: Error :: other ( "no acceptable auth methods" ) ) ;
228208 }
229209
230210 if selected_method != auth. id ( ) && selected_method != Authentication :: None . id ( ) {
0 commit comments