add router interface
This commit is contained in:
24
router/router.go
Normal file
24
router/router.go
Normal file
@ -0,0 +1,24 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
)
|
||||
|
||||
type Options struct{}
|
||||
|
||||
type Option func(opts *Options)
|
||||
|
||||
type Route struct {
|
||||
// Net is the destination network, e.g. 192.168.0.0/16, 172.10.10.0/24.
|
||||
Net *net.IPNet
|
||||
// Gateway is the gateway for the destination network.
|
||||
Gateway net.IP
|
||||
}
|
||||
|
||||
type Router interface {
|
||||
// SetRoute adds or updates a route for the router.
|
||||
SetRoute(ctx context.Context, route *Route, opts ...Option) bool
|
||||
// GetRoute queries a route by destination IP address.
|
||||
GetRoute(ctx context.Context, dst net.IP, opts ...Option) *Route
|
||||
}
|
Reference in New Issue
Block a user