dhcp4

package
v0.0.0-...-07f1eb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package dhcp4 implements a DHCPv4 client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Interface *net.Interface // e.g. net.InterfaceByName("eth0")
	HWAddr    net.HardwareAddr

	// last DHCPACK packet for renewal/release
	Ack *layers.DHCPv4
	// contains filtered or unexported fields
}

func (*Client) Config

func (c *Client) Config() Config

func (*Client) Err

func (c *Client) Err() error

func (*Client) ObtainOrRenew

func (c *Client) ObtainOrRenew() bool

ObtainOrRenew returns false when encountering a permanent error.

func (*Client) Release

func (c *Client) Release() error

type Config

type Config struct {
	RenewAfter time.Time `json:"valid_until"`
	ClientIP   string    `json:"client_ip"`   // e.g. 85.195.207.62
	SubnetMask string    `json:"subnet_mask"` // e.g. 255.255.255.128
	Router     string    `json:"router"`      // e.g. 85.195.207.1
	DNS        []string  `json:"dns"`         // e.g. 77.109.128.2, 213.144.129.20
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL