This commit is contained in:
Jason
2019-08-14 21:20:40 +08:00
parent 563e45dcf3
commit 13c193f24f
2 changed files with 3 additions and 2 deletions

View File

@@ -85,6 +85,9 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
// Alias // Alias
var localConn = conn var localConn = conn
if h.fakeDNS == nil {
log.Warnf("fakedns is nil")
}
// Lookup fakeDNS host record // Lookup fakeDNS host record
targetHost, err := lookupHost(h.fakeDNS, target) targetHost, err := lookupHost(h.fakeDNS, target)
if err != nil { if err != nil {

View File

@@ -3,7 +3,6 @@ package proxy
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/xjasonlyu/tun2socks/common/log"
"io" "io"
"io/ioutil" "io/ioutil"
"net" "net"
@@ -29,7 +28,6 @@ func lookupHost(fakeDNS dns.FakeDNS, target net.Addr) (targetHost string, err er
targetHost = targetIP.String() targetHost = targetIP.String()
// Replace with a domain name if target address IP is a fake IP // Replace with a domain name if target address IP is a fake IP
if fakeDNS != nil { if fakeDNS != nil {
log.Warnf("lookup dns: %v", targetHost)
if host, exist := fakeDNS.IPToHost(targetIP); exist { if host, exist := fakeDNS.IPToHost(targetIP); exist {
targetHost = host targetHost = host
} }