mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-28 00:20:13 +01:00
Don't display sorted latencies if there is only one (or none)
This commit is contained in:
parent
8e01421304
commit
aca031c2ec
@ -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 {
|
if len(*pluginsGlobals.queryPlugins) == 0 && len(*pluginsGlobals.loggingPlugins) == 0 {
|
||||||
return packet, nil
|
return packet, nil
|
||||||
}
|
}
|
||||||
pluginsState.serverName = *serverName
|
pluginsState.serverName = serverName
|
||||||
pluginsState.action = PluginsActionForward
|
pluginsState.action = PluginsActionForward
|
||||||
msg := dns.Msg{}
|
msg := dns.Msg{}
|
||||||
if err := msg.Unpack(packet); err != nil {
|
if err := msg.Unpack(packet); err != nil {
|
||||||
|
@ -332,7 +332,11 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
pluginsState := NewPluginsState(proxy, clientProto, clientAddr, start)
|
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 {
|
if len(query) < MinDNSPacketSize || len(query) > MaxDNSPacketSize {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -149,11 +149,12 @@ func (serversInfo *ServersInfo) refresh(proxy *Proxy) (int, error) {
|
|||||||
}
|
}
|
||||||
serversInfo.inner = inner
|
serversInfo.inner = inner
|
||||||
|
|
||||||
dlog.Notice("Sorted latencies:")
|
if innerLen > 1 {
|
||||||
for i := 0; i < innerLen; i++ {
|
dlog.Notice("Sorted latencies:")
|
||||||
dlog.Noticef("- %5dms %s", inner[i].initialRtt, inner[i].Name)
|
for i := 0; i < innerLen; i++ {
|
||||||
|
dlog.Noticef("- %5dms %s", inner[i].initialRtt, inner[i].Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if innerLen > 0 {
|
if innerLen > 0 {
|
||||||
dlog.Noticef("Server with the lowest initial latency: %s (rtt: %dms)", inner[0].Name, inner[0].initialRtt)
|
dlog.Noticef("Server with the lowest initial latency: %s (rtt: %dms)", inner[0].Name, inner[0].initialRtt)
|
||||||
proxy.certIgnoreTimestamp = false
|
proxy.certIgnoreTimestamp = false
|
||||||
|
Loading…
Reference in New Issue
Block a user