Documentation
¶
Overview ¶
Package provision defines USB-only network configuration and its flash journal.
Index ¶
- Constants
- Variables
- func EncodeRequest(dst []byte, request Request) error
- func EncodeResponse(dst []byte, response Response) error
- type AuthMode
- type BlockDevice
- type Code
- type Codec
- func (c Codec) AuthMode() AuthMode
- func (codec Codec) DecodeCorrelatedResponse(src []byte, id RequestID) (Response, error)
- func (codec Codec) DecodeRequest(source []byte) (Request, error)
- func (codec Codec) DecodeResponse(source []byte) (Response, error)
- func (codec Codec) EncodeCorrelatedRequest(dst []byte, request Request, id RequestID) error
- func (codec Codec) EncodeRequest(destination []byte, request Request) error
- func (codec Codec) EncodeResponse(destination []byte, response Response) error
- type Config
- type Operation
- type Request
- type RequestID
- type Response
- type Service
- type State
- type Store
Constants ¶
const ( RequestSize = 512 ResponseSize = 512 )
const ( MaxSSID = 32 MaxPassphrase = 63 MaxManager = 255 MaxTimezone = 64 )
const RecordSize = 512
Variables ¶
var ( ErrBlank = errors.New("provision: blank") ErrCorrupt = errors.New("provision: corrupt") ErrStorage = errors.New("provision: invalid storage") )
var ErrInvalidConfig = errors.New("provision: invalid configuration")
var ErrInvalidState = errors.New("provision: invalid state transition")
Functions ¶
func EncodeRequest ¶
func EncodeResponse ¶
Types ¶
type BlockDevice ¶
type Code ¶
type Code uint8
Code is a stable, source-free USB result. State describes the authoritative journal read after the operation, including when Code reports a failed write.
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec selects one explicit board's admission policy. Its zero value retains Pico's WPA3-only contract; an ESP32 policy never affects device flash decoding.
func ESP32Codec ¶
func ESP32Codec() Codec
func (Codec) DecodeCorrelatedResponse ¶
DecodeCorrelatedResponse validates the v3 envelope before applying all v2 metadata and padding rules. A legacy/stale reply never acknowledges v3 work.
func (Codec) EncodeCorrelatedRequest ¶
EncodeCorrelatedRequest adds the ESP32 v3 envelope; stored EPC2 stays unchanged.
func (Codec) EncodeRequest ¶
type Config ¶
type Config struct {
SSID string
Passphrase string
Manager string
Timezone string
DeviceID [16]byte
DeviceKey [32]byte
Auth AuthMode
}
func (Config) ValidateFor ¶
type Request ¶
func DecodeRequest ¶
type RequestID ¶
type RequestID [16]byte
RequestID binds a physical USB reply to one attempt, not a retryable intent. It is neither authentication nor a durable idempotency key.
type Response ¶
type Response struct {
Operation Operation
Code Code
State State
Generation uint64
Auth AuthMode
DeviceID [16]byte
SSID string
Manager string
Timezone string
}
func DecodeResponse ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Report ¶
Report executes once, then reloads the journal even after an error. Save may fail after writing a valid slot; FactoryReset can erase only one of two slots before failure. Only the reload, never the requested config, is authoritative. Physical USB ownership/credential fencing belongs to the caller. Config contains secrets for the owner; only Response may be serialized.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}