5
5
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6
6
// option. This file may not be copied, modified, or distributed
7
7
// except according to those terms.
8
-
9
8
use std:: fmt;
10
9
use std:: io:: { self , Read , Write } ;
11
10
#[ cfg( not( target_os = "redox" ) ) ]
@@ -18,11 +17,11 @@ use std::net::{self, Ipv4Addr, Shutdown};
18
17
use std:: os:: unix:: io:: { FromRawFd , IntoRawFd } ;
19
18
#[ cfg( windows) ]
20
19
use std:: os:: windows:: io:: { FromRawSocket , IntoRawSocket } ;
20
+ use std:: time:: Duration ;
21
21
#[ cfg( windows) ]
22
22
use windows_sys:: Win32 :: Networking :: WinSock :: {
23
- IP6T_SO_ORIGINAL_DST , SOL_IP , SO_ORIGINAL_DST , SOCKET_ERROR
23
+ IP6T_SO_ORIGINAL_DST , SOCKET_ERROR , SOL_IP , SO_ORIGINAL_DST ,
24
24
} ;
25
- use std:: time:: Duration ;
26
25
27
26
use crate :: sys:: { self , c_int, getsockopt, setsockopt, Bool } ;
28
27
#[ cfg( all( unix, not( target_os = "redox" ) ) ) ]
@@ -31,8 +30,8 @@ use crate::{Domain, Protocol, SockAddr, TcpKeepalive, Type};
31
30
#[ cfg( not( target_os = "redox" ) ) ]
32
31
use crate :: { MaybeUninitSlice , MsgHdr , RecvFlags } ;
33
32
34
- #[ cfg( all ( feature = "all" , windows) ) ]
35
- #[ cfg_attr( docsrs, doc( cfg( all ( windows, feature = "all" ) ) ) ) ]
33
+ #[ cfg( windows) ]
34
+ #[ cfg_attr( docsrs, doc( cfg( windows) ) ) ]
36
35
/// Helper macro to execute a system call that returns an `io::Result`.
37
36
macro_rules! syscall {
38
37
( $fn: ident ( $( $arg: expr) ,* $( , ) * ) , $err_test: path, $err_value: expr) => { {
@@ -49,16 +48,17 @@ macro_rules! syscall {
49
48
#[ cfg( all(
50
49
feature = "all" ,
51
50
any(
52
- target_os = "android" ,
53
- target_os = "dragonfly" ,
54
- target_os = "freebsd" ,
55
- target_os = "fuchsia" ,
56
- target_os = "hurd" ,
57
- target_os = "illumos" ,
58
- target_os = "linux" ,
59
- target_os = "netbsd" ,
60
- target_os = "openbsd" ,
61
- ) ) ) ]
51
+ target_os = "android" ,
52
+ target_os = "dragonfly" ,
53
+ target_os = "freebsd" ,
54
+ target_os = "fuchsia" ,
55
+ target_os = "hurd" ,
56
+ target_os = "illumos" ,
57
+ target_os = "linux" ,
58
+ target_os = "netbsd" ,
59
+ target_os = "openbsd" ,
60
+ )
61
+ ) ) ]
62
62
/// Helper macro to execute a system call that returns an `io::Result`.
63
63
macro_rules! syscall {
64
64
( $fn: ident ( $( $arg: expr) ,* $( , ) * ) ) => { {
@@ -2307,16 +2307,16 @@ impl Socket {
2307
2307
. map ( |( _, addr) | addr)
2308
2308
}
2309
2309
2310
- /// Get the value for the `SO_ORIGINAL_DST` option on this socket.
2310
+ /// Get the value for the `SO_ORIGINAL_DST` option on this socket.
2311
2311
/// Only valid for sockets in accepting mode.
2312
2312
///
2313
2313
/// Note: if using this function in a proxy context, you must query the
2314
2314
/// redirect records for this socket and set them on the outbound socket
2315
2315
/// created by your proxy in order for any OS level firewall rules to be
2316
2316
/// applied. Read more in the Windows bind and connect redirection
2317
2317
/// [documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/network/using-bind-or-connect-redirection).
2318
- #[ cfg( all ( feature = "all" , target_os = " windows" ) ) ]
2319
- #[ cfg_attr( docsrs, doc( cfg( all ( windows, feature = "all" ) ) ) ) ]
2318
+ #[ cfg( windows) ]
2319
+ #[ cfg_attr( docsrs, doc( cfg( windows) ) ) ]
2320
2320
pub fn original_dst ( & self ) -> io:: Result < SockAddr > {
2321
2321
unsafe {
2322
2322
SockAddr :: try_init ( |storage, len| {
@@ -2344,8 +2344,8 @@ impl Socket {
2344
2344
/// created by your proxy in order for any OS level firewall rules to be
2345
2345
/// applied. Read more in the Windows bind and connect redirection
2346
2346
/// [documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/network/using-bind-or-connect-redirection).
2347
- #[ cfg( all ( feature = "all" , target_os = " windows" ) ) ]
2348
- #[ cfg_attr( docsrs, doc( cfg( all ( windows, feature = "all" ) ) ) ) ]
2347
+ #[ cfg( windows) ]
2348
+ #[ cfg_attr( docsrs, doc( cfg( windows) ) ) ]
2349
2349
pub fn original_dst_ipv6 ( & self ) -> io:: Result < SockAddr > {
2350
2350
unsafe {
2351
2351
SockAddr :: try_init ( |storage, len| {
0 commit comments