diff --git a/dnscrypt-proxy/plugins.go b/dnscrypt-proxy/plugins.go index d1506206..738e1178 100644 --- a/dnscrypt-proxy/plugins.go +++ b/dnscrypt-proxy/plugins.go @@ -164,11 +164,11 @@ func NewPluginsState(proxy *Proxy, clientProto string, clientAddr *net.Addr, sta } } -func (pluginsState *PluginsState) ApplyQueryPlugins(pluginsGlobals *PluginsGlobals, packet []byte, serverName *string) ([]byte, error) { +func (pluginsState *PluginsState) ApplyQueryPlugins(pluginsGlobals *PluginsGlobals, packet []byte, serverName string) ([]byte, error) { if len(*pluginsGlobals.queryPlugins) == 0 && len(*pluginsGlobals.loggingPlugins) == 0 { return packet, nil } - pluginsState.serverName = *serverName + pluginsState.serverName = serverName pluginsState.action = PluginsActionForward msg := dns.Msg{} if err := msg.Unpack(packet); err != nil { diff --git a/dnscrypt-proxy/proxy.go b/dnscrypt-proxy/proxy.go index 5bda514e..5d7c809f 100644 --- a/dnscrypt-proxy/proxy.go +++ b/dnscrypt-proxy/proxy.go @@ -332,7 +332,11 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str return } pluginsState := NewPluginsState(proxy, clientProto, clientAddr, start) - query, _ = pluginsState.ApplyQueryPlugins(&proxy.pluginsGlobals, query, &serverInfo.Name) + serverName := "-" + if serverInfo != nil { + serverName = serverInfo.Name + } + query, _ = pluginsState.ApplyQueryPlugins(&proxy.pluginsGlobals, query, serverName) if len(query) < MinDNSPacketSize || len(query) > MaxDNSPacketSize { return } diff --git a/dnscrypt-proxy/serversInfo.go b/dnscrypt-proxy/serversInfo.go index d152b529..c56e6dce 100644 --- a/dnscrypt-proxy/serversInfo.go +++ b/dnscrypt-proxy/serversInfo.go @@ -149,11 +149,12 @@ func (serversInfo *ServersInfo) refresh(proxy *Proxy) (int, error) { } serversInfo.inner = inner - dlog.Notice("Sorted latencies:") - for i := 0; i < innerLen; i++ { - dlog.Noticef("- %5dms %s", inner[i].initialRtt, inner[i].Name) + if innerLen > 1 { + dlog.Notice("Sorted latencies:") + for i := 0; i < innerLen; i++ { + dlog.Noticef("- %5dms %s", inner[i].initialRtt, inner[i].Name) + } } - if innerLen > 0 { dlog.Noticef("Server with the lowest initial latency: %s (rtt: %dms)", inner[0].Name, inner[0].initialRtt) proxy.certIgnoreTimestamp = false