mirror of
https://github.com/nadoo/glider.git
synced 2025-04-21 19:52:07 +08:00
Merge 0941d8bbb8
into 7a7b25f173
This commit is contained in:
commit
c544716c88
13
rule.go
13
rule.go
@ -70,7 +70,18 @@ func (rd *RuleDialer) NextDialer(dstAddr string) proxy.Dialer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find ip
|
// find ip
|
||||||
if ip := net.ParseIP(host); ip != nil {
|
ip := net.ParseIP(host)
|
||||||
|
if ip == nil {
|
||||||
|
ns, err := net.LookupHost(host)
|
||||||
|
if err == nil {
|
||||||
|
if (len(ns) > 0) {
|
||||||
|
ip = net.ParseIP(ns[0])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.F("[rule] Invalid host: %s", host)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ip != nil {
|
||||||
// check ip
|
// check ip
|
||||||
if dialer, ok := rd.ipMap.Load(ip.String()); ok {
|
if dialer, ok := rd.ipMap.Load(ip.String()); ok {
|
||||||
return dialer.(proxy.Dialer)
|
return dialer.(proxy.Dialer)
|
||||||
|
Loading…
Reference in New Issue
Block a user