Fix: tun2socks not lookup IP
This commit is contained in:
@ -107,11 +107,15 @@ func (t *Tunnel) resolveIP(host string) (net.IP, error) {
|
||||
return t.resolver.ResolveIP(host)
|
||||
}
|
||||
|
||||
func (t *Tunnel) needLookupIP() bool {
|
||||
return t.hasResolver() && t.resolver.IsMapping()
|
||||
}
|
||||
|
||||
func (t *Tunnel) handleConn(localConn C.ServerAdapter) {
|
||||
defer localConn.Close()
|
||||
metadata := localConn.Metadata()
|
||||
|
||||
if metadata.NeedLoopUpHost() && t.hasResolver() {
|
||||
if t.needLookupIP() {
|
||||
host, exist := t.resolver.IPToHost(*metadata.IP)
|
||||
if exist {
|
||||
metadata.Host = host
|
||||
|
Reference in New Issue
Block a user