Documentation
¶
Overview ¶
Package fastip implements the algorithm that allows to query multiple resolvers, ping all IP addresses that were returned, and return the fastest one among them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Logger is used as the base logger for the service. If nil,
// [slog.Default] with [LogPrefix] is used.
Logger *slog.Logger
// PingWaitTimeout is the timeout for waiting all the resolved addresses to
// be pinged. Any ping results received after that moment are cached, but
// won't be used. If zero, [DefaultPingWaitTimeout] is used.
PingWaitTimeout time.Duration
}
Config contains all the fields necessary for proxy configuration.
type FastestAddr ¶
type FastestAddr struct {
// contains filtered or unexported fields
}
FastestAddr provides methods to determine the fastest network addresses.
func (*FastestAddr) ExchangeFastest ¶
func (f *FastestAddr) ExchangeFastest( ctx context.Context, req *dns.Msg, ups []upstream.Upstream, ) (resp *dns.Msg, u upstream.Upstream, err error)
ExchangeFastest queries each specified upstream and returns the response with the fastest IP address. The fastest IP address is considered to be the first one successfully dialed and other addresses are removed from the answer.
Click to show internal directories.
Click to hide internal directories.