Nits
Some checks are pending
CodeQL scan / Analyze (push) Waiting to run
GitHub CI / Build (push) Waiting to run
ShiftLeft Scan / Scan-Build (push) Waiting to run

This commit is contained in:
Frank Denis 2025-02-21 18:16:33 +01:00
parent 3f3cd1e67d
commit 45a4df8df5
3 changed files with 5 additions and 7 deletions

View file

@ -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,

View file

@ -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
}

View file

@ -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 {