Documentation ¶
Overview ¶
Package routes provides route setting functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRouteToOtherDestinationExists defines that route for specified network already exists but not to a specified destination ErrRouteToOtherDestinationExists = fmt.Errorf("route to differ") )
Functions ¶
Types ¶
type Agent ¶
type Agent interface { // Add route to a router Add(route Route) error // Flush all existing routes for this router Flush() error }
Agent is stateless and is responsible for creating and deleting source based routes.
Used by implementers.
type GatewayRetriever ¶
type GatewayRetriever interface { // Default retrieves a default gateway Default(ipv6 bool) (netip.Addr, net.Interface, error) }
GatewayRetriever is responsible for retrieving default gateway in current system
type IPGatewayRetriever ¶
type IPGatewayRetriever struct{}
IPGatewayRetriever retrieves default gateway using ip command
type PolicyAgent ¶
type PolicyAgent interface { SetupRoutingRules(net.Interface, bool, bool) error CleanupRouting() error TableID() uint }
PolicyAgent is stateless and is responsible for creating and deleting policy based routes.
Used by implementers.
type PolicyRouter ¶
type PolicyRouter struct {
// contains filtered or unexported fields
}
PolicyRouter is responsible for changing one routing agent over another.
Thread-safe.
func NewPolicyRouter ¶
func NewPolicyRouter(noop, working PolicyAgent, enabled bool) *PolicyRouter
func (*PolicyRouter) CleanupRouting ¶
func (p *PolicyRouter) CleanupRouting() error
func (*PolicyRouter) Disable ¶
func (p *PolicyRouter) Disable() error
func (*PolicyRouter) Enable ¶
func (p *PolicyRouter) Enable() error
func (*PolicyRouter) IsEnabled ¶
func (p *PolicyRouter) IsEnabled() bool
func (*PolicyRouter) SetupRoutingRules ¶
func (p *PolicyRouter) SetupRoutingRules(iface net.Interface, ipv6, enableLocal bool) error
func (*PolicyRouter) TableID ¶
func (p *PolicyRouter) TableID() uint
type PolicyService ¶
type PolicyService interface { SetupRoutingRules(net.Interface, bool, bool) error CleanupRouting() error // TableID of the routing table. TableID() uint // Enable sets up previously remembered rules. Enable() error // Disable remembers previously added rules before clearing them. Disable() error IsEnabled() bool }
Service is stateful and updates system routing configuration by using the appropriate agent.
Used by callers.
type RPFilterManager ¶
type RPFilterManager interface { // Set sets the RP filter value to the one which allows policy // based routing if necessary Set() error // Unset sets the RP filter value to the one which was set // before Unset() error }
RPFilterManager should handle the setting and unsetting of the desired RP filter configuration value
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is responsible for changing one routing agent over another.
Thread-safe.
type Service ¶
type Service interface { // Add route to a router Add(route Route) error // Flush all existing routes for this router Flush() error // Enable adds previously remembered routes. Enable(tableID uint) error // Disable remembers previously added routes before flushing them. Disable() error // IsEnabled reports route setting status IsEnabled() bool }
Service is stateful and updates system routing configuration by using the appropriate agent.
Used by callers.
type SysctlRPFilterManager ¶
type SysctlRPFilterManager struct {
// contains filtered or unexported fields
}
func NewSysctlRPFilterManager ¶
func NewSysctlRPFilterManager() *SysctlRPFilterManager
func (*SysctlRPFilterManager) Set ¶
func (s *SysctlRPFilterManager) Set() error
func (*SysctlRPFilterManager) Unset ¶
func (s *SysctlRPFilterManager) Unset() error
Directories ¶
Path | Synopsis |
---|---|
Package iprouter provides Go API for interacting with ip route.
|
Package iprouter provides Go API for interacting with ip route. |
Package iprule provides Go API for interacting with ip rule.
|
Package iprule provides Go API for interacting with ip rule. |
Package norouter implements noop router.
|
Package norouter implements noop router. |
Package norule implements noop policy router.
|
Package norule implements noop policy router. |