Documentation
¶
Index ¶
- Constants
- Variables
- func NormalizeConfigBySchema(schema ConfigSchema, raw map[string]any) map[string]any
- func ValidateConfigBySchema(schema ConfigSchema, raw map[string]any) error
- type ActionType
- type AttachmentRequest
- type AttachmentStatus
- type BindingResolver
- type BotActionRequest
- type BotOverlayConfig
- type BotStatus
- type ConfigConstraint
- type ConfigField
- type ConfigSchema
- type Controller
- type FieldType
- type NetworkJoinTarget
- type NodeListResponse
- type NodeOption
- type NoopOverlayDriver
- func (NoopOverlayDriver) Detach(context.Context, AttachmentRequest) error
- func (NoopOverlayDriver) EnsureAttached(context.Context, AttachmentRequest) (OverlayStatus, error)
- func (NoopOverlayDriver) Kind() string
- func (NoopOverlayDriver) Status(context.Context, AttachmentRequest) (OverlayStatus, error)
- type OverlayDriver
- type OverlayStatus
- type Provider
- type ProviderAction
- type ProviderActionExecution
- type ProviderActionStatus
- type ProviderCapabilities
- type ProviderDescriptor
- type ProviderStatus
- type Registry
- func (r *Registry) Get(kind string) (Provider, bool)
- func (r *Registry) GetCapabilities(kind string) (ProviderCapabilities, bool)
- func (r *Registry) GetDescriptor(kind string) (ProviderDescriptor, bool)
- func (r *Registry) List() []Provider
- func (r *Registry) ListDescriptors() []ProviderDescriptor
- func (r *Registry) MustRegister(provider Provider)
- func (r *Registry) Register(provider Provider) error
- type Runtime
- type RuntimeCapabilities
- type RuntimeDescriptor
- type RuntimeNetworkRequest
- type RuntimeNetworkStatus
- type Service
- func (s *Service) ExecuteActionBot(ctx context.Context, botID, actionID string, input map[string]any) (ProviderActionExecution, error)
- func (s *Service) GetBotConfig(ctx context.Context, botID string) (BotOverlayConfig, error)
- func (s *Service) ListBotNodes(ctx context.Context, botID string) (NodeListResponse, error)
- func (s *Service) ListMeta(_ context.Context) []ProviderDescriptor
- func (s *Service) PrepareBotConfigForWrite(cfg BotOverlayConfig) (BotOverlayConfig, error)
- func (s *Service) ReconcileBot(ctx context.Context, botID string, previous, next BotOverlayConfig) error
- func (s *Service) Resolve(ctx context.Context, botID string) (BotOverlayConfig, error)
- func (s *Service) SetController(ctrl Controller)
- func (s *Service) StatusBot(ctx context.Context, botID string) (BotStatus, error)
- type StatusState
- type WorkspaceRuntimeStatus
Constants ¶
const ( ActionTypeTestConnection ActionType = "test_connection" StatusStateUnknown StatusState = "unknown" StatusStateReady StatusState = "ready" StatusStateNeedsConfig StatusState = "needs_config" )
Variables ¶
var ErrNotSupported = errors.New("network operation not supported")
ErrNotSupported indicates the selected runtime or overlay driver cannot report a requested capability yet.
var ErrWorkspaceContainerMissing = errors.New("workspace is not created")
Functions ¶
func NormalizeConfigBySchema ¶
func NormalizeConfigBySchema(schema ConfigSchema, raw map[string]any) map[string]any
func ValidateConfigBySchema ¶
func ValidateConfigBySchema(schema ConfigSchema, raw map[string]any) error
Types ¶
type ActionType ¶
type ActionType string
type AttachmentRequest ¶
type AttachmentRequest struct {
BotID string
ContainerID string
Runtime RuntimeNetworkRequest
Overlay BotOverlayConfig
OverlayOnly bool // When true, skip runtime network setup/teardown (overlay-only mutation).
}
type AttachmentStatus ¶
type AttachmentStatus struct {
Runtime RuntimeNetworkStatus
Overlay OverlayStatus
}
AttachmentStatus reports the outcome of runtime network and overlay attachment.
type BindingResolver ¶
type BindingResolver interface {
Resolve(ctx context.Context, botID string) (BotOverlayConfig, error)
}
type BotActionRequest ¶
type BotOverlayConfig ¶
type BotStatus ¶
type BotStatus struct {
Provider string `json:"provider,omitempty"`
Attached bool `json:"attached"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Message string `json:"message,omitempty"`
NetworkIP string `json:"network_ip,omitempty"`
ProxyAddress string `json:"proxy_address,omitempty"`
Details map[string]any `json:"details,omitempty"`
Workspace *WorkspaceRuntimeStatus `json:"workspace,omitempty"`
}
type ConfigConstraint ¶
type ConfigField ¶
type ConfigField struct {
Key string `json:"key"`
Type FieldType `json:"type"`
Required bool `json:"required,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Default any `json:"default,omitempty"`
Example any `json:"example,omitempty"`
Order int `json:"order,omitempty"`
Enum []string `json:"enum,omitempty"`
Multiline bool `json:"multiline,omitempty"`
Readonly bool `json:"readonly,omitempty"`
Secret bool `json:"secret,omitempty"`
Collapsed bool `json:"collapsed,omitempty"`
Constraint *ConfigConstraint `json:"constraint,omitempty"`
}
func (ConfigField) Validate ¶
func (f ConfigField) Validate() error
type ConfigSchema ¶
type ConfigSchema struct {
Version int `json:"version"`
Title string `json:"title,omitempty"`
Fields []ConfigField `json:"fields"`
}
func (ConfigSchema) Validate ¶
func (s ConfigSchema) Validate() error
type Controller ¶
type Controller interface {
EnsureAttached(ctx context.Context, req AttachmentRequest) (AttachmentStatus, error)
Detach(ctx context.Context, req AttachmentRequest) error
Status(ctx context.Context, req AttachmentRequest) (AttachmentStatus, error)
}
Controller coordinates container runtime networking and optional overlay attachment behind a single workspace-facing surface.
func NewController ¶
func NewController(runtime Runtime, resolver BindingResolver, registry *Registry) Controller
NewController creates a controller with runtime networking and optional bot binding resolution for overlay providers.
type NetworkJoinTarget ¶
type NodeListResponse ¶
type NodeListResponse struct {
Provider string `json:"provider,omitempty"`
Items []NodeOption `json:"items,omitempty"`
Message string `json:"message,omitempty"`
}
type NodeOption ¶
type NodeOption struct {
ID string `json:"id"`
Value string `json:"value"`
DisplayName string `json:"display_name"`
Description string `json:"description,omitempty"`
Online bool `json:"online"`
Addresses []string `json:"addresses,omitempty"`
CanExitNode bool `json:"can_exit_node"`
Selected bool `json:"selected"`
Details map[string]any `json:"details,omitempty"`
}
type NoopOverlayDriver ¶
type NoopOverlayDriver struct{}
NoopOverlayDriver is the default overlay driver until a real SD-WAN provider is selected. It preserves current behavior by leaving overlay state untouched.
func (NoopOverlayDriver) Detach ¶
func (NoopOverlayDriver) Detach(context.Context, AttachmentRequest) error
func (NoopOverlayDriver) EnsureAttached ¶
func (NoopOverlayDriver) EnsureAttached(context.Context, AttachmentRequest) (OverlayStatus, error)
func (NoopOverlayDriver) Kind ¶
func (NoopOverlayDriver) Kind() string
func (NoopOverlayDriver) Status ¶
func (NoopOverlayDriver) Status(context.Context, AttachmentRequest) (OverlayStatus, error)
type OverlayDriver ¶
type OverlayDriver interface {
Kind() string
EnsureAttached(ctx context.Context, req AttachmentRequest) (OverlayStatus, error)
Detach(ctx context.Context, req AttachmentRequest) error
Status(ctx context.Context, req AttachmentRequest) (OverlayStatus, error)
}
OverlayDriver is the runtime surface for a concrete configured provider instance bound to a bot.
type OverlayStatus ¶
type OverlayStatus struct {
Provider string `json:"provider,omitempty"`
Attached bool `json:"attached"`
State string `json:"state,omitempty"`
Message string `json:"message,omitempty"`
NetworkIP string `json:"network_ip,omitempty"`
ProxyAddress string `json:"proxy_address,omitempty"`
Details map[string]any `json:"details,omitempty"`
}
type Provider ¶
type Provider interface {
Kind() string
Descriptor() ProviderDescriptor
NormalizeConfig(raw map[string]any) (map[string]any, error)
Status(ctx context.Context, cfg BotOverlayConfig) (ProviderStatus, error)
ExecuteAction(ctx context.Context, cfg BotOverlayConfig, actionID string, input map[string]any) (ProviderActionExecution, error)
ListNodes(ctx context.Context, botID string, cfg BotOverlayConfig) ([]NodeOption, error)
BuildDriver(cfg BotOverlayConfig) (OverlayDriver, error)
}
Provider describes a supported network backend family such as Tailscale or NetBird. It is registered globally and later instantiated from stored provider records.
type ProviderAction ¶
type ProviderAction struct {
ID string `json:"id"`
Type ActionType `json:"type"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
Primary bool `json:"primary,omitempty"`
Status *ProviderActionStatus `json:"status,omitempty"`
}
type ProviderActionExecution ¶
type ProviderActionExecution struct {
ActionID string `json:"action_id"`
Status ProviderStatus `json:"status"`
Output map[string]any `json:"output,omitempty"`
}
type ProviderActionStatus ¶
type ProviderCapabilities ¶
type ProviderCapabilities struct {
Mesh bool `json:"mesh"`
PrivateDNS bool `json:"private_dns"`
ServiceProxy bool `json:"service_proxy"`
EgressProxy bool `json:"egress_proxy"`
TransparentProxy bool `json:"transparent_proxy"`
ExitNode bool `json:"exit_node"`
Userspace bool `json:"userspace"`
KernelTUN bool `json:"kernel_tun"`
NativeClient bool `json:"native_client"`
SidecarWorker bool `json:"sidecar_worker"`
}
type ProviderDescriptor ¶
type ProviderDescriptor struct {
Kind string `json:"kind"`
DisplayName string `json:"display_name"`
Description string `json:"description,omitempty"`
ConfigSchema ConfigSchema `json:"config_schema"`
Capabilities ProviderCapabilities `json:"capabilities"`
Actions []ProviderAction `json:"actions,omitempty"`
}
type ProviderStatus ¶
type ProviderStatus struct {
State StatusState `json:"state"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Details map[string]any `json:"details,omitempty"`
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores overlay providers and exposes descriptor/capability queries.
func (*Registry) GetCapabilities ¶
func (r *Registry) GetCapabilities(kind string) (ProviderCapabilities, bool)
GetCapabilities returns the capability matrix for the given provider kind.
func (*Registry) GetDescriptor ¶
func (r *Registry) GetDescriptor(kind string) (ProviderDescriptor, bool)
GetDescriptor returns the read-only descriptor for the given provider kind.
func (*Registry) ListDescriptors ¶
func (r *Registry) ListDescriptors() []ProviderDescriptor
ListDescriptors returns all registered provider descriptors.
func (*Registry) MustRegister ¶
MustRegister calls Register and panics on error.
type Runtime ¶
type Runtime interface {
Kind() string
Descriptor() RuntimeDescriptor
EnsureNetwork(ctx context.Context, req RuntimeNetworkRequest) (RuntimeNetworkStatus, error)
RemoveNetwork(ctx context.Context, req RuntimeNetworkRequest) error
StatusNetwork(ctx context.Context, req RuntimeNetworkRequest) (RuntimeNetworkStatus, error)
}
Runtime is the behavioral surface exposed by a container/runtime adapter to the network controller.
func NewContainerRuntimeFromBackend ¶
NewContainerRuntimeFromBackend wraps the current runtime network service with the network package's runtime abstraction.
type RuntimeCapabilities ¶
type RuntimeCapabilities struct {
SidecarWorker bool `json:"sidecar_worker"`
RuntimeNetworkSetup bool `json:"runtime_network_setup"`
JoinContainerNetwork bool `json:"join_container_network"`
JoinNamespacePath bool `json:"join_namespace_path"`
CNI bool `json:"cni"`
Devices bool `json:"devices"`
Capabilities bool `json:"capabilities"`
Privileged bool `json:"privileged"`
}
RuntimeCapabilities describes how a runtime can host or join networking.
type RuntimeDescriptor ¶
type RuntimeDescriptor struct {
Kind string `json:"kind"`
DisplayName string `json:"display_name"`
Capabilities RuntimeCapabilities `json:"capabilities"`
}
RuntimeDescriptor is the read-only metadata exported by a runtime adapter.
type RuntimeNetworkRequest ¶
type RuntimeNetworkRequest struct {
ContainerID string
JoinTarget NetworkJoinTarget
}
RuntimeNetworkRequest describes the container network attachment target for a runtime adapter.
type RuntimeNetworkStatus ¶
RuntimeNetworkStatus describes the current state of the container runtime network attachment.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ExecuteActionBot ¶
func (*Service) GetBotConfig ¶
func (*Service) ListBotNodes ¶
func (*Service) PrepareBotConfigForWrite ¶
func (s *Service) PrepareBotConfigForWrite(cfg BotOverlayConfig) (BotOverlayConfig, error)
func (*Service) ReconcileBot ¶
func (*Service) SetController ¶
func (s *Service) SetController(ctrl Controller)
SetController injects the network controller after construction to break the Service ↔ Controller circular dependency (Controller depends on Service as its BindingResolver).
type StatusState ¶
type StatusState string
type WorkspaceRuntimeStatus ¶
type WorkspaceRuntimeStatus struct {
State string `json:"state"` // workspace_missing | runtime_unavailable | task_stopped | network_target_ready | unknown
ContainerID string `json:"container_id,omitempty"`
TaskStatus string `json:"task_status,omitempty"`
PID uint32 `json:"pid,omitempty"`
NetworkTargetKind string `json:"network_target_kind,omitempty"`
NetworkTarget string `json:"network_target,omitempty"`
NetworkAttached bool `json:"network_attached,omitempty"`
Message string `json:"message,omitempty"`
}
WorkspaceRuntimeStatus describes the bot workspace runtime state (foundation before SD-WAN overlay).