Documentation
¶
Index ¶
- Constants
- func DeleteDummyInterface(ifaceName string, logger *logger.Logger) error
- func GetNetworkState(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func NetplanApply(cmd *client.Command, logger *logger.Logger, grpcConn *grpc.ClientConn, ...) *client.CommandResponse
- func NetplanGet(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func NetplanRollback(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func PolicyList(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func PolicyManage(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func RouteList(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func RouteManage(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func SetupDummyInterface(filename, ifaceName, downstreamAddress string, port uint32, ...) (string, string, error)
- func SetupDummyInterfaceWithNetlink(ifaceName, downstreamAddress string, logger *logger.Logger) error
- func TableList(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- func TableManage(cmd *client.Command, logger *logger.Logger) *client.CommandResponse
- type ConnectionMonitor
- type NetplanInterfaceConfig
- type NetplanManager
- type NetplanPolicyConfig
- type NetplanPolicyEntry
- type NetplanPolicyNetwork
- type NetplanRouteConfig
- type NetplanRouteEntry
- type NetplanRouteInterface
- type NetplanRouteNetwork
- type PolicyManager
- type RouteManagerNew
- type TableManager
Constants ¶
const ( NetplanConfigFile = "99-elchi-interfaces.yaml" NetplanBackupSuffix = ".backup" DefaultTestTimeout = 10 // seconds ConnectionCheckDelay = 3 // seconds grace period for netplan apply MaxFailedChecks = 5 // consecutive failures before rollback CheckInterval = 500 * time.Millisecond )
const ( MinPolicyPriority = 100 // Elchi policies start from priority 100 MaxPolicyPriority = 999 // Elchi policies end at priority 999 )
const ( ElchiTableFile = "/var/lib/elchi/rt_tables.conf" // Elchi storage location KernelTableLink = "/etc/iproute2/rt_tables.d/elchi.conf" // Kernel reads from here MinTableID = 100 // Elchi-managed tables start from 100 MaxTableID = 999 // Elchi-managed tables end at 999 )
Variables ¶
This section is empty.
Functions ¶
func DeleteDummyInterface ¶
DeleteDummyInterface removes interface from both runtime (netlink) and persistent config (netplan)
func GetNetworkState ¶
GetNetworkState handles SUB_GET_NETWORK_STATE command
func NetplanApply ¶
func NetplanApply(cmd *client.Command, logger *logger.Logger, grpcConn *grpc.ClientConn, clientID string) *client.CommandResponse
NetplanApply handles SUB_NETPLAN_APPLY command
func NetplanGet ¶
NetplanGet handles SUB_NETPLAN_GET command
func NetplanRollback ¶
NetplanRollback handles SUB_NETPLAN_ROLLBACK command
func PolicyList ¶
PolicyList handles SUB_POLICY_LIST command
func PolicyManage ¶
PolicyManage handles SUB_POLICY_MANAGE command
func RouteManage ¶
RouteManage handles SUB_ROUTE_MANAGE command
func SetupDummyInterface ¶
func TableManage ¶
TableManage handles SUB_TABLE_MANAGE command
Types ¶
type ConnectionMonitor ¶
type ConnectionMonitor struct {
// contains filtered or unexported fields
}
ConnectionMonitor monitors controller connection during network changes
func NewConnectionMonitor ¶
func NewConnectionMonitor(logger *logger.Logger) *ConnectionMonitor
func (*ConnectionMonitor) MonitorConnectionDuringApply ¶
func (cm *ConnectionMonitor) MonitorConnectionDuringApply(ctx context.Context) bool
MonitorConnectionDuringApply monitors controller connection during netplan apply
func (*ConnectionMonitor) SetGRPCConnection ¶
func (cm *ConnectionMonitor) SetGRPCConnection(conn *grpc.ClientConn, clientID string)
SetGRPCConnection sets the gRPC connection for ping testing
type NetplanInterfaceConfig ¶
type NetplanInterfaceConfig struct {
RoutingPolicy []NetplanPolicyEntry `yaml:"routing-policy,omitempty"`
}
type NetplanManager ¶
type NetplanManager struct {
// contains filtered or unexported fields
}
func NewNetplanManager ¶
func NewNetplanManager(logger *logger.Logger) *NetplanManager
func (*NetplanManager) ApplyNetplanConfig ¶
func (nm *NetplanManager) ApplyNetplanConfig(config *client.NetplanConfig) error
ApplyNetplanConfig applies netplan configuration with connection protection
func (*NetplanManager) GetCurrentConfig ¶
func (nm *NetplanManager) GetCurrentConfig() (string, error)
GetCurrentConfig returns current netplan configuration
func (*NetplanManager) SetGRPCConnection ¶
func (nm *NetplanManager) SetGRPCConnection(conn *grpc.ClientConn, clientID string)
SetGRPCConnection sets the gRPC connection for ping testing
func (*NetplanManager) ValidateConfig ¶
func (nm *NetplanManager) ValidateConfig(yamlContent string) error
ValidateConfig validates netplan YAML syntax
type NetplanPolicyConfig ¶
type NetplanPolicyConfig struct {
Network NetplanPolicyNetwork `yaml:"network"`
}
Policy persistence structures for netplan YAML
type NetplanPolicyEntry ¶
type NetplanPolicyNetwork ¶
type NetplanPolicyNetwork struct {
Version int `yaml:"version"`
Renderer string `yaml:"renderer"`
Ethernets map[string]NetplanInterfaceConfig `yaml:"ethernets,omitempty"`
}
type NetplanRouteConfig ¶
type NetplanRouteConfig struct {
Network NetplanRouteNetwork `yaml:"network"`
}
Route persistence structures for netplan YAML
type NetplanRouteEntry ¶
type NetplanRouteInterface ¶
type NetplanRouteInterface struct {
Routes []NetplanRouteEntry `yaml:"routes,omitempty"`
}
type NetplanRouteNetwork ¶
type NetplanRouteNetwork struct {
Version int `yaml:"version"`
Renderer string `yaml:"renderer"`
Ethernets map[string]NetplanRouteInterface `yaml:"ethernets,omitempty"`
}
type PolicyManager ¶
type PolicyManager struct {
// contains filtered or unexported fields
}
func NewPolicyManager ¶
func NewPolicyManager(logger *logger.Logger) *PolicyManager
func (*PolicyManager) GetCurrentPolicies ¶
func (pm *PolicyManager) GetCurrentPolicies() ([]*client.RoutingPolicy, error)
GetCurrentPolicies returns current routing policies from runtime
func (*PolicyManager) ManagePolicies ¶
func (pm *PolicyManager) ManagePolicies(operations []*client.RoutingPolicyOperation) error
ManagePolicies handles routing policy operations (add/delete/replace)
type RouteManagerNew ¶
type RouteManagerNew struct {
// contains filtered or unexported fields
}
func NewRouteManagerNew ¶
func NewRouteManagerNew(logger *logger.Logger) *RouteManagerNew
func (*RouteManagerNew) ManageRoutes ¶
func (rm *RouteManagerNew) ManageRoutes(operations []*client.RouteOperation) error
ManageRoutes handles route operations (add/delete/replace)
type TableManager ¶
type TableManager struct {
// contains filtered or unexported fields
}
func NewTableManager ¶
func NewTableManager(logger *logger.Logger) *TableManager
func (*TableManager) GetCurrentTables ¶
func (tm *TableManager) GetCurrentTables() ([]*client.RoutingTableDefinition, error)
GetCurrentTables returns current routing table definitions
func (*TableManager) ManageRoutingTables ¶
func (tm *TableManager) ManageRoutingTables(tables []*client.RoutingTableDefinition) error
ManageRoutingTables processes routing table definitions (bulk update)
func (*TableManager) ManageTableOperations ¶
func (tm *TableManager) ManageTableOperations(operations []*client.TableOperation) error
ManageTableOperations processes individual table operations (add/delete/replace)