Browse Source

fix fakeDNS is nil

pull/15/head
Jason 5 years ago
parent
commit
d6c40a736e
  1. 5
      cmd/main_fakedns.go
  2. 3
      proxy/tcp.go

5
cmd/main_fakedns.go

@ -18,9 +18,10 @@ func init() {
addPostFlagsInitFn(func() {
if *args.EnableFakeDNS {
fakeDNS, err := fakedns.NewServer(*args.FakeIPRange, *args.FakeDNSHosts, *args.DNSCacheSize)
if err != nil {
if f, err := fakedns.NewServer(*args.FakeIPRange, *args.FakeDNSHosts, *args.DNSCacheSize); err != nil {
log.Fatalf("create fake dns server failed: %v", err)
} else {
fakeDNS = f
}
// Set fakeDNS variables

3
proxy/tcp.go

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

Loading…
Cancel
Save