transport

package
v0.1.0-proto2m Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ALPNGapiQUIC = "gapi-quic"

ALPNGapiQUIC is the ALPN protocol identifier for the kernel's QUIC transport. It mirrors the ecosystem ALPN registry as its governing contract (append-only, tombstoned): a collision is a review failure, not a runtime discovery. Consumers (the orchestrator's ALPN router) import this constant and never redefine the literal (GAPI-DIV-011).

Variables

View Source
var ErrEnvelopeTooLarge = errors.New("transport: envelope too large to frame")

ErrEnvelopeTooLarge reports an envelope whose byte length cannot be expressed in the four-byte frame prefix. It is OURS, not the network's - nothing was written and nothing failed on the wire - so it is a sentinel here rather than a wrapped transport error.

Functions

func CreateClientTLSConfig

func CreateClientTLSConfig(cfg TLSConfig) (*tls.Config, error)

CreateClientTLSConfig builds a tls.Config from the provided settings

func GenerateInsecureSelfSignedCert

func GenerateInsecureSelfSignedCert() (tls.Certificate, error)

GenerateInsecureSelfSignedCert generates a self-signed cert for testing/insecure modes.

func NewClientFromConfig

func NewClientFromConfig(cfg config.TransportConfig) (eventbus.Transport[*anypb.Any], error)

Config-driven client.

func NewLocal

func NewLocal() eventbus.Transport[*anypb.Any]

Local in-proc transport.

func NewQUICClientTransport

func NewQUICClientTransport(cfg config.TransportConfig) (eventbus.Transport[*anypb.Any], error)

QUIC client transport.

func NewQUICServerTransport

func NewQUICServerTransport(addr, tlsCert, tlsKey string) (eventbus.Transport[*anypb.Any], error)

QUIC server transport.

func NewServerFromConfig

func NewServerFromConfig(cfg config.TransportConfig) (eventbus.Transport[*anypb.Any], error)

Config-driven server.

Types

type Local

type Local[T any] struct {
	// contains filtered or unexported fields
}

Local provides an in-proc "loopback" transport used for testing or single-process mode.

func (*Local[T]) Close

func (t *Local[T]) Close() error

func (*Local[T]) OnRemoteEvent

func (t *Local[T]) OnRemoteEvent(fn func(eventbus.Event[T]))

func (*Local[T]) PublishRemote

func (t *Local[T]) PublishRemote(ctx context.Context, e eventbus.Event[T]) error

type PeerSendError

type PeerSendError struct {
	Stage sendStage
	Peer  string
	Err   error
}

PeerSendError reports one peer's failed send.

func (*PeerSendError) Error

func (e *PeerSendError) Error() string

func (*PeerSendError) Unwrap

func (e *PeerSendError) Unwrap() error

type PublishIncomplete

type PublishIncomplete struct {
	// Peers is how many peers the publish addressed.
	Peers int
	// Failed is how many reported a named error.
	Failed int
	// Unconfirmed is how many had not answered when the window closed.
	Unconfirmed int
	// Errs holds one PeerSendError per failed peer.
	Errs []error
}

PublishIncomplete reports a remote publish that did not confirm delivery to every peer.

FAILED AND UNCONFIRMED ARE DIFFERENT FACTS AND ARE COUNTED SEPARATELY. A failed peer reached a named error; an unconfirmed one had not finished when the confirmation window closed, and its send may still complete afterwards. Collapsing the two would make the error say "this did not arrive" where the honest claim is "this is not known to have arrived".

func (*PublishIncomplete) Error

func (e *PublishIncomplete) Error() string

func (*PublishIncomplete) Unwrap

func (e *PublishIncomplete) Unwrap() []error

Unwrap returns the per-peer errors so errors.Is and errors.As reach them. Only FAILED peers appear here; an unconfirmed peer has no error to report, which is precisely what makes it unconfirmed.

type QUIC

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

func NewQUICClient

func NewQUICClient(addr string, cert *tls.Certificate, tlsConfig TLSConfig) (*QUIC, error)

func NewQUICServer

func NewQUICServer(addr string, cert tls.Certificate) (*QUIC, error)

func (*QUIC) Addr

func (q *QUIC) Addr() string

Addr reports the address the listener ACTUALLY BOUND, which is not always the one it was asked for: ":0" resolves to a kernel-assigned port, and a configured hostname may resolve to something else. The daemon is the only party that knows this value, which is why it has to be published rather than re-derived by the client (GAPI-DIV-070).

Empty for a client QUIC, which has no listener. Takes q.mu because Close() nils the field.

func (*QUIC) Close

func (q *QUIC) Close() error

func (*QUIC) OnRemoteEvent

func (q *QUIC) OnRemoteEvent(fn func(eventbus.Event[*anypb.Any]))

func (*QUIC) PeerCount

func (q *QUIC) PeerCount() int

PeerCount reports how many connections this transport would address. Exported for tests: "the publish reached both peers" is only a meaningful assertion once "both peers are attached" can be awaited rather than slept on.

func (*QUIC) PublishRemote

func (q *QUIC) PublishRemote(ctx context.Context, e eventbus.Event[*anypb.Any]) error

PublishRemote sends one event to every attached peer and reports whether the bytes went out.

A nil RETURN NOW ASSERTS DELIVERY TO THE WIRE, AND IT PREVIOUSLY ASSERTED NOTHING. This function used to spawn a goroutine per peer and return nil immediately, so nil meant "some work was scheduled" - and measured on gapi #136, sometimes not even that: ten failing gapictl clients logged `event=dial` and NOT ONE reached the send goroutine's first line. The client gave up on its 2s deadline and exited before the runtime scheduled the goroutine, so OpenStreamSync never ran, nothing was written, and no error path was reached. That is why all seven of the send path's error paths reported zero while requests demonstrably vanished: nothing was failing, nothing was happening.

WHAT nil MEANS, STATED PRECISELY, BECAUSE THE WHOLE DEFECT WAS AN OVERCLAIMED RETURN VALUE: every peer's frame was marshalled, written and its write side closed. It does NOT mean any peer acknowledged or handled the event - this layer cannot know that, and a return value that implied it would repeat the mistake one level up.

THE FAN-OUT IS UNCHANGED; ONLY THE WAITING IS NEW. The sends still run concurrently, one goroutine per peer, so no peer's send is sequenced behind another's timeout and a publish reaching some peers and not others still does not depend on their order. What the old comment defended - one unresponsive peer must not block every publisher - is preserved by the concurrency plus the bounded window below, not by refusing to wait at all.

type TLSConfig

type TLSConfig struct {
	// InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name.
	InsecureSkipVerify bool
	// CAFile is the path to the CA certificate file.
	CAFile string
}

TLSConfig holds TLS configuration for the client

type Transport

type Transport = eventbus.Transport[*anypb.Any]

All transports are now strictly protobuf-based.

Jump to

Keyboard shortcuts

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