async

package
v0.0.0-...-cedea85 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerPort = 67
	DefaultClientPort = 68
)

Default ports

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	LocalAddr    net.Addr
	RemoteAddr   net.Addr
	IgnoreErrors bool
	// contains filtered or unexported fields
}

Client implements an asynchronous DHCPv4 client It doesn't use the broadcast socket! Which means it should be used only when the network is already established. https://github.com/andrewrynhard/dhcp/issues/143

func NewClient

func NewClient() *Client

NewClient creates an asynchronous client

func (*Client) Close

func (c *Client) Close()

Close stops the client

func (*Client) Errors

func (c *Client) Errors() <-chan error

Errors returns a channel where runtime errors are posted

func (*Client) Open

func (c *Client) Open(bufferSize int) error

Open starts the client. The requests made with Send function call are first put to the buffered channel and dispatched in FIFO order. BufferSize indicates the number of packets that can be waiting to be send before blocking the caller exectution.

func (*Client) Send

func (c *Client) Send(message *dhcpv4.DHCPv4, modifiers ...dhcpv4.Modifier) *promise.Future

Send inserts a message to the queue to be sent asynchronously. Returns a future which resolves to response and error.

Jump to

Keyboard shortcuts

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