diff --git a/dnscrypt-proxy/coldstart.go b/dnscrypt-proxy/coldstart.go index 0f0b73ac..9bcb7bc7 100644 --- a/dnscrypt-proxy/coldstart.go +++ b/dnscrypt-proxy/coldstart.go @@ -170,7 +170,7 @@ func ColdStart(proxy *Proxy) (*CaptivePortalHandler, error) { if err != nil { continue } - if strings.Index(ipsStr, "*") != -1 { + if strings.Contains(ipsStr, "*") { return nil, fmt.Errorf( "A captive portal rule must use an exact host name at line %d", 1+lineNo, diff --git a/dnscrypt-proxy/plugin_forward.go b/dnscrypt-proxy/plugin_forward.go index 12e52928..e3352055 100644 --- a/dnscrypt-proxy/plugin_forward.go +++ b/dnscrypt-proxy/plugin_forward.go @@ -60,10 +60,8 @@ func (plugin *PluginForward) Init(proxy *Proxy) error { continue } domain, serversStr, ok := StringTwoFields(line) - if strings.HasPrefix(domain, "*.") { - domain = domain[2:] - } - if strings.Index(domain, "*") != -1 { + domain = strings.TrimPrefix(domain, "*.") + if strings.Contains(domain, "*") { ok = false } if !ok { @@ -205,7 +203,7 @@ func (plugin *PluginForward) Eval(pluginsState *PluginsState, msg *dns.Msg) erro dlog.Infof("No response from the DHCP server while resolving [%s]", qName) continue } - if dhcpDNS != nil && len(dhcpDNS) > 0 { + if len(dhcpDNS) > 0 { server = net.JoinHostPort(dhcpDNS[rand.Intn(len(dhcpDNS))].String(), "53") break } diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index 6acd3b9b..9a06d734 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -234,7 +234,7 @@ func (xTransport *XTransport) rebuildTransport() { tlsClientConfig.Certificates = []tls.Certificate{cert} } - overrideCipherSuite := xTransport.tlsCipherSuite != nil && len(xTransport.tlsCipherSuite) > 0 + overrideCipherSuite := len(xTransport.tlsCipherSuite) > 0 if xTransport.tlsDisableSessionTickets || overrideCipherSuite { tlsClientConfig.SessionTicketsDisabled = xTransport.tlsDisableSessionTickets if !xTransport.tlsDisableSessionTickets {