Pull request 2021: upd golibs
Merge in DNS/adguard-home from upd-golibs to master
Squashed commit of the following:
commit 266b002c5450329761dee21d918c80d08e5d8ab9
Merge: 99eb7745d e305bd8e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 5 14:21:51 2023 +0300
Merge branch 'master' into upd-golibs
commit 99eb7745d0bee190399f9b16cb7151f34a591b54
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 5 14:14:28 2023 +0300
home: imp alignment
commit 556cde56720ce449aec17b500825681fc8c084bf
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 5 13:35:35 2023 +0300
dnsforward: imp naming, docs
commit 1ee99655a3318263db1edbcb9e4eeb33bfe441c8
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 5 13:28:39 2023 +0300
home: make ports uint16
commit b228032ea1f5902ab9bac7b5d55d84aaf6354616
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed Oct 4 18:56:59 2023 +0300
all: rm system resolvers
commit 4b5becbed5890db80612e53861f000aaf4c869ff
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed Oct 4 17:30:16 2023 +0300
all: upd golibs
This commit is contained in:
@@ -28,17 +28,12 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// fakeSystemResolvers is a mock aghnet.SystemResolvers implementation for
|
||||
// tests.
|
||||
type fakeSystemResolvers struct {
|
||||
// SystemResolvers is embedded here simply to make *fakeSystemResolvers
|
||||
// an aghnet.SystemResolvers without actually implementing all methods.
|
||||
aghnet.SystemResolvers
|
||||
}
|
||||
// emptySysResolvers is an empty [SystemResolvers] implementation that always
|
||||
// returns nil.
|
||||
type emptySysResolvers struct{}
|
||||
|
||||
// Get implements the aghnet.SystemResolvers interface for *fakeSystemResolvers.
|
||||
// It always returns nil.
|
||||
func (fsr *fakeSystemResolvers) Get() (rs []string) {
|
||||
// Addrs implements the aghnet.SystemResolvers interface for emptySysResolvers.
|
||||
func (emptySysResolvers) Addrs() (addrs []netip.AddrPort) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -79,7 +74,7 @@ func TestDNSForwardHTTP_handleGetConfig(t *testing.T) {
|
||||
ConfigModified: func() {},
|
||||
}
|
||||
s := createTestServer(t, filterConf, forwardConf, nil)
|
||||
s.sysResolvers = &fakeSystemResolvers{}
|
||||
s.sysResolvers = &emptySysResolvers{}
|
||||
|
||||
require.NoError(t, s.Start())
|
||||
testutil.CleanupAndRequireSuccess(t, s.Stop)
|
||||
@@ -156,7 +151,7 @@ func TestDNSForwardHTTP_handleSetConfig(t *testing.T) {
|
||||
ConfigModified: func() {},
|
||||
}
|
||||
s := createTestServer(t, filterConf, forwardConf, nil)
|
||||
s.sysResolvers = &fakeSystemResolvers{}
|
||||
s.sysResolvers = &emptySysResolvers{}
|
||||
|
||||
defaultConf := s.conf
|
||||
|
||||
@@ -485,7 +480,7 @@ func TestServer_HandleTestUpstreamDNS(t *testing.T) {
|
||||
hostsListener := newLocalUpstreamListener(t, 0, goodHandler)
|
||||
hostsUps := (&url.URL{
|
||||
Scheme: "tcp",
|
||||
Host: netutil.JoinHostPort(upstreamHost, int(hostsListener.Port())),
|
||||
Host: netutil.JoinHostPort(upstreamHost, hostsListener.Port()),
|
||||
}).String()
|
||||
|
||||
hc, err := aghnet.NewHostsContainer(
|
||||
|
||||
Reference in New Issue
Block a user