Documentation
¶
Overview ¶
Package runtime owns the plugin-lifecycle composition root for the daemon binary. Holds the coreapi.ServiceRegistry, constructs the daemon-side adapters that satisfy plugin Deps (Streams, EventBus, Identity, Polo), and registers/starts/stops L11 services.
Lives outside pkg/daemon (L7) so daemon stays free of pkg/coreapi (L10) imports — that's T7.1 in docs/architecture/04-EXTRACTION.md. Imports both pkg/daemon and pkg/coreapi (downward edges, allowed).
Index ¶
- func AsDaemonPolicyManager(pm coreapi.PolicyManager) daemonapi.PolicyManager
- func NewHandshakeRuntime(d daemonapi.Daemon) handshake.Runtime
- func NewHandshakeServiceAdapter(svc *handshake.Service) daemonapi.HandshakeService
- func NewPolicyRuntime(d daemonapi.Daemon) policy.Runtime
- type HandshakeRuntime
- func (r HandshakeRuntime) DialAndSend(peerNodeID uint32, port uint16, data []byte) error
- func (r HandshakeRuntime) HasIdentity() bool
- func (r HandshakeRuntime) IdentityPath() string
- func (r HandshakeRuntime) IsTrusted(nodeID uint32) (string, bool)
- func (r HandshakeRuntime) IsTrustedWithKey(nodeID uint32, pubKeyB64 string) (string, bool)
- func (r HandshakeRuntime) NodeID() uint32
- func (r HandshakeRuntime) PortListener(port uint16) (coreapi.Listener, error)
- func (r HandshakeRuntime) PublicKey() ed25519.PublicKey
- func (r HandshakeRuntime) PublishEvent(topic string, payload map[string]any)
- func (r HandshakeRuntime) Registry() handshake.RegistryClient
- func (r HandshakeRuntime) RemoveTunnelPeer(nodeID uint32)
- func (r HandshakeRuntime) Sign(msg []byte) []byte
- func (r HandshakeRuntime) TrustAutoApprove() bool
- type PolicyRuntime
- func (r PolicyRuntime) AdminToken() string
- func (r PolicyRuntime) ListNodes(netID uint16, token string) (map[string]any, error)
- func (r PolicyRuntime) NodeID() uint32
- func (r PolicyRuntime) PublishEvent(topic string, payload map[string]any)
- func (r PolicyRuntime) RevokeTrust(nodeID uint32) error
- func (r PolicyRuntime) SendHandshakeRequest(nodeID uint32, reason string) error
- func (r PolicyRuntime) SetMemberTags(netID uint16, tags []string)
- func (r PolicyRuntime) TrustedPeers() []policy.TrustRecord
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsDaemonPolicyManager ¶
func AsDaemonPolicyManager(pm coreapi.PolicyManager) daemonapi.PolicyManager
AsDaemonPolicyManager adapts a coreapi.PolicyManager (returned by plugins/policy.Service.Manager()) to daemonapi.PolicyManager. The two interfaces have identical method shapes; the adapter does the PolicyRunner element-type conversion on All() and Get().
func NewHandshakeRuntime ¶
NewHandshakeRuntime returns a handshake.Runtime backed by d.
func NewHandshakeServiceAdapter ¶
func NewHandshakeServiceAdapter(svc *handshake.Service) daemonapi.HandshakeService
NewHandshakeServiceAdapter wraps a *handshake.Service so it satisfies daemonapi.HandshakeService.
Types ¶
type HandshakeRuntime ¶
type HandshakeRuntime struct {
// contains filtered or unexported fields
}
HandshakeRuntime adapts daemonapi.Daemon to the handshake.Runtime interface. Lives here (L12 composition root) so plugins/handshake stays free of pkg/daemon.
func (HandshakeRuntime) DialAndSend ¶
func (r HandshakeRuntime) DialAndSend(peerNodeID uint32, port uint16, data []byte) error
func (HandshakeRuntime) HasIdentity ¶
func (r HandshakeRuntime) HasIdentity() bool
func (HandshakeRuntime) IdentityPath ¶
func (r HandshakeRuntime) IdentityPath() string
func (HandshakeRuntime) IsTrusted ¶
func (r HandshakeRuntime) IsTrusted(nodeID uint32) (string, bool)
func (HandshakeRuntime) IsTrustedWithKey ¶ added in v0.3.3
func (r HandshakeRuntime) IsTrustedWithKey(nodeID uint32, pubKeyB64 string) (string, bool)
IsTrustedWithKey is handshake.KeyedTrustChecker: the trusted-agents list with an entry's key pin checked against the key the peer presented. The handshake manager asks this when it implements it, and otherwise falls back to IsTrusted, which never checked pins. A checker without pin support answers by node id as before; a key that isn't valid base64 is not trusted.
func (HandshakeRuntime) NodeID ¶
func (r HandshakeRuntime) NodeID() uint32
func (HandshakeRuntime) PortListener ¶
func (r HandshakeRuntime) PortListener(port uint16) (coreapi.Listener, error)
func (HandshakeRuntime) PublicKey ¶
func (r HandshakeRuntime) PublicKey() ed25519.PublicKey
func (HandshakeRuntime) PublishEvent ¶
func (r HandshakeRuntime) PublishEvent(topic string, payload map[string]any)
func (HandshakeRuntime) Registry ¶
func (r HandshakeRuntime) Registry() handshake.RegistryClient
func (HandshakeRuntime) RemoveTunnelPeer ¶
func (r HandshakeRuntime) RemoveTunnelPeer(nodeID uint32)
func (HandshakeRuntime) Sign ¶
func (r HandshakeRuntime) Sign(msg []byte) []byte
func (HandshakeRuntime) TrustAutoApprove ¶
func (r HandshakeRuntime) TrustAutoApprove() bool
type PolicyRuntime ¶
type PolicyRuntime struct {
// contains filtered or unexported fields
}
PolicyRuntime adapts daemonapi.Daemon to the policy.Runtime interface. Lives here (L12 composition root) so plugins/policy stays free of pkg/daemon.
func (PolicyRuntime) AdminToken ¶
func (r PolicyRuntime) AdminToken() string
func (PolicyRuntime) NodeID ¶
func (r PolicyRuntime) NodeID() uint32
func (PolicyRuntime) PublishEvent ¶
func (r PolicyRuntime) PublishEvent(topic string, payload map[string]any)
func (PolicyRuntime) RevokeTrust ¶
func (r PolicyRuntime) RevokeTrust(nodeID uint32) error
func (PolicyRuntime) SendHandshakeRequest ¶
func (r PolicyRuntime) SendHandshakeRequest(nodeID uint32, reason string) error
func (PolicyRuntime) SetMemberTags ¶
func (r PolicyRuntime) SetMemberTags(netID uint16, tags []string)
func (PolicyRuntime) TrustedPeers ¶
func (r PolicyRuntime) TrustedPeers() []policy.TrustRecord
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns the plugin-side glue for a single daemon. cmd/daemon constructs one, registers L11 services, then calls StartPlugins after Daemon.Start (so regConn etc. are wired) and StopPlugins before Daemon.Stop.
func (*Runtime) Register ¶
Register adds a service to the registry. Mirrors the old daemon.RegisterPlugin. Must be called before StartPlugins.
func (*Runtime) StartPlugins ¶
StartPlugins starts every registered service in Order order. Plugins receive a Deps bundle covering Streams, Identity, Events, Trust.