Maintenance: improve DNS settings log

This commit is contained in:
Quentin McGaw
2021-02-01 01:22:46 +00:00
parent dd5a9c6067
commit 81556ec2e1
4 changed files with 65 additions and 48 deletions

View File

@@ -3,7 +3,9 @@ package settings
import (
"net"
"testing"
"time"
"github.com/qdm12/dns/pkg/models"
"github.com/stretchr/testify/assert"
)
@@ -18,34 +20,47 @@ func Test_DNS_Lines(t *testing.T) {
PlaintextAddress: net.IP{1, 1, 1, 1},
},
lines: []string{
"DNS over TLS disabled, using plaintext DNS 1.1.1.1",
" |--DNS:",
" |--Plaintext address: 1.1.1.1",
" |--Keep nameserver (disabled blocking): no",
" |--DNS over TLS: disabled",
},
},
"enabled DOT": {
settings: DNS{
Enabled: true,
Enabled: true,
KeepNameserver: true,
Unbound: models.Settings{
Providers: []string{"cloudflare"},
},
BlockMalicious: true,
BlockAds: true,
BlockSurveillance: true,
UpdatePeriod: time.Hour,
},
lines: []string{
"DNS settings:",
" |--Unbound:",
" |--DNS over TLS provider:",
" |--Listening port: 0",
" |--Access control:",
" |--Allowed:",
" |--Caching: disabled",
" |--IPv4 resolution: disabled",
" |--IPv6 resolution: disabled",
" |--Verbosity level: 0/5",
" |--Verbosity details level: 0/4",
" |--Validation log level: 0/2",
" |--Blocked hostnames:",
" |--Blocked IP addresses:",
" |--Allowed hostnames:",
" |--Block malicious: disabled",
" |--Block ads: disabled",
" |--Block surveillance: disabled",
" |--Update: deactivated",
" |--Keep nameserver (disabled blocking): no",
" |--DNS:",
" |--Keep nameserver (disabled blocking): yes",
" |--DNS over TLS:",
" |--Unbound:",
" |--DNS over TLS providers:",
" |--cloudflare",
" |--Listening port: 0",
" |--Access control:",
" |--Allowed:",
" |--Caching: disabled",
" |--IPv4 resolution: disabled",
" |--IPv6 resolution: disabled",
" |--Verbosity level: 0/5",
" |--Verbosity details level: 0/4",
" |--Validation log level: 0/2",
" |--Blocked hostnames:",
" |--Blocked IP addresses:",
" |--Allowed hostnames:",
" |--Block malicious: enabled",
" |--Block ads: enabled",
" |--Block surveillance: enabled",
" |--Update: every 1h0m0s",
},
},
}