Documentation
¶
Overview ¶
Package network defines fail-closed address and retry policy.
Index ¶
- Variables
- func EnsureConnected(isUp func() bool, join func() error, configure func() error, ...) error
- func PollManager(hooks PollHooks) error
- func RetryDelay(failures uint) time.Duration
- func RetryUntilConnected(attempt func() error, sleep func(time.Duration)) error
- func SelectIPv4(addresses []netip.Addr, port uint16) (netip.AddrPort, error)
- type CounterReader
- type Endpoint
- type Lifetime
- type PollHooks
- type Waiter
- type WordSource
Constants ¶
This section is empty.
Variables ¶
var ( ErrEndpoint = errors.New("network: invalid manager endpoint") )
var ( ErrCancelled = errors.New("network: lifetime cancelled") ErrTimeout = errors.New("network: asynchronous operation deadline exceeded") )
var ErrEntropy = errors.New("network: entropy unavailable")
var ErrPolling = errors.New("network: invalid poller configuration")
Functions ¶
func EnsureConnected ¶
func EnsureConnected( isUp func() bool, join func() error, configure func() error, sleep func(time.Duration), ) error
EnsureConnected restores a lost link and then refreshes its network configuration. An already healthy link is left untouched.
func PollManager ¶
PollManager runs the outbound-only device lifecycle. Successful polls use a low-frequency interval; failures use capped exponential backoff; active USB always wins arbitration.
func RetryDelay ¶
func RetryUntilConnected ¶
RetryUntilConnected retries a link operation until it succeeds. The caller owns cancellation by making attempt return success when the runtime stops.
Types ¶
type CounterReader ¶
type CounterReader struct {
// contains filtered or unexported fields
}
CounterReader mixes a monotonic counter into platform-provided random words. The manager-provided cryptographic challenge remains the security anchor; this reader guarantees per-boot nonce variation on the Pico side.
func NewCounterReader ¶
func NewCounterReader(source WordSource, counter uint64) (*CounterReader, error)
type Endpoint ¶
func ParseEndpoint ¶
type Lifetime ¶
type Lifetime struct {
// contains filtered or unexported fields
}
Lifetime is created once after epochstore durably reserves a boot epoch. This is uniqueness, NOT entropy: no weak platform RNG enters cryptography. Pico supplies an authenticated epoch/session challenge; the manager supplies a cryptographic random client nonce. Existing HMAC derives session keys. See RFC5116 sections3.1–3.2 and SPEC-screen-session. https://www.rfc-editor.org/rfc/rfc5116.html#section-3.1
func (*Lifetime) BootID ¶
BootID is public board UID + durable epoch. It distinguishes ordinary reboots and boards, not authorized journal resets; recovery must reset all host caches.
func (*Lifetime) NextSession ¶
NextSession consumes before any handshake/preface bytes can be emitted or lost. Keep one Lifetime across reconnects and credential rotation. TCP dialer Pico still uses the cryptographic Device role (ServerHandshake).
type Waiter ¶
Waiter polls existing asynchronous stack APIs. Check must be nonblocking; this cannot turn a blocking CYW Join call into a cancellable operation.