plugin

package
v0.0.0-...-af1aae3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package plugin provides the implementation-neutral protocol composition contract used by the root networking extension and its protocol subpackages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidModule reports a protocol descriptor without a stable key or
	// registration callback.
	ErrInvalidModule = errors.New("wagonet: invalid protocol module")
	// ErrDuplicateModule reports a second registration for the same protocol.
	ErrDuplicateModule = errors.New("wagonet: protocol module already registered")
	// ErrFrozen reports registration attempted after Wago registration began.
	ErrFrozen = errors.New("wagonet: protocol registration is frozen")
	// ErrInvalidBackend reports an incomplete opaque backend contribution.
	ErrInvalidBackend = errors.New("wagonet: invalid protocol backend contribution")
	// ErrIncompatibleBackend reports a contribution for a different backend
	// family than the shared namespace selected by the root network.
	ErrIncompatibleBackend = errors.New("wagonet: incompatible protocol backend contribution")
	// ErrInvalidAuthority reports an unusable protocol authority contribution.
	ErrInvalidAuthority = errors.New("wagonet: invalid protocol authority contribution")
)

Functions

func RegisterBindings

func RegisterBindings(module *wago.ImportModuleBuilder, bindings []Binding)

RegisterBindings installs a complete protocol binding table without exposing root-package implementation details to the protocol package.

Types

type Authority

type Authority struct {
	// contains filtered or unexported fields
}

Authority is an immutable protocol-local policy grant contribution. The shared root composes every selected contribution with caller policy before compiling the one exact-instance policy. Ordinary deny rules therefore keep precedence over grants from any protocol or registration order.

func NewAuthority

func NewAuthority(config policy.Config) Authority

NewAuthority deep-copies one trusted protocol-local authority contribution.

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is an opaque protocol-local contribution. Configure may add finite requirements to an unallocated shared backend config. Install attaches one service to the fully allocated exact-instance base namespace.

func NewBackend

func NewBackend(family BackendFamily, configure func(any) error, install func(any) (nscore.Service, error)) Backend

NewBackend constructs one trusted backend contribution below this module's internal-package boundary.

type BackendFamily

type BackendFamily string

BackendFamily identifies one shared backend assembly contract. Protocol modules selected on one network must contribute to the same family.

const (
	// BackendLnetoV1 is the first shared static IPv4 backend family.
	BackendLnetoV1 BackendFamily = "lneto.static-ipv4.v1"
)

type Binding

type Binding struct {
	Name       string
	Func       wago.HostFunc
	Params     []wago.ValType
	Results    []wago.ValType
	Capability wago.Capability
	Docs       string
}

Binding is one checked guest import contributed by a protocol module.

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host is the protocol-neutral bridge from independently compiled guest bindings to the root network's exact-instance ownership manager. Its fields remain private so protocol modules cannot replace lifecycle ownership.

func NewHost

func NewHost(instances *instance.Manager) Host

NewHost binds protocol modules to one extension-local instance manager.

func (Host) State

func (h Host) State(module wago.HostModule) (*instance.State, bool)

State resolves networking state only for the exact calling Runtime instance. HostModule-only mocks and detached instances fail closed.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is an opaque, trusted protocol registration descriptor. Public protocol packages construct descriptors inside this module; ordinary users select them through tcp.Register, udp.Register, or dns.Register.

func NewModule

func NewModule(key ModuleKey, install func(*wago.Registry, Host), backend ...Backend) Module

NewModule constructs one protocol descriptor. It is intentionally available only below github.com/wago-org/net's internal-package boundary.

func (Module) ConfigureAuthority

func (m Module) ConfigureAuthority(target *policy.Config) error

ConfigureAuthority composes this module's grants into the shared immutable policy input. Modules without authority are ignored.

func (Module) ConfigureBackend

func (m Module) ConfigureBackend(family BackendFamily, target any) error

ConfigureBackend contributes protocol-local requirements before the shared backend is allocated. Modules without backend state are ignored.

func (Module) Install

func (m Module) Install(registry *wago.Registry, host Host)

Install contributes this module's capability and imports to a Wago registry using the exact shared instance host owned by the root network.

func (Module) InstallBackend

func (m Module) InstallBackend(family BackendFamily, base any) (nscore.Service, bool, error)

InstallBackend attaches one protocol-local service to an exact shared base. The bool is false only for modules that own no backend state.

func (Module) WithAuthority

func (m Module) WithAuthority(authority Authority) Module

WithAuthority returns a descriptor carrying one protocol-local grant set. It is used by trusted binding/public protocol packages before registration.

type ModuleKey

type ModuleKey string

ModuleKey is the stable identity used to reject duplicate protocol selection. The type lives behind Go's internal-package boundary so public protocol packages can share keys without expanding the root API.

const (
	ModuleUDP        ModuleKey = "udp"
	ModuleTCP        ModuleKey = "tcp"
	ModuleDNS        ModuleKey = "dns"
	ModuleICMPv4     ModuleKey = "icmpv4"
	ModuleNTP        ModuleKey = "ntp"
	ModuleMDNS       ModuleKey = "mdns"
	ModuleDHCPv4     ModuleKey = "dhcpv4"
	ModuleLinkLocal4 ModuleKey = "linklocal4"
	ModuleIPv6       ModuleKey = "ipv6"
	ModuleICMPv6     ModuleKey = "icmpv6"
	ModuleDHCPv6     ModuleKey = "dhcpv6"
)

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set records selected protocol modules until the network is frozen.

func (*Set) Add

func (s *Set) Add(module Module) error

Add selects one protocol module. Duplicate registration is rejected with a stable error rather than silently changing authority.

func (*Set) Freeze

func (s *Set) Freeze() []Module

Freeze prevents further authority changes and returns an immutable registration-order snapshot.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL