messenger

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AckRejectFailedToParse  = "Failed to parse"
	AckRejectFailedToVerify = "Failed to verfiy"
	AckRejectPolicyError    = "Message rejected due to policy"
	AckRetryDBError         = "DB Error"
)

Variables

This section is empty.

Functions

func SendAckHelper added in v0.4.0

func SendAckHelper(ctx context.Context, rw infra.ResponseWriter) func(proto.Ack_ErrCode, string)

SendAckHelper binds the given arguments and returns a function that is convenient to call. This is only to reduce boilerplate code in message handlers. Note that ctx should have a logger attached.

Types

type AddressRewriter added in v0.4.0

type AddressRewriter struct {
	// Router obtains path information to fill in address paths, if they are
	// required and missing.
	Router snet.Router
	// SVCRouter builds underlay addresses for intra-AS SVC traffic, based on
	// information found in the topology.
	SVCRouter LocalSVCRouter
	// Resolver performs SVC resolution if enabled.
	Resolver Resolver
	// SVCResolutionFraction enables SVC resolution for traffic to SVC
	// destinations in a way that is also compatible with control plane servers
	// that do not implement the SVC Resolution Mechanism. The value represents
	// the percentage of time, out of the total available context timeout,
	// spent attempting to perform SVC resolution. If SVCResolutionFraction is
	// 0 or less, SVC resolution is never attempted. If it is between 0 and 1,
	// the remaining context timeout is multiplied by the value, and that
	// amount of time is spent waiting for an SVC resolution reply from the
	// server. If this times out, the data packet is sent with an SVC
	// destination. If the value is 1 or more, then legacy behavior is
	// disabled, and data packets are never sent to SVC destinations unless the
	// resolution step is successful.
	SVCResolutionFraction float64
}

AddressRewriter is used to compute paths and replace SVC destinations with unicast addresses.

func (AddressRewriter) RedirectToQUIC added in v0.4.0

func (r AddressRewriter) RedirectToQUIC(ctx context.Context,
	address net.Addr) (net.Addr, bool, error)

RedirectToQUIC takes an address and adds a path (if one does not already exist but is required), and replaces SVC destinations with QUIC unicast ones, if possible.

The returned boolean value is set to true if the remote server is QUIC-compatible and we have successfully discovered its address.

If the address is already unicast, no redirection to QUIC is attempted.

type LocalSVCRouter added in v0.4.0

type LocalSVCRouter interface {
	// GetUnderlay returns the underlay address of a SVC server of the specified
	// type. When multiple servers are available, the choice is random.
	GetUnderlay(svc addr.HostSVC) (*net.UDPAddr, error)
}

LocalSVCRouter is used to construct underlay information for SVC servers running in the local AS.

func NewSVCRouter added in v0.4.0

func NewSVCRouter(tp topology.Provider) LocalSVCRouter

NewSVCRouter build a SVC router backed by topology information from the specified provider.

type Resolver added in v0.4.0

type Resolver interface {
	// LookupSVC resolves the SVC address for the AS terminating the path.
	LookupSVC(ctx context.Context, path snet.Path, svc addr.HostSVC) (*svc.Reply, error)
}

Resolver performs SVC resolution for a remote AS, thus converting an anycast SVC address to a unicast IP/UDP one.

Directories

Path Synopsis
Package mock_messenger is a generated GoMock package.
Package mock_messenger is a generated GoMock package.

Jump to

Keyboard shortcuts

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