dhcp

package
v0.0.0-...-9474aff Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package dhcp provides utilities for controlling DHCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillAll

func KillAll(ctx context.Context, host *ssh.Conn) error

KillAll kills all running dhcp server on host, useful for environment setup/cleanup.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server controls a DHCP server on AP router.

func StartServer

func StartServer(ctx context.Context, host *ssh.Conn, name, iface, workDir string, ipStart, ipEnd net.IP) (*Server, error)

StartServer creates and runs a DHCP server on iface of the given host with settings specified in conf. workDir is the dir on host for the server to put temporary files. name is the identifier used for log filenames in OutDir. ipStart, ipEnd specifies the leasable range for this dhcp server to offer. After getting a Server instance, d, the caller should call d.Close() at the end, and use the shortened ctx (provided by d.ReserveForClose()) before d.Close() to reserve time for it to run.

func (*Server) Close

func (d *Server) Close(ctx context.Context) error

Close stops the dhcp server and cleans up related resources.

func (*Server) Interface

func (d *Server) Interface() string

Interface returns the interface where DHCP server is running on.

func (*Server) ReserveForClose

func (d *Server) ReserveForClose(ctx context.Context) (context.Context, context.CancelFunc)

ReserveForClose returns a shortened ctx with cancel function. The shortened ctx is used for running things before d.Close() to reserve time for it to run.

Jump to

Keyboard shortcuts

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