Documentation
¶
Overview ¶
Package hub connects clients to phones: it owns the device registry, per-device command queues, pairing, events and server-side commands.
Index ¶
- Variables
- func LANAddresses(port int) []string
- func MarshalLine(m map[string]any) []byte
- type Call
- type Client
- type Device
- type Hub
- func (h *Hub) AcceptAgent(conn wire.LineConn)
- func (h *Hub) CodePairingOpen() bool
- func (h *Hub) DevicePub(id string) (*ecdh.PublicKey, bool)
- func (h *Hub) EnrollToken(tid string) ([]byte, bool)
- func (h *Hub) HTTPStatus(code string) int
- func (h *Hub) Lang() string
- func (h *Hub) Name() string
- func (h *Hub) NewClient(send func(map[string]any) error, needsAuth bool) *Client
- func (h *Hub) NewEnrollment(name string) (string, time.Time)
- func (h *Hub) PendingPairs() []map[string]any
- func (h *Hub) PublicKey() string
- func (h *Hub) RecoverConn(kind, remote string)
- func (h *Hub) ServerID() string
- func (h *Hub) SetOCRPath(path string)
- func (h *Hub) SetPorts(agent, client int)
- func (h *Hub) StaticKey() *ecdh.PrivateKey
- func (h *Hub) WebhookSecret() string
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
var Version = "0.1.0-dev"
Version is set at release build time with -ldflags "-X .../hub.Version=x.y.z".
Functions ¶
func LANAddresses ¶
LANAddresses lists tcp:// URLs for each private IPv4 address of this machine.
func MarshalLine ¶
MarshalLine encodes a response or event as one NDJSON line.
Types ¶
type Call ¶
type Call struct {
Cmd *spec.Command
Params map[string]any
Wait bool
OfflineWait time.Duration
// Late receives the final result of a command the phone answered with accepted.
Late func(Result)
// contains filtered or unexported fields
}
Call is one command on its way to a phone.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one SDK, CLI, MCP or HTTP connection.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) AcceptAgent ¶
AcceptAgent handles one phone link until it closes.
func (*Hub) CodePairingOpen ¶
func (*Hub) HTTPStatus ¶
HTTPStatus maps an error code to the status the local HTTP API returns.
func (*Hub) NewClient ¶
NewClient registers a connection. needsAuth is true for non-loopback peers or when client.require_token is set.
func (*Hub) NewEnrollment ¶
NewEnrollment creates a single-use QR token and returns the pairing URI.
func (*Hub) PendingPairs ¶
PendingPairs lists phones waiting for a code, without revealing the codes.
func (*Hub) RecoverConn ¶
RecoverConn is recoverConn for handlers outside this package.
func (*Hub) SetOCRPath ¶ added in v0.1.1
SetOCRPath points OCR at a tesseract binary; tests use it to simulate a missing install.
func (*Hub) StaticKey ¶
func (h *Hub) StaticKey() *ecdh.PrivateKey
func (*Hub) WebhookSecret ¶
Secret returns the signing secret, creating it on first use.