|
@ -18,15 +18,15 @@ func init() { |
|
|
|
|
|
|
|
|
registerInitFn(func() { |
|
|
registerInitFn(func() { |
|
|
if *args.EnableFakeDNS { |
|
|
if *args.EnableFakeDNS { |
|
|
resolver, err := fakedns.NewResolver(*args.FakeDNSAddr, *args.Hosts, *args.BackendDNS) |
|
|
var err error |
|
|
|
|
|
fakeDNS, err = fakedns.NewResolver(*args.FakeDNSAddr, *args.Hosts, *args.BackendDNS) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Fatalf("Create fake DNS server failed: %v", err) |
|
|
log.Fatalf("Create fake DNS server failed: %v", err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if err := resolver.Start(); err != nil { |
|
|
if err := fakeDNS.Start(); err != nil { |
|
|
log.Fatalf("Start fake DNS failed: %v", err) |
|
|
log.Fatalf("Start fake DNS failed: %v", err) |
|
|
} |
|
|
} |
|
|
fakeDNS = resolver |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
fakeDNS = nil |
|
|
fakeDNS = nil |
|
|
} |
|
|
} |
|
|