Documentation ¶
Overview ¶
This file is compiled for all architectures except WebAssembly.
Index ¶
Constants ¶
const (
MaxPoolSize = 20
)
const RetryableError = "Nonfatal error occurred, please retry"
Variables ¶
This section is empty.
Functions ¶
func GetDefaultHostPoolHostParams ¶ added in v4.4.4
func GetDefaultHostPoolHostParams() connect.HostParams
GetDefaultHostPoolHostParams returns the default parameters used for hosts in the host pool
func IsGuilty ¶ added in v4.4.4
IsGuilty returns true if the error means the host will get kicked out of the pool
func IsHostPoolNotReadyError ¶ added in v4.4.4
Types ¶
type CertCheckerCommInterface ¶ added in v4.4.4
type CertCheckerCommInterface interface { GetGatewayTLSCertificate(host *connect.Host, message *pb.RequestGatewayCert) (*pb.GatewayCertificate, error) }
CertCheckerCommInterface is an interface for client comms to be used in cert checker
type Filter ¶
Filter filters out IDs from the provided map based on criteria in the NDF. The passed in map is a map of the NDF for easier access. The map is ID -> index in the NDF. There is no multithreading; the filter function can either edit the passed map or make a new one and return it. The general pattern is to loop through the map, then look up data about the nodes in the NDF to make a filtering decision, then add them to a new map if they are accepted.
func GatewayWhitelistFilter ¶ added in v4.5.0
GatewayWhitelistFilter accepts a list of gateway ID strings in base64 format, and returns a filter function for use in a hostpool
type HostManager ¶
type HostManager interface { GetHost(hostId *id.ID) (*connect.Host, bool) AddHost(hid *id.ID, address string, cert []byte, params connect.HostParams) ( host *connect.Host, err error) RemoveHost(hid *id.ID) }
HostManager Interface allowing storage and retrieval of Host objects
type Params ¶ added in v4.4.4
type Params struct { // MaxPoolSize is the maximum number of Hosts in the HostPool. MaxPoolSize uint32 // PoolSize allows override of HostPool size. Set to zero for dynamic size // calculation. PoolSize uint32 // ProxyAttempts dictates how many proxies will be used in event of send // failure. ProxyAttempts uint32 // MaxPings is the number of gateways to concurrently test when selecting // a new member of HostPool. Must be at least 1. MaxPings uint32 // NumConnectionsWorkers is the number of workers connecting to gateways NumConnectionsWorkers int // MinBufferLength is the minimum length of input buffers // to the hostpool runner MinBufferLength uint32 // EnableRotation enables the system which auto rotates/ gateways regularly. // This system will auto disable if the network size is less than 20. EnableRotation bool // RotationPeriod is how long until a single host is rotated. RotationPeriod time.Duration // RotationPeriodVariability is the max that the rotation // period can randomly deviate from the stated amount RotationPeriodVariability time.Duration // HostParams is the parameters for the creation of new Host objects. HostParams connect.HostParams // DebugPrintPeriod is an OPTIONAL field that may be set by the caller. // This may be set by the caller when passing Params into NewSender, as an // example. // // This field indicates how often debug prints are printed by the hostPool's // long-running thread. These debug prints will contain data on the // hostPool's state (refer to debug.go). If this value is not set by the user, // then by default debug prints will be disabled. DebugPrintPeriod time.Duration // GatewayFilter is the function which will be used to filter gateways // before connecting. This must be set before initializing a HostPool and // cannot be changed. If no filter is set, the defaultFilter will be used. GatewayFilter Filter }
Params allows configuration of HostPool parameters.
func DefaultParams ¶ added in v4.4.4
func DefaultParams() Params
DefaultParams returns a default set of PoolParams.
func DefaultPoolParams ¶
func DefaultPoolParams() Params
DefaultPoolParams is a deprecated version of DefaultParams it does the same thing, just under a different function name Use DefaultParams.
func GetParameters ¶
GetParameters returns the default PoolParams, or override with given parameters, if set.
func (*Params) MarshalJSON ¶ added in v4.4.4
MarshalJSON adheres to the json.Marshaler interface.
func (*Params) UnmarshalJSON ¶ added in v4.4.4
UnmarshalJSON adheres to the json.Unmarshaler interface.
type SendToPreferredFunc ¶
type SendToPreferredFunc func(host *connect.Host, target *id.ID, timeout time.Duration) (interface{}, error)
SendToPreferredFunc is the send function passed into Sender.SendToPreferred.
type Sender ¶
type Sender interface { SendToAny(sendFunc func(host *connect.Host) (interface{}, error), stop *stoppable.Single) (interface{}, error) SendToPreferred(targets []*id.ID, sendFunc SendToPreferredFunc, stop *stoppable.Single, timeout time.Duration) (interface{}, error) UpdateNdf(ndf *ndf.NetworkDefinition) GetHostParams() connect.HostParams StartProcesses() stoppable.Stoppable }
Sender object is used for sending that wraps the HostPool for providing destinations.
func NewSender ¶
func NewSender(poolParams Params, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager, storage storage.Session, comms CertCheckerCommInterface, addChan chan commNetwork.NodeGateway) (Sender, error)
NewSender creates a new Sender object wrapping a HostPool object
func NewTestingSender ¶ added in v4.4.4
func NewTestingSender(poolParams Params, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager, storage storage.Session, addChan chan commNetwork.NodeGateway, t *testing.T) (Sender, error)
NewSender creates a new Sender object wrapping a HostPool object