Pull request 1933: upd-golibs

Squashed commit of the following:

commit 081d10e6909def3a075707e75dbd0c5f63f91903
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jul 20 14:17:01 2023 +0300

    aghnet: fix docs

commit 7433b72c0653cb33fe5ff810ae8a1346a6994f95
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jul 20 14:03:16 2023 +0300

    all: imp tests; upd golibs
This commit is contained in:
Ainar Garipov
2023-07-20 14:26:35 +03:00
parent 4e8d3d7628
commit 5be0e84719
22 changed files with 587 additions and 638 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/netutil"
@@ -49,7 +50,7 @@ func (Empty) Process(_ context.Context, _ netip.Addr) (info *Info, changed bool)
// Config is the configuration structure for Default.
type Config struct {
// DialContext is used to create TCP connections to WHOIS servers.
DialContext DialContextFunc
DialContext aghnet.DialContextFunc
// ServerAddr is the address of the WHOIS server.
ServerAddr string
@@ -77,13 +78,6 @@ type Config struct {
Port uint16
}
// DialContextFunc is the semantic alias for dialing functions, such as
// [http.Transport.DialContext].
//
// TODO(a.garipov): Move to aghnet once it stops importing aghtest, because
// otherwise there is an import cycle.
type DialContextFunc = func(ctx context.Context, network, addr string) (conn net.Conn, err error)
// Default is the default WHOIS information processor.
type Default struct {
// cache is the cache containing IP addresses of clients. An active IP
@@ -93,7 +87,7 @@ type Default struct {
cache gcache.Cache
// dialContext is used to create TCP connections to WHOIS servers.
dialContext DialContextFunc
dialContext aghnet.DialContextFunc
// serverAddr is the address of the WHOIS server.
serverAddr string