Documentation
¶
Overview ¶
Package control implements the agent-facing control plane.
Index ¶
- Variables
- type DNSConfig
- type Options
- type PeerPath
- type PolicyError
- type Service
- func (s *Service) ApproveRoutes(ctx context.Context, nodeID string, routes []netip.Prefix) (store.Node, error)
- func (s *Service) Compiled(ctx context.Context) (*policy.Compiled, []store.Node, error)
- func (s *Service) DNS(ctx context.Context) (DNSConfig, error)
- func (s *Service) Handler() (string, http.Handler)
- func (s *Service) KeyExpiry(ctx context.Context) (time.Duration, error)
- func (s *Service) Notify()
- func (s *Service) Online(nodeID string) bool
- func (s *Service) Options() Options
- func (s *Service) Policy(ctx context.Context) (*policy.Policy, string, error)
- func (s *Service) Prefix() netip.Prefix
- func (s *Service) Register(ctx context.Context, req *connect.Request[controlv1.RegisterRequest]) (*connect.Response[controlv1.RegisterResponse], error)
- func (s *Service) ReportStatus(ctx context.Context, req *connect.Request[controlv1.ReportStatusRequest]) (*connect.Response[controlv1.ReportStatusResponse], error)
- func (s *Service) SetDNS(ctx context.Context, c DNSConfig) (DNSConfig, error)
- func (s *Service) SetPolicy(ctx context.Context, text string) (*policy.Policy, error)
- func (s *Service) Subscribe() (<-chan struct{}, func())
- func (s *Service) Topology() map[string][]PeerPath
- func (s *Service) UpdateEndpoints(ctx context.Context, req *connect.Request[controlv1.UpdateEndpointsRequest]) (*connect.Response[controlv1.UpdateEndpointsResponse], error)
- func (s *Service) WatchNetmap(ctx context.Context, req *connect.Request[controlv1.WatchNetmapRequest], ...) error
- type SplitDNS
Constants ¶
This section is empty.
Variables ¶
var DefaultDNS = DNSConfig{MagicDNS: true, Domain: "mesh.internal", Split: []SplitDNS{}}
DefaultDNS is used until an admin changes it.
Functions ¶
This section is empty.
Types ¶
type DNSConfig ¶
type DNSConfig struct {
// MagicDNS makes agents answer <node>.<Domain> at MagicDNSAddr.
MagicDNS bool `json:"magicDNS"`
Domain string `json:"domain"`
// Split sends queries for these domains to specific resolvers.
Split []SplitDNS `json:"split"`
}
DNSConfig is the mesh's DNS configuration, stored as JSON.
type Options ¶
type Options struct {
// STUNPort is the UDP port of the STUN server; 0 if disabled.
STUNPort uint16
// RelayEnabled reports whether the packet relay is served.
RelayEnabled bool
}
Options describes the NAT-traversal services the coordinator offers, which are announced to nodes in every netmap.
type PolicyError ¶
type PolicyError struct{ Errors []string }
PolicyError lists why a policy was rejected.
func (*PolicyError) Error ¶
func (e *PolicyError) Error() string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements controlv1connect.ControlServiceHandler.
func NewService ¶
NewService returns a control service allocating addresses from prefix.
func (*Service) ApproveRoutes ¶
func (s *Service) ApproveRoutes(ctx context.Context, nodeID string, routes []netip.Prefix) (store.Node, error)
ApproveRoutes replaces a node's approved routes.
func (*Service) Notify ¶
func (s *Service) Notify()
Notify tells every connected node to refresh its netmap, e.g. after an administrator changed something.
func (*Service) Policy ¶
Policy returns the access-control policy and its source text. It reads the stored text every time (so changes made with the coordinator's CLI apply too) and parses it only when it changed.
func (*Service) ReportStatus ¶
func (*Service) SetPolicy ¶
SetPolicy validates, stores and applies a new policy. Policy tests are checked against the current nodes; failures reject the change.
func (*Service) Subscribe ¶
func (s *Service) Subscribe() (<-chan struct{}, func())
Subscribe returns a channel that receives a value (coalesced) whenever the mesh changes, and a function to stop listening.
func (*Service) UpdateEndpoints ¶
func (*Service) WatchNetmap ¶
func (s *Service) WatchNetmap(ctx context.Context, req *connect.Request[controlv1.WatchNetmapRequest], stream *connect.ServerStream[controlv1.WatchNetmapResponse]) error