Documentation
¶
Overview ¶
Package route provides network route configuration management via Netplan.
Index ¶
- type Darwin
- func (d *Darwin) Create(_ context.Context, _ Entry) (*Result, error)
- func (d *Darwin) Delete(_ context.Context, _ string) (*Result, error)
- func (d *Darwin) Get(_ context.Context, _ string) (*Entry, error)
- func (d *Darwin) List(_ context.Context) ([]ListEntry, error)
- func (d *Darwin) Update(_ context.Context, _ Entry) (*Result, error)
- type Debian
- func (d *Debian) Create(ctx context.Context, entry Entry) (*Result, error)
- func (d *Debian) Delete(ctx context.Context, interfaceName string) (*Result, error)
- func (d *Debian) Get(ctx context.Context, interfaceName string) (*Entry, error)
- func (d *Debian) List(_ context.Context) ([]ListEntry, error)
- func (d *Debian) Update(ctx context.Context, entry Entry) (*Result, error)
- type Entry
- type Linux
- func (l *Linux) Create(_ context.Context, _ Entry) (*Result, error)
- func (l *Linux) Delete(_ context.Context, _ string) (*Result, error)
- func (l *Linux) Get(_ context.Context, _ string) (*Entry, error)
- func (l *Linux) List(_ context.Context) ([]ListEntry, error)
- func (l *Linux) Update(_ context.Context, _ Entry) (*Result, error)
- type ListEntry
- type Provider
- type Result
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Darwin ¶
type Darwin struct{}
Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as Netplan is not available on macOS.
func NewDarwinProvider ¶
func NewDarwinProvider() *Darwin
NewDarwinProvider factory to create a new Darwin instance.
type Debian ¶
type Debian struct {
provider.FactsAware
// contains filtered or unexported fields
}
Debian implements the Provider interface for Debian-family systems. It writes Netplan YAML route files to /etc/netplan/ with an osapi- prefix and tracks state in the file-state KV for idempotency.
func NewDebianProvider ¶
func NewDebianProvider( logger *slog.Logger, fs avfs.VFS, stateKV jetstream.KeyValue, execManager exec.Manager, hostname string, ) *Debian
NewDebianProvider factory to create a new Debian instance.
func (*Debian) Create ¶
Create deploys new routes for an interface via Netplan. Fails if a managed route file already exists for the interface, or if any route targets the default gateway.
func (*Debian) Delete ¶
Delete removes managed routes for an interface via Netplan. If no managed route file exists, returns Changed: false (idempotent).
func (*Debian) Get ¶
Get returns the managed routes for a specific interface by reading the route metadata from the file-state KV store.
type Linux ¶
type Linux struct{}
Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
type ListEntry ¶
type ListEntry struct {
Destination string `json:"destination"`
Gateway string `json:"gateway"`
Interface string `json:"interface"`
Mask string `json:"mask,omitempty"`
Metric int `json:"metric,omitempty"`
Flags string `json:"flags,omitempty"`
}
ListEntry is a route from the system routing table.
type Provider ¶
type Provider interface {
// List returns all routes from the system routing table.
List(ctx context.Context) ([]ListEntry, error)
// Get returns the managed routes for a specific interface.
Get(ctx context.Context, interfaceName string) (*Entry, error)
// Create deploys new routes for an interface via Netplan.
Create(ctx context.Context, entry Entry) (*Result, error)
// Update redeploys routes for an existing interface via Netplan.
Update(ctx context.Context, entry Entry) (*Result, error)
// Delete removes managed routes for an interface via Netplan.
Delete(ctx context.Context, interfaceName string) (*Result, error)
}
Provider manages route configuration via Netplan.