Help us shape the future of Go! Take the 2026 Go Developer Survey

transport

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveSessionBus

func ResolveSessionBus(ctx context.Context, parent bus.Bus, id peer.ID, invalidated func()) (bus.Bus, func(), error)

ResolveSessionBus borrows the Session's transport while release is retained. A host without Session transports uses its supplied bus directly. Removing a resolved transport calls invalidated; callers must end their pending streams.

func SignHTTPRequest

func SignHTTPRequest(req *http.Request, body []byte, priv bifrost_crypto.PrivKey, pid peer.ID, envPfx string) error

SignHTTPRequest signs an HTTP request using the Spacewave SigningPayload proto binary + Ed25519 wire format.

Types

type LocalTransportFunc

type LocalTransportFunc func(ctx context.Context, le *logrus.Entry, b bus.Bus, peerID peer.ID) (*transport_controller.Controller, func(), error)

LocalTransportFunc starts a process-local transport on the session bus b under peerID. It returns the controller owning the transport's links, or nil when it exposes none, and a release func that detaches it.

type LookupSessionBus

type LookupSessionBus interface {
	directive.Directive
	SessionPeerID() peer.ID
}

LookupSessionBus selects the running transport for one authenticated Session. The value is its bus.Bus and is withdrawn when that transport stops.

type SessionTransport

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

SessionTransport manages a session-scoped child bus with bifrost transport controllers bound to the session's peer identity.

func NewSessionTransport

func NewSessionTransport(
	le *logrus.Entry,
	parentBus bus.Bus,
	sessionKey bifrost_crypto.PrivKey,
	signalingURL string,
	signingEnvPfx string,
	opts ...SessionTransportOption,
) (*SessionTransport, error)

NewSessionTransport constructs a new session-scoped transport.

The child bus is created in Execute. The sessionKey is the session's Ed25519 private key used as the transport peer identity. A nil parentBus runs independently without parent routing or discovery.

signalingURL is the cloud API base URL for the SignalingDO endpoint. If empty, WebRTC and signaling controllers are not started.

func (t *SessionTransport) AdoptLink(ctx context.Context, lnk link.Link) error

AdoptLink takes ownership of an authenticated link for this Session. It registers ordinary stream routing and telemetry through the transport controller. Closing the link or this Session releases the controller. The link's local identity must already be authenticated as this Session.

func (*SessionTransport) AwaitReady

func (t *SessionTransport) AwaitReady(ctx context.Context) error

AwaitReady blocks until the child bus and local controllers are running, the transport fails, or ctx is canceled.

func (*SessionTransport) Err

func (t *SessionTransport) Err() error

Err returns why the transport failed, or nil while it can still run.

func (*SessionTransport) Execute

func (t *SessionTransport) Execute(ctx context.Context) (err error)

Execute creates the child bus with bifrost transport controllers and blocks until ctx is canceled or the transport fails.

func (*SessionTransport) GetChildBus

func (t *SessionTransport) GetChildBus() bus.Bus

GetChildBus returns the active session bus, or nil outside Execute.

func (*SessionTransport) GetLinkSnapshotsWithWait added in v0.54.0

func (t *SessionTransport) GetLinkSnapshotsWithWait() ([]transport_controller.LinkSnapshot, []<-chan struct{})

GetLinkSnapshotsWithWait returns current links and all channels that can change them.

func (*SessionTransport) GetLinkedPeerIDsSnapshotWithWait added in v0.51.7

func (t *SessionTransport) GetLinkedPeerIDsSnapshotWithWait(peerIDs []peer.ID) (map[peer.ID]struct{}, []<-chan struct{})

GetLinkedPeerIDsSnapshotWithWait returns linked peer IDs and their change channels. Each controller retains its link state; callers wait on all returned channels.

func (*SessionTransport) GetPeerID

func (t *SessionTransport) GetPeerID() peer.ID

GetPeerID returns the transport's peer ID.

func (*SessionTransport) GetStartupStage added in v0.57.0

func (t *SessionTransport) GetStartupStage() string

GetStartupStage returns the last startup stage entered by Execute.

func (*SessionTransport) Ready

func (t *SessionTransport) Ready() <-chan struct{}

Ready returns a channel that closes when the child bus and local controllers become ready. Signaling connects in the background and does not delay readiness.

type SessionTransportOption added in v0.56.1

type SessionTransportOption func(*SessionTransport)

SessionTransportOption configures child-bus directive routing and startup.

func WithBridgeDirectiveFilter added in v0.56.1

func WithBridgeDirectiveFilter(filter bus_bridge.FilterFn) SessionTransportOption

WithBridgeDirectiveFilter excludes matching directives from the generic child-to-parent bridge while SessionTransport keeps forwarding the rest.

func WithInprocNetwork

func WithInprocNetwork(network *inproc.Network) SessionTransportOption

WithInprocNetwork enables authenticated links to other sessions on this native network. Network membership follows Execute; separate networks never share packet routes.

func WithLocalTransport

func WithLocalTransport(start LocalTransportFunc) SessionTransportOption

WithLocalTransport attaches a process-local transport before readiness.

func WithStartupRetry added in v0.57.0

func WithStartupRetry() SessionTransportOption

WithStartupRetry enables retrying startup semantics. A failed Execute attempt stays private to the retrying caller, and Execute returns nil once the transport fails so the caller stops retrying.

Jump to

Keyboard shortcuts

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