123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package backend
- import (
- "net"
- "golang.org/x/net/context"
- "github.com/coreos/flannel/subnet"
- )
- type ExternalInterface struct {
- Iface *net.Interface
- IfaceAddr net.IP
- ExtAddr net.IP
- }
- type Backend interface {
-
- Run(ctx context.Context)
-
- RegisterNetwork(ctx context.Context, network string, config *subnet.Config) (Network, error)
- }
- type Network interface {
- Lease() *subnet.Lease
- MTU() int
- Run(ctx context.Context)
- }
- type BackendCtor func(sm subnet.Manager, ei *ExternalInterface) (Backend, error)
- type SimpleNetwork struct {
- SubnetLease *subnet.Lease
- ExtIface *ExternalInterface
- }
- func (n *SimpleNetwork) Lease() *subnet.Lease {
- return n.SubnetLease
- }
- func (n *SimpleNetwork) MTU() int {
- return n.ExtIface.Iface.MTU
- }
- func (_ *SimpleNetwork) Run(ctx context.Context) {
- <-ctx.Done()
- }
|