diff --git a/dnscrypt-proxy/coldstart.go b/dnscrypt-proxy/coldstart.go index 209c3417..dbf075f3 100644 --- a/dnscrypt-proxy/coldstart.go +++ b/dnscrypt-proxy/coldstart.go @@ -146,13 +146,13 @@ func ColdStart(proxy *Proxy) (*CaptivePortalHandler, error) { if len(proxy.captivePortalMapFile) == 0 { return nil, nil } - bin, err := ReadTextFile(proxy.captivePortalMapFile) + lines, err := ReadTextFile(proxy.captivePortalMapFile) if err != nil { dlog.Warn(err) return nil, err } ipsMap := make(CaptivePortalMap) - for lineNo, line := range strings.Split(string(bin), "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/config.go b/dnscrypt-proxy/config.go index 13b211bd..e9d99d5a 100644 --- a/dnscrypt-proxy/config.go +++ b/dnscrypt-proxy/config.go @@ -906,7 +906,7 @@ func (config *Config) loadSource(proxy *Proxy, cfgSourceName string, cfgSource * cfgSource.Prefix, ) if err != nil { - if len(source.bin) == 0 { + if len(source.bin) <= 0 { dlog.Criticalf("Unable to retrieve source [%s]: [%s]", cfgSourceName, err) return err } diff --git a/dnscrypt-proxy/netprobe_others.go b/dnscrypt-proxy/netprobe_others.go index 4d399298..1745b46f 100644 --- a/dnscrypt-proxy/netprobe_others.go +++ b/dnscrypt-proxy/netprobe_others.go @@ -11,7 +11,7 @@ import ( ) func NetProbe(proxy *Proxy, address string, timeout int) error { - if len(address) == 0 || timeout == 0 { + if len(address) <= 0 || timeout == 0 { return nil } if captivePortalHandler, err := ColdStart(proxy); err == nil { diff --git a/dnscrypt-proxy/plugin_allow_ip.go b/dnscrypt-proxy/plugin_allow_ip.go index bba56db1..a25b915f 100644 --- a/dnscrypt-proxy/plugin_allow_ip.go +++ b/dnscrypt-proxy/plugin_allow_ip.go @@ -30,13 +30,13 @@ func (plugin *PluginAllowedIP) Description() string { func (plugin *PluginAllowedIP) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of allowed IP rules from [%s]", proxy.allowedIPFile) - bin, err := ReadTextFile(proxy.allowedIPFile) + lines, err := ReadTextFile(proxy.allowedIPFile) if err != nil { return err } plugin.allowedPrefixes = iradix.New() plugin.allowedIPs = make(map[string]interface{}) - for lineNo, line := range strings.Split(bin, "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/plugin_allow_name.go b/dnscrypt-proxy/plugin_allow_name.go index 80ca75c7..f956c40e 100644 --- a/dnscrypt-proxy/plugin_allow_name.go +++ b/dnscrypt-proxy/plugin_allow_name.go @@ -29,13 +29,13 @@ func (plugin *PluginAllowName) Description() string { func (plugin *PluginAllowName) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of allowed names from [%s]", proxy.allowNameFile) - bin, err := ReadTextFile(proxy.allowNameFile) + lines, err := ReadTextFile(proxy.allowNameFile) if err != nil { return err } plugin.allWeeklyRanges = proxy.allWeeklyRanges plugin.patternMatcher = NewPatternMatcher() - for lineNo, line := range strings.Split(string(bin), "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/plugin_block_ip.go b/dnscrypt-proxy/plugin_block_ip.go index 3d50b9a8..85c9b717 100644 --- a/dnscrypt-proxy/plugin_block_ip.go +++ b/dnscrypt-proxy/plugin_block_ip.go @@ -30,13 +30,13 @@ func (plugin *PluginBlockIP) Description() string { func (plugin *PluginBlockIP) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of IP blocking rules from [%s]", proxy.blockIPFile) - bin, err := ReadTextFile(proxy.blockIPFile) + lines, err := ReadTextFile(proxy.blockIPFile) if err != nil { return err } plugin.blockedPrefixes = iradix.New() plugin.blockedIPs = make(map[string]interface{}) - for lineNo, line := range strings.Split(string(bin), "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/plugin_block_name.go b/dnscrypt-proxy/plugin_block_name.go index d28bfb52..bce718ab 100644 --- a/dnscrypt-proxy/plugin_block_name.go +++ b/dnscrypt-proxy/plugin_block_name.go @@ -87,7 +87,7 @@ func (plugin *PluginBlockName) Description() string { func (plugin *PluginBlockName) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of blocking rules from [%s]", proxy.blockNameFile) - bin, err := ReadTextFile(proxy.blockNameFile) + lines, err := ReadTextFile(proxy.blockNameFile) if err != nil { return err } @@ -95,7 +95,7 @@ func (plugin *PluginBlockName) Init(proxy *Proxy) error { allWeeklyRanges: proxy.allWeeklyRanges, patternMatcher: NewPatternMatcher(), } - for lineNo, line := range strings.Split(string(bin), "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/plugin_cloak.go b/dnscrypt-proxy/plugin_cloak.go index 48810774..a4b2085e 100644 --- a/dnscrypt-proxy/plugin_cloak.go +++ b/dnscrypt-proxy/plugin_cloak.go @@ -39,7 +39,7 @@ func (plugin *PluginCloak) Description() string { func (plugin *PluginCloak) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of cloaking rules from [%s]", proxy.cloakFile) - bin, err := ReadTextFile(proxy.cloakFile) + lines, err := ReadTextFile(proxy.cloakFile) if err != nil { return err } @@ -47,7 +47,7 @@ func (plugin *PluginCloak) Init(proxy *Proxy) error { plugin.createPTR = proxy.cloakedPTR plugin.patternMatcher = NewPatternMatcher() cloakedNames := make(map[string]*CloakedName) - for lineNo, line := range strings.Split(bin, "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/plugin_forward.go b/dnscrypt-proxy/plugin_forward.go index a16ac2d5..faec6e12 100644 --- a/dnscrypt-proxy/plugin_forward.go +++ b/dnscrypt-proxy/plugin_forward.go @@ -29,11 +29,11 @@ func (plugin *PluginForward) Description() string { func (plugin *PluginForward) Init(proxy *Proxy) error { dlog.Noticef("Loading the set of forwarding rules from [%s]", proxy.forwardFile) - bin, err := ReadTextFile(proxy.forwardFile) + lines, err := ReadTextFile(proxy.forwardFile) if err != nil { return err } - for lineNo, line := range strings.Split(string(bin), "\n") { + for lineNo, line := range strings.Split(lines, "\n") { line = TrimAndStripInlineComments(line) if len(line) == 0 { continue diff --git a/dnscrypt-proxy/proxy.go b/dnscrypt-proxy/proxy.go index 2f1afc66..c1b1e248 100644 --- a/dnscrypt-proxy/proxy.go +++ b/dnscrypt-proxy/proxy.go @@ -127,7 +127,7 @@ func (proxy *Proxy) addDNSListener(listenAddrStr string) { } // if 'userName' is not set, continue as before - if len(proxy.userName) == 0 { + if len(proxy.userName) <= 0 { if err := proxy.udpListenerFromAddr(listenUDPAddr); err != nil { dlog.Fatal(err) } @@ -191,7 +191,7 @@ func (proxy *Proxy) addLocalDoHListener(listenAddrStr string) { } // if 'userName' is not set, continue as before - if len(proxy.userName) == 0 { + if len(proxy.userName) <= 0 { if err := proxy.localDoHListenerFromAddr(listenTCPAddr); err != nil { dlog.Fatal(err) }