Merge branch 'master' of github.com:DNSCrypt/dnscrypt-proxy

* 'master' of github.com:DNSCrypt/dnscrypt-proxy:
  The source tests are completely brok4n :(
  Explain how to listen to all IP addresses
  In the query log, consider everything that's not UDP as TCP
This commit is contained in:
Frank Denis 2021-01-22 09:16:56 +01:00
commit 0ab9e30fa9
3 changed files with 7 additions and 3 deletions

View File

@ -35,6 +35,9 @@
## List of local addresses and ports to listen to. Can be IPv4 and/or IPv6.
## Example with both IPv4 and IPv6:
## listen_addresses = ['127.0.0.1:53', '[::1]:53']
##
## To listen to all IPv4 addresses, use `listen_addresses = ['0.0.0.0:53']`
## To listen to all IPv4+IPv6 addresses, use `listen_addresses = ['[::]:53']`
listen_addresses = ['127.0.0.1:53']

View File

@ -58,10 +58,8 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err
var clientIPStr string
if pluginsState.clientProto == "udp" {
clientIPStr = (*pluginsState.clientAddr).(*net.UDPAddr).IP.String()
} else if pluginsState.clientProto == "tcp" {
clientIPStr = (*pluginsState.clientAddr).(*net.TCPAddr).IP.String()
} else {
clientIPStr = "-"
clientIPStr = (*pluginsState.clientAddr).(*net.TCPAddr).IP.String()
}
qName := pluginsState.qName

View File

@ -9,6 +9,7 @@ import (
"net/url"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"testing"
@ -379,6 +380,8 @@ func TestNewSource(t *testing.T) {
} else {
c.Nil(err, "Unexpected error")
}
sort.SliceStable(got.urls, func(i, j int) bool { return got.urls[i].String() < got.urls[j].String() })
sort.SliceStable(e.Source.urls, func(i, j int) bool { return e.Source.urls[i].String() < e.Source.urls[j].String() })
c.DeepEqual(got, e.Source, "Unexpected return")
checkTestServer(c, d)
checkSourceCache(c, e)