From 9a49b3d27edcb30da7f16a065226907833b1dc81 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 22 Mar 2021 15:39:17 +0300 Subject: [PATCH] aghnet: imp docs and logging --- internal/aghnet/systemresolvers.go | 12 ++++++------ ...esolver_windows.go => systemresolvers_windows.go} | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) rename internal/aghnet/{systemresolver_windows.go => systemresolvers_windows.go} (96%) diff --git a/internal/aghnet/systemresolvers.go b/internal/aghnet/systemresolvers.go index 1d7cbed81ad..4a0ae6ca5b7 100644 --- a/internal/aghnet/systemresolvers.go +++ b/internal/aghnet/systemresolvers.go @@ -18,13 +18,13 @@ type HostGenFunc func() (host string) // unit is an alias for an existing map value. type unit = struct{} -// SystemResolvers provides methods to deal with local resolvers provided by -// system. +// SystemResolvers helps to work with local resolvers' addresses provided by OS. type SystemResolvers interface { - // Get implements SystemResolvers interface for *systemResolvers. It is - // safe for concurrent use. + // Get returns the slice of local resolvers' addresses. + // It should be safe for concurrent use. Get() (rs []string) - // Refresh refreshes the local resolvers' addresses cache. + // Refresh refreshes the local resolvers' addresses cache. It should be + // safe for concurrent use. Refresh() (err error) } @@ -49,7 +49,7 @@ func refreshWithTicker(sr SystemResolvers, tickCh <-chan time.Time) { continue } - log.Debug("local addresses cache is refreshed") + log.Debug("systemResolvers: local addresses cache is refreshed") } } diff --git a/internal/aghnet/systemresolver_windows.go b/internal/aghnet/systemresolvers_windows.go similarity index 96% rename from internal/aghnet/systemresolver_windows.go rename to internal/aghnet/systemresolvers_windows.go index 5350107c1d7..c918b44a39e 100644 --- a/internal/aghnet/systemresolver_windows.go +++ b/internal/aghnet/systemresolvers_windows.go @@ -74,13 +74,13 @@ func (sr *systemResolvers) getAddrs() (addrs []string, err error) { defer func() { derr := stdin.Close() if derr != nil { - log.Error("closing stdin pipe: %s", derr) + log.Error("systemResolvers: closing stdin pipe: %s", derr) } }() _, werr := io.WriteString(stdin, "exit") if werr != nil { - log.Error("writing to command pipe: %s", werr) + log.Error("systemResolvers: writing to command pipe: %s", werr) } }()