Skip to content

Commit dc9cb48

Browse files
committed
fix: compile flag
1 parent 19215a3 commit dc9cb48

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

clash-lib/src/app/inbound/manager.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ impl InboundManager {
119119
InboundOpts::TProxy { common_opts, .. } => {
120120
ports.tproxy_port = Some(common_opts.port)
121121
}
122+
#[cfg(feature = "redir")]
122123
InboundOpts::Redir { common_opts } => {
123124
ports.redir_port = Some(common_opts.port)
124125
}
@@ -191,6 +192,7 @@ impl InboundManager {
191192
ports.tproxy_port.is_some()
192193
&& Some(common_opts.port) == ports.tproxy_port
193194
}
195+
#[cfg(feature = "redir")]
194196
InboundOpts::Redir { common_opts } => {
195197
ports.redir_port.is_some()
196198
&& Some(common_opts.port) == ports.redir_port
@@ -214,6 +216,7 @@ impl InboundManager {
214216
InboundOpts::TProxy { common_opts, .. } => {
215217
ports.tproxy_port.unwrap_or(common_opts.port)
216218
}
219+
#[cfg(feature = "redir")]
217220
InboundOpts::Redir { common_opts } => {
218221
ports.redir_port.unwrap_or(common_opts.port)
219222
}

clash-lib/src/app/inbound/network_listener.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ fn build_handler(
124124
None
125125
}
126126
}
127-
InboundOpts::Redir { common_opts, .. } => {
127+
#[cfg(feature = "redir")]
128+
InboundOpts::Redir {
129+
#[cfg(target_os = "linux")]
130+
common_opts,
131+
..
132+
} => {
128133
#[cfg(target_os = "linux")]
129134
{
130135
Some(Arc::new(RedirInbound::new(

clash-lib/src/config/internal/convert/listener.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(super) fn convert(
2121
let mixed_port = c.mixed_port;
2222
#[cfg(feature = "tproxy")]
2323
let tproxy_port = c.tproxy_port;
24+
#[cfg(feature = "redir")]
2425
let redir_port = c.redir_port;
2526
let bind_address = c.bind_address;
2627

@@ -81,6 +82,7 @@ pub(super) fn convert(
8182
{
8283
warn!("Duplicate MIXED inbound listener found: {}", mixed_port);
8384
}
85+
#[cfg(feature = "redir")]
8486
if let Some(Port(redir_port)) = redir_port
8587
&& !all_inbounds.insert(InboundOpts::Redir {
8688
common_opts: CommonInboundOpts {

clash-lib/src/config/internal/listener.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum InboundOpts {
3131
common_opts: CommonInboundOpts,
3232
udp: bool,
3333
},
34+
#[cfg(feature = "redir")]
3435
#[serde(alias = "redir")]
3536
Redir {
3637
#[serde(flatten)]
@@ -64,6 +65,7 @@ impl InboundOpts {
6465
#[cfg(feature = "tproxy")]
6566
InboundOpts::TProxy { common_opts, .. } => common_opts,
6667
InboundOpts::Tunnel { common_opts, .. } => common_opts,
68+
#[cfg(feature = "redir")]
6769
InboundOpts::Redir { common_opts, .. } => common_opts,
6870
#[cfg(feature = "shadowsocks")]
6971
InboundOpts::Shadowsocks { common_opts, .. } => common_opts,
@@ -78,6 +80,7 @@ impl InboundOpts {
7880
#[cfg(feature = "tproxy")]
7981
InboundOpts::TProxy { common_opts, .. } => common_opts,
8082
InboundOpts::Tunnel { common_opts, .. } => common_opts,
83+
#[cfg(feature = "redir")]
8184
InboundOpts::Redir { common_opts, .. } => common_opts,
8285
#[cfg(feature = "shadowsocks")]
8386
InboundOpts::Shadowsocks { common_opts, .. } => common_opts,

0 commit comments

Comments
 (0)