Skip to content

Commit c0361e6

Browse files
committed
fix(shadowsocks-service): ACL host rule resolved IP check return if matched
1 parent ea5e3a5 commit c0361e6

File tree

1 file changed

+14
-2
lines changed
  • crates/shadowsocks-service/src/acl

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,13 @@ impl AccessControl {
565565
}
566566
if let Ok(vaddr) = context.dns_resolve(host, port).await {
567567
for addr in vaddr {
568-
if !self.check_ip_in_proxy_list(&addr.ip()) {
568+
let ip = addr.ip();
569+
if self.black_list.check_ip_matched(&ip) {
570+
// If IP is in black_list, it should be bypassed
571+
return false;
572+
}
573+
if self.white_list.check_ip_matched(&ip) {
574+
// If IP is in white_list, it should be proxied
569575
return true;
570576
}
571577
}
@@ -614,9 +620,15 @@ impl AccessControl {
614620

615621
if let Ok(vaddr) = context.dns_resolve(host, *port).await {
616622
for addr in vaddr {
617-
if self.check_outbound_ip_blocked(&addr.ip()) {
623+
let ip = addr.ip();
624+
if self.outbound_block.check_ip_matched(&ip) {
625+
// If IP is in outbound_block, it should be blocked
618626
return true;
619627
}
628+
if self.outbound_allow.check_ip_matched(&ip) {
629+
// If IP is in outbound_allow, it should be allowed
630+
return false;
631+
}
620632
}
621633
}
622634

0 commit comments

Comments
 (0)