Documentation ¶
Index ¶
- type Addressing
- type DHCP4
- func (d *DHCP4) Address() *net.IPNet
- func (d *DHCP4) Discover(ctx context.Context, link *net.Interface) error
- func (d *DHCP4) Family() int
- func (d *DHCP4) Hostname() (hostname string)
- func (d *DHCP4) Link() *net.Interface
- func (d *DHCP4) MTU() uint32
- func (d *DHCP4) Mask() net.IPMask
- func (d *DHCP4) Name() string
- func (d *DHCP4) Resolvers() []net.IP
- func (d *DHCP4) Routes() (routes []*Route)
- func (d *DHCP4) Scope() uint8
- func (d *DHCP4) TTL() time.Duration
- func (d *DHCP4) Valid() bool
- type DHCP6
- func (d *DHCP6) Address() *net.IPNet
- func (d *DHCP6) Discover(ctx context.Context, link *net.Interface) error
- func (d *DHCP6) Family() int
- func (d *DHCP6) Hostname() (hostname string)
- func (d *DHCP6) Link() *net.Interface
- func (d *DHCP6) MTU() uint32
- func (d *DHCP6) Mask() net.IPMask
- func (d *DHCP6) Name() string
- func (d *DHCP6) Resolvers() []net.IP
- func (d *DHCP6) Routes() (routes []*Route)
- func (d *DHCP6) Scope() uint8
- func (d *DHCP6) TTL() time.Duration
- func (d *DHCP6) Valid() bool
- type Route
- type Static
- func (s *Static) Address() *net.IPNet
- func (s *Static) Discover(ctx context.Context, link *net.Interface) error
- func (s *Static) Family() int
- func (s *Static) Hostname() string
- func (s Static) Link() *net.Interface
- func (s *Static) MTU() uint32
- func (s *Static) Mask() net.IPMask
- func (s *Static) Name() string
- func (s *Static) Resolvers() []net.IP
- func (s *Static) Routes() (routes []*Route)
- func (s *Static) Scope() uint8
- func (s *Static) TTL() time.Duration
- func (s *Static) Valid() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addressing ¶
type Addressing interface { Address() *net.IPNet Discover(context.Context, *net.Interface) error Family() int Hostname() string Link() *net.Interface MTU() uint32 Mask() net.IPMask Name() string Resolvers() []net.IP Routes() []*Route Scope() uint8 TTL() time.Duration Valid() bool }
Addressing provides an interface for abstracting the underlying network addressing configuration. Currently dhcp(v4) and static methods are supported.
type DHCP4 ¶ added in v0.9.0
type DHCP4 struct { Offer *dhcpv4.DHCPv4 Ack *dhcpv4.DHCPv4 NetIf *net.Interface DHCPOptions config.DHCPOptions Mtu int RouteList []config.Route }
DHCP4 implements the Addressing interface.
func (*DHCP4) Address ¶ added in v0.9.0
Address returns back the IP address from the received DHCP offer.
func (*DHCP4) Discover ¶ added in v0.9.0
Discover handles the DHCP client exchange stores the DHCP Ack.
func (*DHCP4) Link ¶ added in v0.9.0
Link returns the underlying net.Interface that this address method is configured for.
func (*DHCP4) Routes ¶ added in v0.9.0
Routes aggregates all Routers and ClasslessStaticRoutes retrieved from the DHCP offer. rfc3442:
If the DHCP server returns both a Classless Static Routes option and a Router option, the DHCP client MUST ignore the Router option.
type DHCP6 ¶ added in v0.9.0
DHCP6 implements the Addressing interface.
func (*DHCP6) Address ¶ added in v0.9.0
Address returns back the IP address from the received DHCP offer.
func (*DHCP6) Discover ¶ added in v0.9.0
Discover handles the DHCP client exchange stores the DHCP Ack.
func (*DHCP6) Link ¶ added in v0.9.0
Link returns the underlying net.Interface that this address method is configured for.
type Route ¶
type Route struct { // Destination is the destination network this route provides. Destination *net.IPNet // Gateway is the router through which the destination may be reached. // This option is exclusive of Interface Gateway net.IP // Interface indicates the route is an interface route, and traffic destinted for the Gateway should be sent through the given network interface. // This option is exclusive of Gateway. Interface string // Metric indicates the "distance" to the destination through this route. // This is an integer which allows the control of priority in the case of multiple routes to the same destination. Metric uint32 }
Route is a representation of a network route.
type Static ¶
type Static struct { CIDR string Mtu int FQDN string RouteList []config.Route NetIf *net.Interface NameServers []net.IP }
Static implements the Addressing interface.
func (*Static) Discover ¶
Discover doesnt do anything in the static configuration since all the necessary configuration data is supplied via config.
func (Static) Link ¶
Link returns the underlying net.Interface that this address method is configured for.
func (*Static) Routes ¶
Routes aggregates the specified routes for a given device configuration TODO: do we need to be explicit on route vs gateway?