Documentation ¶
Index ¶
- Constants
- func DialEdge(ctx context.Context, timeout time.Duration, tlsConfig *tls.Config, ...) (net.Conn, error)
- type DialError
- type Edge
- func (ed *Edge) AvailableAddrs() int
- func (ed *Edge) GetAddr(connIndex int) (*allregions.EdgeAddr, error)
- func (ed *Edge) GetAddrForRPC() (*allregions.EdgeAddr, error)
- func (ed *Edge) GetDifferentAddr(connIndex int, hasConnectivityError bool) (*allregions.EdgeAddr, error)
- func (ed *Edge) GiveBack(addr *allregions.EdgeAddr, hasConnectivityError bool) bool
- type ErrNoAddressesLeft
- type PercentageFetcher
- type ProtocolPercent
- type ProtocolPercents
Constants ¶
const ( LogFieldConnIndex = "connIndex" LogFieldIPAddress = "ip" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DialError ¶
type DialError struct {
// contains filtered or unexported fields
}
DialError is an error returned from DialEdge
type Edge ¶
Edge finds addresses on the Khulnasoft edge and hands them out to connections.
func ResolveEdge ¶
func ResolveEdge(log *zerolog.Logger, region string, edgeIpVersion allregions.ConfigIPVersion) (*Edge, error)
ResolveEdge runs the initial discovery of the Khulnasoft edge, finding Addrs that can be allocated to connections.
func StaticEdge ¶
StaticEdge creates a list of edge addresses from the list of hostnames. Mainly used for testing connectivity.
func (*Edge) AvailableAddrs ¶
AvailableAddrs returns how many unused addresses there are left.
func (*Edge) GetAddr ¶
func (ed *Edge) GetAddr(connIndex int) (*allregions.EdgeAddr, error)
GetAddr gives this proxy connection an edge Addr. Prefer Addrs this connection has already used.
func (*Edge) GetAddrForRPC ¶
func (ed *Edge) GetAddrForRPC() (*allregions.EdgeAddr, error)
GetAddrForRPC gives this connection an edge Addr.
func (*Edge) GetDifferentAddr ¶
func (ed *Edge) GetDifferentAddr(connIndex int, hasConnectivityError bool) (*allregions.EdgeAddr, error)
GetDifferentAddr gives back the proxy connection's edge Addr and uses a new one.
type ErrNoAddressesLeft ¶
type ErrNoAddressesLeft struct{}
func (ErrNoAddressesLeft) Error ¶
func (e ErrNoAddressesLeft) Error() string
type PercentageFetcher ¶
type PercentageFetcher func() (ProtocolPercents, error)
type ProtocolPercent ¶
type ProtocolPercent struct { Protocol string `json:"protocol"` Percentage int32 `json:"percentage"` }
ProtocolPercent represents a single Protocol Percentage combination.
type ProtocolPercents ¶
type ProtocolPercents []ProtocolPercent
ProtocolPercents represents the preferred distribution ratio of protocols when protocol isn't specified.
func ProtocolPercentage ¶
func ProtocolPercentage() (ProtocolPercents, error)
ProtocolPercentage returns the ratio of protocols and a specification ratio for their selection.
func (ProtocolPercents) GetPercentage ¶
func (p ProtocolPercents) GetPercentage(protocol string) int32
GetPercentage returns the threshold percentage of a single protocol.