Documentation
¶
Overview ¶
Package peer makes a Worker object a Bridge peer (DECISIONS.md P11): a persisted identity in the object's Store, the object's own Orb attached as its orb.instance/1 service, pinned-TLS streams over the object's WebSockets, and the owner's admin surface. The object only accepts streams: it reaches another peer over the connection that peer opened.
Index ¶
- Constants
- Variables
- func AgentCalls(open func(context.Context) (*Peer, error)) worker.ToolsFunc
- func Alias(name string) string
- func FullGrant(peer string) bridge.Grant
- type Peer
- func (p *Peer) Admin(ctx context.Context, method string, params json.RawMessage, locator string) (json.RawMessage, error)
- func (p *Peer) Call(ctx context.Context, peer string, call bridge.Call) (json.RawMessage, error)
- func (p *Peer) InstanceID() string
- func (p *Peer) PeerID() string
- func (p *Peer) Serve(ctx context.Context, stream net.Conn) error
Constants ¶
const (
StateDocument = "/bridge/state.json"
)
Documents in the object's Store, beside settings.json and out of the file tools' reach.
Variables ¶
var StateKey = worker.DocumentKey(StateDocument)
StateKey is present once the object has a Bridge identity; the shim serves the unauthenticated stream route only then.
Functions ¶
func AgentCalls ¶
AgentCalls adds the bridge_call tool when the object's settings enable the bridge-agent-calls plugin, as on the native CLI. open returns the object's peer when the tool runs.
Types ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func Open ¶
Open loads or creates the object's Bridge identity, enrolls the object's Orb once under alias, and attaches it for this runtime's lifetime.
func (*Peer) Admin ¶
func (p *Peer) Admin(ctx context.Context, method string, params json.RawMessage, locator string) (json.RawMessage, error)
Admin mirrors the owner methods of `orb bridge`. invite advertises locator, the object's public stream URL. The object cannot dial, so join, publish and the service lifecycle are not offered; self reports the object's identity.
func (*Peer) Call ¶
Call is the object's agent-initiated call: it needs this object's own instance grant for the destination, and a channel the destination opened.