Fix: dns crash & remove unused debug log
This commit is contained in:
parent
fcb1a7813a
commit
fa9077969c
3 changed files with 3 additions and 8 deletions
|
@ -68,7 +68,7 @@ type rawConfig struct {
|
||||||
ExternalController string `yaml:"external-controller"`
|
ExternalController string `yaml:"external-controller"`
|
||||||
Secret string `yaml:"secret"`
|
Secret string `yaml:"secret"`
|
||||||
|
|
||||||
DNS *rawDNS `yaml:"dns"`
|
DNS rawDNS `yaml:"dns"`
|
||||||
Proxy []map[string]interface{} `yaml:"Proxy"`
|
Proxy []map[string]interface{} `yaml:"Proxy"`
|
||||||
ProxyGroup []map[string]interface{} `yaml:"Proxy Group"`
|
ProxyGroup []map[string]interface{} `yaml:"Proxy Group"`
|
||||||
Rule []string `yaml:"Rule"`
|
Rule []string `yaml:"Rule"`
|
||||||
|
@ -95,7 +95,7 @@ func readConfig(path string) (*rawConfig, error) {
|
||||||
Rule: []string{},
|
Rule: []string{},
|
||||||
Proxy: []map[string]interface{}{},
|
Proxy: []map[string]interface{}{},
|
||||||
ProxyGroup: []map[string]interface{}{},
|
ProxyGroup: []map[string]interface{}{},
|
||||||
DNS: &rawDNS{
|
DNS: rawDNS{
|
||||||
Enable: false,
|
Enable: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,6 @@ func hostWithDefaultPort(host string, defPort string) (string, error) {
|
||||||
|
|
||||||
func parseNameServer(servers []string) ([]dns.NameServer, error) {
|
func parseNameServer(servers []string) ([]dns.NameServer, error) {
|
||||||
nameservers := []dns.NameServer{}
|
nameservers := []dns.NameServer{}
|
||||||
log.Debugln("%#v", servers)
|
|
||||||
|
|
||||||
for idx, server := range servers {
|
for idx, server := range servers {
|
||||||
// parse without scheme .e.g 8.8.8.8:53
|
// parse without scheme .e.g 8.8.8.8:53
|
||||||
|
@ -387,7 +386,7 @@ func parseNameServer(servers []string) ([]dns.NameServer, error) {
|
||||||
return nameservers, nil
|
return nameservers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseDNS(cfg *rawDNS) (*DNS, error) {
|
func parseDNS(cfg rawDNS) (*DNS, error) {
|
||||||
if cfg.Enable && len(cfg.NameServer) == 0 {
|
if cfg.Enable && len(cfg.NameServer) == 0 {
|
||||||
return nil, fmt.Errorf("If DNS configuration is turned on, NameServer cannot be empty")
|
return nil, fmt.Errorf("If DNS configuration is turned on, NameServer cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,8 +244,6 @@ func New(config Config) *Resolver {
|
||||||
mmdb, _ = geoip2.Open(C.Path.MMDB())
|
mmdb, _ = geoip2.Open(C.Path.MMDB())
|
||||||
})
|
})
|
||||||
|
|
||||||
println(config.EnhancedMode)
|
|
||||||
|
|
||||||
r := &Resolver{
|
r := &Resolver{
|
||||||
main: transform(config.Main),
|
main: transform(config.Main),
|
||||||
ipv6: config.IPv6,
|
ipv6: config.IPv6,
|
||||||
|
|
|
@ -120,8 +120,6 @@ func (t *Tunnel) handleConn(localConn C.ServerAdapter) {
|
||||||
log.Debugln("[DNS] %s --> %s", metadata.Host, ip.String())
|
log.Debugln("[DNS] %s --> %s", metadata.Host, ip.String())
|
||||||
metadata.IP = &ip
|
metadata.IP = &ip
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log.Debugln("[DNS] unknown%#v", metadata)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var proxy C.Proxy
|
var proxy C.Proxy
|
||||||
|
|
Loading…
Reference in a new issue