fastip

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 6

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 FastestAddr

type FastestAddr struct {
	// contains filtered or unexported fields
}

FastestAddr - object data

func NewFastestAddr

func NewFastestAddr() *FastestAddr

NewFastestAddr initializes a new instance of the FastestAddr

func (*FastestAddr) ExchangeFastest

func (f *FastestAddr) ExchangeFastest(req *dns.Msg, upstreams []upstream.Upstream) (*dns.Msg, upstream.Upstream, error)

ExchangeFastest queries all specified upstreams and returns a response with the fastest IP address.

Algorithm: Return DNS response containing the fastest IP address Algorithm: . Send requests to all upstream servers . Receive responses . Search all IP addresses in cache:

. If all addresses have been found: choose the fastest
. If several (but not all) addresses have been found: remember the fastest

. For each response, for each IP address (not found in cache):

. connect via TCP

. Receive TCP connection status. The first connected address - the fastest IP address. . Choose the fastest address between this and the one previously found in cache . Return DNS packet containing the chosen IP address (remove all other IP addresses from the packet)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL