12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package routing
- import (
- "bytes"
- "net"
- )
- type Router interface {
-
- GetAllRoutes() ([]Route, error)
-
- GetRoutesFromInterfaceToSubnet(interfaceIndex int, destinationSubnet *net.IPNet) ([]Route, error)
-
- CreateRoute(interfaceIndex int, destinationSubnet *net.IPNet, gatewayAddress net.IP) error
-
- DeleteRoute(interfaceIndex int, destinationSubnet *net.IPNet, gatewayAddress net.IP) error
- }
- type Route struct {
- InterfaceIndex int
- DestinationSubnet *net.IPNet
- GatewayAddress net.IP
- }
- func (r *Route) Equal(other Route) bool {
- return r.DestinationSubnet.IP.Equal(other.DestinationSubnet.IP) && bytes.Equal(r.DestinationSubnet.Mask, other.DestinationSubnet.Mask) && r.GatewayAddress.Equal(other.GatewayAddress)
- }
|