mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-02-18 02:49:51 +03:00
Fix review comments
This commit is contained in:
parent
2e879896ff
commit
cc40826299
3 changed files with 9 additions and 5 deletions
|
@ -27,7 +27,7 @@ func NewDnsUpstream(endpoint string, proto string, tlsServerName string) (Upstre
|
||||||
|
|
||||||
var tlsConfig *tls.Config
|
var tlsConfig *tls.Config
|
||||||
|
|
||||||
if tlsServerName != "" {
|
if proto == "tcp-tls" {
|
||||||
tlsConfig = new(tls.Config)
|
tlsConfig = new(tls.Config)
|
||||||
tlsConfig.ServerName = tlsServerName
|
tlsConfig.ServerName = tlsServerName
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,9 @@ func (u *DnsUpstream) exchange(proto string, query *dns.Msg) (r *dns.Msg, err er
|
||||||
conn.Close() // Not giving it back
|
conn.Close() // Not giving it back
|
||||||
}
|
}
|
||||||
|
|
||||||
u.transport.Yield(conn)
|
if err == nil {
|
||||||
|
// Return it back to the connections cache if there were no errors
|
||||||
|
u.transport.Yield(conn)
|
||||||
|
}
|
||||||
return r, err
|
return r, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,7 @@ func CreateResolver(bootstrap string) *net.Resolver {
|
||||||
PreferGo: true,
|
PreferGo: true,
|
||||||
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
var d net.Dialer
|
var d net.Dialer
|
||||||
conn, err := d.DialContext(ctx, network, bootstrap)
|
return d.DialContext(ctx, network, bootstrap)
|
||||||
return conn, err
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,4 +52,6 @@ func (p *UpstreamPlugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name implements interface for CoreDNS plugin
|
// Name implements interface for CoreDNS plugin
|
||||||
func (p *UpstreamPlugin) Name() string { return "upstream" }
|
func (p *UpstreamPlugin) Name() string {
|
||||||
|
return "upstream"
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue