Skip to content

Commit 6800eea

Browse files
committed
Apparently Original_dst isn't on bsd
Signed-off-by: Keith Mattix II <[email protected]>
1 parent dcc8628 commit 6800eea

File tree

1 file changed

+12
-62
lines changed

1 file changed

+12
-62
lines changed

src/socket.rs

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::os::unix::io::{FromRawFd, IntoRawFd};
1818
#[cfg(windows)]
1919
use std::os::windows::io::{FromRawSocket, IntoRawSocket};
2020
use std::time::Duration;
21-
#[cfg(windows)]
21+
#[cfg(all(windows, feature = "all"))]
2222
use windows_sys::Win32::Networking::WinSock::{
2323
IP6T_SO_ORIGINAL_DST, SOCKET_ERROR, SOL_IP, SO_ORIGINAL_DST,
2424
};
@@ -30,8 +30,8 @@ use crate::{Domain, Protocol, SockAddr, TcpKeepalive, Type};
3030
#[cfg(not(target_os = "redox"))]
3131
use crate::{MaybeUninitSlice, MsgHdr, RecvFlags};
3232

33-
#[cfg(windows)]
34-
#[cfg_attr(docsrs, doc(cfg(windows)))]
33+
#[cfg(all(windows, feature = "all"))]
34+
#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "all"))))]
3535
/// Helper macro to execute a system call that returns an `io::Result`.
3636
macro_rules! syscall {
3737
($fn: ident ( $($arg: expr),* $(,)* ), $err_test: path, $err_value: expr) => {{
@@ -47,17 +47,7 @@ macro_rules! syscall {
4747

4848
#[cfg(all(
4949
feature = "all",
50-
any(
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-
)
50+
any(target_os = "android", target_os = "fuchsia", target_os = "linux",)
6151
))]
6252
/// Helper macro to execute a system call that returns an `io::Result`.
6353
macro_rules! syscall {
@@ -2257,33 +2247,13 @@ impl Socket {
22572247
/// redirected using `iptables` `REDIRECT` or `TPROXY`.
22582248
#[cfg(all(
22592249
feature = "all",
2260-
any(
2261-
target_os = "android",
2262-
target_os = "dragonfly",
2263-
target_os = "freebsd",
2264-
target_os = "fuchsia",
2265-
target_os = "hurd",
2266-
target_os = "illumos",
2267-
target_os = "linux",
2268-
target_os = "netbsd",
2269-
target_os = "openbsd",
2270-
)
2250+
any(target_os = "android", target_os = "fuchsia", target_os = "linux",)
22712251
))]
22722252
#[cfg_attr(
22732253
docsrs,
22742254
doc(cfg(all(
22752255
feature = "all",
2276-
any(
2277-
target_os = "android",
2278-
target_os = "dragonfly",
2279-
target_os = "freebsd",
2280-
target_os = "fuchsia",
2281-
target_os = "hurd",
2282-
target_os = "illumos",
2283-
target_os = "linux",
2284-
target_os = "netbsd",
2285-
target_os = "openbsd",
2286-
)
2256+
any(target_os = "android", target_os = "fuchsia", target_os = "linux",)
22872257
)))
22882258
)]
22892259
pub fn original_dst(&self) -> io::Result<SockAddr> {
@@ -2308,33 +2278,13 @@ impl Socket {
23082278
/// redirected using `ip6tables` `REDIRECT` or `TPROXY`.
23092279
#[cfg(all(
23102280
feature = "all",
2311-
any(
2312-
target_os = "android",
2313-
target_os = "dragonfly",
2314-
target_os = "freebsd",
2315-
target_os = "fuchsia",
2316-
target_os = "hurd",
2317-
target_os = "illumos",
2318-
target_os = "linux",
2319-
target_os = "netbsd",
2320-
target_os = "openbsd",
2321-
)
2281+
any(target_os = "android", target_os = "fuchsia", target_os = "linux",)
23222282
))]
23232283
#[cfg_attr(
23242284
docsrs,
23252285
doc(cfg(all(
23262286
feature = "all",
2327-
any(
2328-
target_os = "android",
2329-
target_os = "dragonfly",
2330-
target_os = "freebsd",
2331-
target_os = "fuchsia",
2332-
target_os = "hurd",
2333-
target_os = "illumos",
2334-
target_os = "linux",
2335-
target_os = "netbsd",
2336-
target_os = "openbsd",
2337-
)
2287+
any(target_os = "android", target_os = "fuchsia", target_os = "linux",)
23382288
)))
23392289
)]
23402290
pub fn original_dst_ipv6(&self) -> io::Result<SockAddr> {
@@ -2361,8 +2311,8 @@ impl Socket {
23612311
/// created by your proxy in order for any OS level firewall rules to be
23622312
/// applied. Read more in the Windows bind and connect redirection
23632313
/// [documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/network/using-bind-or-connect-redirection).
2364-
#[cfg(windows)]
2365-
#[cfg_attr(docsrs, doc(cfg(windows)))]
2314+
#[cfg(all(windows, feature = "all"))]
2315+
#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "all"))))]
23662316
pub fn original_dst(&self) -> io::Result<SockAddr> {
23672317
unsafe {
23682318
SockAddr::try_init(|storage, len| {
@@ -2390,8 +2340,8 @@ impl Socket {
23902340
/// created by your proxy in order for any OS level firewall rules to be
23912341
/// applied. Read more in the Windows bind and connect redirection
23922342
/// [documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/network/using-bind-or-connect-redirection).
2393-
#[cfg(windows)]
2394-
#[cfg_attr(docsrs, doc(cfg(windows)))]
2343+
#[cfg(all(windows, feature = "all"))]
2344+
#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "all"))))]
23952345
pub fn original_dst_ipv6(&self) -> io::Result<SockAddr> {
23962346
unsafe {
23972347
SockAddr::try_init(|storage, len| {

0 commit comments

Comments
 (0)