@@ -168,6 +168,9 @@ pub mod client {
168168
169169 impl Socks5Stream {
170170 /// Connects to a target server through a SOCKS5 proxy.
171+ ///
172+ /// # Errors
173+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
171174 pub fn connect < T , U > ( proxy : T , target : & U ) -> io:: Result < Self >
172175 where
173176 T : ToSocketAddrs ,
@@ -178,6 +181,9 @@ pub mod client {
178181
179182 /// Connects to a target server through a SOCKS5 proxy using given
180183 /// username and password.
184+ ///
185+ /// # Errors
186+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
181187 pub fn connect_with_password < T , U > (
182188 proxy : T ,
183189 target : & U ,
@@ -386,6 +392,9 @@ pub mod bind {
386392 ///
387393 /// The proxy will filter incoming connections based on the value of
388394 /// `target`.
395+ ///
396+ /// # Errors
397+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
389398 pub fn bind < T , U > ( proxy : T , target : & U ) -> io:: Result < Self >
390399 where
391400 T : ToSocketAddrs ,
@@ -398,6 +407,9 @@ pub mod bind {
398407 ///
399408 /// The proxy will filter incoming connections based on the value of
400409 /// `target`.
410+ ///
411+ /// # Errors
412+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
401413 pub fn bind_with_password < T , U > (
402414 proxy : T ,
403415 target : & U ,
@@ -425,6 +437,9 @@ pub mod bind {
425437 ///
426438 /// The value of `proxy_addr` should be forwarded to the remote process
427439 /// before this method is called.
440+ ///
441+ /// # Errors
442+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
428443 pub fn accept ( mut self ) -> io:: Result < Socks5Stream > {
429444 self . 0 . proxy_addr = read_response ( & mut self . 0 . socket ) ?;
430445 Ok ( self . 0 )
@@ -457,16 +472,23 @@ pub mod udp {
457472 impl Socks5Datagram {
458473 /// Creates a UDP socket bound to the specified address which will have its
459474 /// traffic routed through the specified proxy.
475+ ///
476+ /// # Errors
477+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
460478 pub fn bind < T , U > ( proxy : T , addr : U ) -> io:: Result < Self >
461479 where
462480 T : ToSocketAddrs ,
463481 U : ToSocketAddrs ,
464482 {
465483 Self :: bind_internal ( proxy, addr, & Authentication :: None )
466484 }
485+
467486 /// Creates a UDP socket bound to the specified address which will have its
468487 /// traffic routed through the specified proxy. The given username and password
469488 /// is used to authenticate to the SOCKS proxy.
489+ ///
490+ /// # Errors
491+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
470492 pub fn bind_with_password < T , U > (
471493 proxy : T ,
472494 addr : U ,
@@ -503,10 +525,12 @@ pub mod udp {
503525 /// Like `UdpSocket::send_to`.
504526 ///
505527 /// # Note
506- ///
507528 /// The SOCKS protocol inserts a header at the beginning of the message. The
508529 /// header will be 10 bytes for an IPv4 address, 22 bytes for an IPv6
509530 /// address, and 7 bytes plus the length of the domain for a domain address.
531+ ///
532+ /// # Errors
533+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
510534 pub fn send_to < A > ( & self , buf : & [ u8 ] , addr : & A ) -> io:: Result < usize >
511535 where
512536 A : ToTargetAddr ,
@@ -522,6 +546,9 @@ pub mod udp {
522546 }
523547
524548 /// Like `UdpSocket::recv_from`.
549+ ///
550+ /// # Errors
551+ /// - `io::Error(std::io::ErrorKind::*, socks2::Error::*)`
525552 pub fn recv_from ( & self , buf : & mut [ u8 ] ) -> io:: Result < ( usize , TargetAddr ) > {
526553 let mut header = [ 0 ; MAX_ADDR_LEN + 3 ] ;
527554 let len = self . socket . readv ( [ & mut header, buf] ) ?;
@@ -574,6 +601,7 @@ pub mod udp {
574601}
575602
576603#[ cfg( test) ]
604+ #[ allow( clippy:: unwrap_used) ]
577605mod test {
578606 use std:: {
579607 io:: { Read , Write } ,
0 commit comments