Documentation
¶
Overview ¶
Package bridge owns connectivity authority, never agent execution or sessions, and defines the non-owning, versioned Orb instance attachments it routes.
Index ¶
- func Code(err error) string
- func ConnectClient(ctx context.Context, stream net.Conn, key ed25519.PrivateKey, expected string) (*protocol.Conn, error)
- func Fail(code string) error
- func JSON(v any) json.RawMessage
- func ParsePeerID(id string) (ed25519.PublicKey, error)
- func PeerID(key ed25519.PublicKey) string
- func ValidateCall(c Call) error
- type Bridge
- func (b *Bridge) AddGrant(g Grant) error
- func (b *Bridge) Admin(_ context.Context, method string, params json.RawMessage) (json.RawMessage, error)
- func (b *Bridge) Allowed(p Principal, id, permission string) bool
- func (b *Bridge) Approve(id, claimant string) error
- func (b *Bridge) Attach(id, credential, boot string, endpoint Endpoint) (string, error)
- func (b *Bridge) Authorize(r Request) bool
- func (b *Bridge) Available(id string) bool
- func (b *Bridge) Block(peer string) error
- func (b *Bridge) Call(ctx context.Context, p Principal, call Call) (json.RawMessage, error)
- func (b *Bridge) Catalog(p Principal) []Instance
- func (b *Bridge) Changes() <-chan struct{}
- func (b *Bridge) Claim(peer, id, token string, locators ...string) (Invitation, error)
- func (b *Bridge) Close() error
- func (b *Bridge) Connect(ctx context.Context, stream net.Conn, expected string, server bool) (*protocol.Conn, string, error)
- func (b *Bridge) Connection(peer string) *protocol.Conn
- func (b *Bridge) Contacts(peer, scope string) ([]Record, error)
- func (b *Bridge) Detach(id, generation string)
- func (b *Bridge) Enroll(alias, group string) (Instance, string, error)
- func (b *Bridge) Handle(ctx context.Context, peer, method string, params json.RawMessage) (json.RawMessage, error)
- func (b *Bridge) Hello() Hello
- func (b *Bridge) Invite(grants []Grant) (Invitation, error)
- func (b *Bridge) Known(peer string) bool
- func (b *Bridge) MergeContact(sender string, r Record) (bool, error)
- func (b *Bridge) Outbound(instance, peer string, call Call) (Subject, error)
- func (b *Bridge) PairStatus(peer, id string) (Invitation, error)
- func (b *Bridge) PeerID() string
- func (b *Bridge) PeerLocator(peer string) (string, error)
- func (b *Bridge) PersonalGroup() string
- func (b *Bridge) Principal() Principal
- func (b *Bridge) PublishContact(scope, name string, endpoints []Locator, withdraw bool) (Record, error)
- func (b *Bridge) Retire(ids []string) (int, error)
- func (b *Bridge) SavePeer(peer, locator string) error
- func (b *Bridge) SaveTransportState(raw json.RawMessage) error
- func (b *Bridge) SetHost(h Host)
- func (b *Bridge) SetScope(id string, peers []string) error
- func (b *Bridge) TLSConfig(expected string, server bool) (*tls.Config, error)
- func (b *Bridge) TransportState() json.RawMessage
- type Call
- type Contact
- type Endpoint
- type Error
- type Event
- type Expected
- type Grant
- type Hello
- type Host
- type Instance
- type Invitation
- type Ledger
- type Local
- type Locator
- type Model
- type Principal
- type Receipt
- type Record
- type Request
- type Stream
- type Subject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectClient ¶ added in v0.11.0
func ConnectClient(ctx context.Context, stream net.Conn, key ed25519.PrivateKey, expected string) (*protocol.Conn, error)
ConnectClient opens an outbound-only connection. It starts no listener or Bridge service, and rejects remote calls into the client. The caller owns key storage.
func JSON ¶ added in v0.11.0
func JSON(v any) json.RawMessage
func ValidateCall ¶ added in v0.11.0
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
func (*Bridge) Admin ¶
func (b *Bridge) Admin(_ context.Context, method string, params json.RawMessage) (json.RawMessage, error)
Admin is deliberately absent from the remote routing table. Hosts expose it only after local-owner authentication.
func (*Bridge) Claim ¶
func (b *Bridge) Claim(peer, id, token string, locators ...string) (Invitation, error)
func (*Bridge) Connect ¶
func (b *Bridge) Connect(ctx context.Context, stream net.Conn, expected string, server bool) (*protocol.Conn, string, error)
Connect authenticates a caller-supplied stream. It never creates a listener, locates a profile, or starts an agent runtime.
func (*Bridge) Connection ¶
Connection returns an existing authenticated channel in either direction.
func (*Bridge) Handle ¶
func (b *Bridge) Handle(ctx context.Context, peer, method string, params json.RawMessage) (json.RawMessage, error)
func (*Bridge) Known ¶ added in v0.13.2
Known reports whether peer is one this Bridge deals with beyond pairing: a saved peer, one holding a grant, or a member of a scope.
func (*Bridge) PairStatus ¶
func (b *Bridge) PairStatus(peer, id string) (Invitation, error)
func (*Bridge) PersonalGroup ¶
func (*Bridge) PublishContact ¶
func (*Bridge) Retire ¶ added in v0.12.1
Retire removes the named instances or, with none named, every throwaway instance whose Orb has gone: one that attached once, is not attached now, and no grant names. It returns how many it removed.
func (*Bridge) SaveTransportState ¶
func (b *Bridge) SaveTransportState(raw json.RawMessage) error
func (*Bridge) TransportState ¶
func (b *Bridge) TransportState() json.RawMessage
type Contact ¶
type Contact struct {
Schema string `json:"schema"`
Scope string `json:"scope_id"`
Peer string `json:"peer_id"`
Revision string `json:"revision"`
Name string `json:"display_name"`
Protocols []string `json:"protocols"`
Endpoints []Locator `json:"endpoints"`
Withdrawn bool `json:"withdrawn"`
Extensions map[string]json.RawMessage `json:"extensions,omitempty"`
}
type Endpoint ¶ added in v0.11.0
type Endpoint interface {
Invoke(context.Context, string, json.RawMessage) (json.RawMessage, error)
Close() error
}
Endpoint is implemented by in-process attachments and native IPC clients. Close releases remote availability; it never disposes the attached runtime.
type Event ¶ added in v0.11.0
type Event struct {
Cursor string `json:"cursor"`
Data json.RawMessage `json:"data"`
}
type Grant ¶
type Grant struct {
ID string `json:"grant_id,omitempty"`
Principal Principal `json:"principal"`
GroupID string `json:"group_id,omitempty"`
IncludeFuture bool `json:"include_future"`
Instances []string `json:"instances,omitempty"`
Permissions []string `json:"permissions"`
Destination string `json:"destination,omitempty"`
}
type Host ¶ added in v0.13.0
type Host func(ctx context.Context, p Principal, method string, params json.RawMessage) (json.RawMessage, error)
Host serves a peer's machine-level calls — the threads stored on this machine, and starting Orb in a folder — for principals whose grant includes host.launch.
type Invitation ¶
type Invitation struct {
ClaimantLocator string `json:"claimant_locator,omitempty"`
ID string `json:"invitation_id"`
PeerID string `json:"peer_id"`
Token string `json:"token,omitempty"`
Locator string `json:"locator,omitempty"`
Expires int64 `json:"expires"`
Grants []Grant `json:"grants"`
Claimant string `json:"claimant,omitempty"`
Status string `json:"status"`
}
type Ledger ¶ added in v0.11.0
type Ledger struct {
// contains filtered or unexported fields
}
func OpenLedger ¶ added in v0.11.0
type Local ¶ added in v0.11.0
type Local struct {
// contains filtered or unexported fields
}
Local is a non-owning in-process registration channel. Closing it fences delivery without closing the runtime adapter or its operation ledger.
type Receipt ¶ added in v0.11.0
type Receipt struct {
InstanceID string `json:"instance_id"`
SessionID string `json:"session_id,omitempty"`
Method string `json:"method"`
Expected Expected `json:"expected"`
AcceptedAt int64 `json:"accepted_at"`
OperationID string `json:"operation_id"`
Status string `json:"status"`
Result json.RawMessage `json:"result,omitempty"`
Error string `json:"error,omitempty"`
Digest string `json:"digest"`
}