mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-17 16:17:38 +00:00
Revert the compare order in check_ip_in_proxy_list
This commit is contained in:
+8
-14
@@ -311,21 +311,15 @@ impl Context {
|
||||
// Proxy everything by default
|
||||
None => true,
|
||||
Some(ref a) => {
|
||||
// first check the IP list
|
||||
if a.check_ip_in_proxy_list(ip) {
|
||||
true
|
||||
// do the reverse lookup in our local cache
|
||||
let mut reverse_lookup_cache = self.reverse_lookup_cache.lock();
|
||||
// if a qname is found
|
||||
if let Some(forward) = reverse_lookup_cache.get(ip) {
|
||||
// if qname is resolved by remote,
|
||||
// we should proxy it as well
|
||||
*forward
|
||||
} else {
|
||||
// do the reverse lookup in our local cache
|
||||
let mut reverse_lookup_cache = self.reverse_lookup_cache.lock();
|
||||
// if a qname is found
|
||||
if let Some(forward) = reverse_lookup_cache.get(ip) {
|
||||
// if qname is resolved by remote,
|
||||
// we should proxy it as well
|
||||
*forward
|
||||
} else {
|
||||
// by default not proxied
|
||||
false
|
||||
}
|
||||
a.check_ip_in_proxy_list(ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user