transport

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// Config indicates this is a controllerbus config.
	config.Config
	// Debuggable indicates this config is debuggable.
	config.Debuggable
	// GetTransportPeerId returns the node peer ID constraint.
	GetTransportPeerId() string
	// SetTransportPeerId sets the node peer ID field.
	SetTransportPeerId(peerID string)
}

Config contains common parameters all transport configs must have.

type Controller

type Controller interface {
	// Controller is the controllerbus controller interface.
	controller.Controller

	// GetTransport returns the controlled transport.
	// This may wait for the controller to be ready.
	GetTransport(ctx context.Context) (Transport, error)
}

Controller is a transport controller.

type LookupTransport

type LookupTransport interface {
	// Directive indicates LookupTransport is a directive.
	directive.Directive

	// LookupTransportPeerIDConstraint returns a specific node ID we are looking for.
	// Can be empty.
	LookupTransportPeerIDConstraint() peer.ID
	// LookupTransportIDConstraint returns a specific transport ID we are looking for.
	// Can be empty.
	LookupTransportIDConstraint() uint64
}

LookupTransport is a directive to lookup running transports. Value type: transport.Transport.

func NewLookupTransport

func NewLookupTransport(peerID peer.ID, transportID uint64) LookupTransport

NewLookupTransport constructs a new LookupTransport directive.

type Transport

type Transport interface {
	// Execute executes the transport as configured, returning any fatal error.
	Execute(ctx context.Context) error

	// GetUUID returns a host-unique ID for this transport.
	GetUUID() uint64
	// GetPeerID returns the peer ID.
	GetPeerID() peer.ID

	// Close closes the transport, returning any errors closing.
	Close() error
}

Transport is similar to a NIC, yielding links to remote peers.

type TransportHandler

type TransportHandler interface {
	// HandleLinkEstablished is called when a link is established.
	HandleLinkEstablished(lnk link.Link)
	// HandleLinkLost is called when a link is lost.
	HandleLinkLost(lnk link.Link)
}

TransportHandler manages a Transport and receives event callbacks. This is typically fulfilled by the transport controller.

Directories

Path Synopsis
common
kcp
e2e

Jump to

Keyboard shortcuts

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