Skip to content

Commit 3ad92cd

Browse files
committed
fixed local-redir compatibility build on windows
1 parent 67179c1 commit 3ad92cd

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

crates/shadowsocks-service/src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
4444
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios"))]
4545
use std::ffi::OsString;
46+
#[cfg(any(unix, target_os = "android", feature = "local-flow-stat"))]
47+
use std::path::PathBuf;
4648
use std::{
4749
convert::{From, Infallible},
4850
default::Default,
@@ -51,7 +53,7 @@ use std::{
5153
io::Read,
5254
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
5355
option::Option,
54-
path::{Path, PathBuf},
56+
path::Path,
5557
str::FromStr,
5658
string::ToString,
5759
time::Duration,

crates/shadowsocks-service/src/local/redir/udprelay/sys/windows/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
use std::{io, net::SocketAddr};
1+
use std::{
2+
io,
3+
net::SocketAddr,
4+
task::{Context, Poll},
5+
};
26

3-
use crate::{config::RedirType, local::redir::redir_ext::UdpSocketRedir};
7+
use crate::{
8+
config::RedirType,
9+
local::redir::redir_ext::{RedirSocketOpts, UdpSocketRedir},
10+
};
411

512
pub struct UdpRedirSocket;
613

@@ -15,7 +22,7 @@ impl UdpRedirSocket {
1522
/// Create a new UDP socket binded to `addr`
1623
///
1724
/// This will allow binding to `addr` that is not in local host
18-
pub fn bind_nonlocal(ty: RedirType, addr: SocketAddr) -> io::Result<UdpRedirSocket> {
25+
pub fn bind_nonlocal(ty: RedirType, addr: SocketAddr, _redir_opts: &RedirSocketOpts) -> io::Result<UdpRedirSocket> {
1926
UdpRedirSocket::bind(ty, addr, true)
2027
}
2128

@@ -24,7 +31,7 @@ impl UdpRedirSocket {
2431
}
2532

2633
/// Send data to the socket to the given target address
27-
pub async fn send_to(&mut self, _buf: &[u8], _target: &SocketAddr) -> io::Result<usize> {
34+
pub async fn send_to(&mut self, _buf: &[u8], _target: SocketAddr) -> io::Result<usize> {
2835
unimplemented!("UDP transparent proxy is not supported on Windows")
2936
}
3037

crates/shadowsocks-service/src/manager/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use std::{io, sync::Arc};
66

7-
use log::{trace, warn};
7+
use log::trace;
88
use shadowsocks::net::{AcceptOpts, ConnectOpts};
99

1010
use crate::{
@@ -26,7 +26,7 @@ pub async fn run(config: Config) -> io::Result<()> {
2626
if let Some(nofile) = config.nofile {
2727
use crate::sys::set_nofile;
2828
if let Err(err) = set_nofile(nofile) {
29-
warn!("set_nofile {} failed, error: {}", nofile, err);
29+
log::warn!("set_nofile {} failed, error: {}", nofile, err);
3030
}
3131
}
3232

0 commit comments

Comments
 (0)