Skip to content

Commit 45a4df8

Browse files
committed
Nits
1 parent 3f3cd1e commit 45a4df8

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

dnscrypt-proxy/coldstart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func ColdStart(proxy *Proxy) (*CaptivePortalHandler, error) {
170170
if err != nil {
171171
continue
172172
}
173-
if strings.Index(ipsStr, "*") != -1 {
173+
if strings.Contains(ipsStr, "*") {
174174
return nil, fmt.Errorf(
175175
"A captive portal rule must use an exact host name at line %d",
176176
1+lineNo,

dnscrypt-proxy/plugin_forward.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ func (plugin *PluginForward) Init(proxy *Proxy) error {
6060
continue
6161
}
6262
domain, serversStr, ok := StringTwoFields(line)
63-
if strings.HasPrefix(domain, "*.") {
64-
domain = domain[2:]
65-
}
66-
if strings.Index(domain, "*") != -1 {
63+
domain = strings.TrimPrefix(domain, "*.")
64+
if strings.Contains(domain, "*") {
6765
ok = false
6866
}
6967
if !ok {
@@ -205,7 +203,7 @@ func (plugin *PluginForward) Eval(pluginsState *PluginsState, msg *dns.Msg) erro
205203
dlog.Infof("No response from the DHCP server while resolving [%s]", qName)
206204
continue
207205
}
208-
if dhcpDNS != nil && len(dhcpDNS) > 0 {
206+
if len(dhcpDNS) > 0 {
209207
server = net.JoinHostPort(dhcpDNS[rand.Intn(len(dhcpDNS))].String(), "53")
210208
break
211209
}

dnscrypt-proxy/xtransport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (xTransport *XTransport) rebuildTransport() {
234234
tlsClientConfig.Certificates = []tls.Certificate{cert}
235235
}
236236

237-
overrideCipherSuite := xTransport.tlsCipherSuite != nil && len(xTransport.tlsCipherSuite) > 0
237+
overrideCipherSuite := len(xTransport.tlsCipherSuite) > 0
238238
if xTransport.tlsDisableSessionTickets || overrideCipherSuite {
239239
tlsClientConfig.SessionTicketsDisabled = xTransport.tlsDisableSessionTickets
240240
if !xTransport.tlsDisableSessionTickets {

0 commit comments

Comments
 (0)