outbound

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

README

Outbound operation admission (unwired)

Consumers must provide RecheckServer(ctx, state) composed with guard.RecheckServer(ctx, state, expectedIdentity, hostname). It checks current roots, expiry and cluster/node/boot policy against the selected TLS connection. Handshake callbacks remain intact and ordinary Go chain, hostname and EKU checks run first. A TLS handshake alone does not establish current operation authority.

The initial implementation deliberately uses one fresh TCP/TLS connection per operation, HTTP/1.1 only, without keepalive, resumption, proxies or redirects. It builds its own bounded Go HTTP transport rather than retaining caller dial hooks. The fixed origin is checked before dispatch. Certificate bytes, standard software keys and roots are copied; opaque signers and callback captures remain trusted immutable, concurrency-safe dependencies. Policy must be bounded and cooperate with its admission context. No background polling is installed.

Audited Go 1.27 ordering (net/http/transport.go): getConn preserves context values but detaches cancellation with WithoutCancel; our RoundTripper carries the original operation context in a private value and the TLS dial hook restores it. dialConn invokes customDialTLS and returns on its error before creating HTTP read/write loops. Our dial hook completes ordinary TLS verification and the current policy check before returning the connection. Rejection closes it while HTTP has no reference to it. DisableKeepAlives makes tryPutIdleConn reject pool/handoff, so a canceled dial cannot supply another operation. There is no GotConn-based cancellation barrier. Tests cover actual Guard composition in both consumers and count raw decrypted bytes on cancellation during admission.

The admission timeout covers TCP/TLS/policy only; response bodies retain normal request cancellation and streaming backpressure. Point-in-time admission does not revoke a stream already admitted: source/placement authority must continue its existing live checks. Snapshot rotation requires a new client/transport; old transports cannot bypass current Guard policy after roots are removed.

Unresolved acceptance limitation: every HEAD, source range read (including 64 KiB reads) and execution RPC pays a TCP/TLS handshake. GPU/production throughput has not been demonstrated; this is not production-ready throughput acceptance. Audited reuse would require a separate pre-write admission design.

Documentation

Overview

Package outbound provides the private per-operation TLS admission boundary.

Index

Constants

This section is empty.

Variables

View Source
var ErrEndpointUnavailable = errors.New("outbound: endpoint unavailable")

ErrEndpointUnavailable means an explicit refusal, absent DNS name, or no network/host route. It allows replacement, never resource retirement.

View Source
var ErrPeerDenied = errors.New("outbound: peer denied")

ErrPeerDenied identifies explicit TLS identity/policy refusal, not a timeout or connection failure. Callers may replace work but cannot infer retirement.

Functions

This section is empty.

Types

type Transport

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

Transport admits one fresh, fully verified HTTP/1.1 TLS connection per operation. There is deliberately no connection reuse or session resumption. Rebuild after credential/root rotation. Existing transports still call the current policy on every operation. Policy and TLS callbacks must cooperate with cancellation and be concurrency safe; opaque signer keys and callback captures must remain immutable. No locks are held across callbacks/network IO.

func New

func New(endpoint string, config *tls.Config, timeout time.Duration, check func(context.Context, tls.ConnectionState) error) (*Transport, error)

New ignores caller HTTP dial/proxy hooks entirely. check must compose current nodewire.Guard.RecheckServer with the expected complete identity and hostname. timeout bounds TCP, TLS and cooperative policy admission, not response bodies.

func (*Transport) CloseIdleConnections

func (t *Transport) CloseIdleConnections()

func (*Transport) ResponseHeaderTimeout

func (t *Transport) ResponseHeaderTimeout(timeout time.Duration)

ResponseHeaderTimeout sets the wait for the first response headers separately from TCP/TLS admission. Call only before the transport's first request. Media may wait for an encoder segment while dead endpoints must fail quickly.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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