Skip to content

Commit

Permalink
aghnet: imp docs and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Mar 22, 2021
1 parent 74f95a2 commit 9a49b3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions internal/aghnet/systemresolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}()

Expand Down

0 comments on commit 9a49b3d

Please sign in to comment.