Skip to content

Commit

Permalink
Fix: dns crash & remove unused debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Dec 10, 2018
1 parent fcb1a78 commit fa90779
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 3 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type rawConfig struct {
ExternalController string `yaml:"external-controller"`
Secret string `yaml:"secret"`

DNS *rawDNS `yaml:"dns"`
DNS rawDNS `yaml:"dns"`
Proxy []map[string]interface{} `yaml:"Proxy"`
ProxyGroup []map[string]interface{} `yaml:"Proxy Group"`
Rule []string `yaml:"Rule"`
Expand All @@ -95,7 +95,7 @@ func readConfig(path string) (*rawConfig, error) {
Rule: []string{},
Proxy: []map[string]interface{}{},
ProxyGroup: []map[string]interface{}{},
DNS: &rawDNS{
DNS: rawDNS{
Enable: false,
},
}
Expand Down Expand Up @@ -353,7 +353,6 @@ func hostWithDefaultPort(host string, defPort string) (string, error) {

func parseNameServer(servers []string) ([]dns.NameServer, error) {
nameservers := []dns.NameServer{}
log.Debugln("%#v", servers)

for idx, server := range servers {
// parse without scheme .e.g 8.8.8.8:53
Expand Down Expand Up @@ -387,7 +386,7 @@ func parseNameServer(servers []string) ([]dns.NameServer, error) {
return nameservers, nil
}

func parseDNS(cfg *rawDNS) (*DNS, error) {
func parseDNS(cfg rawDNS) (*DNS, error) {
if cfg.Enable && len(cfg.NameServer) == 0 {
return nil, fmt.Errorf("If DNS configuration is turned on, NameServer cannot be empty")
}
Expand Down
2 changes: 0 additions & 2 deletions dns/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ func New(config Config) *Resolver {
mmdb, _ = geoip2.Open(C.Path.MMDB())
})

println(config.EnhancedMode)

r := &Resolver{
main: transform(config.Main),
ipv6: config.IPv6,
Expand Down
2 changes: 0 additions & 2 deletions tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ func (t *Tunnel) handleConn(localConn C.ServerAdapter) {
log.Debugln("[DNS] %s --> %s", metadata.Host, ip.String())
metadata.IP = &ip
}
} else {
log.Debugln("[DNS] unknown%#v", metadata)
}

var proxy C.Proxy
Expand Down

0 comments on commit fa90779

Please sign in to comment.