plugin

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// Name returns the name of the handler
	Name() string

	// ServeDHCP is a HandlerFunc and called for each DHCPv4 request. See HandlerFunc
	// for more information
	ServeDHCP(ctx context.Context, req *dhcpv4.DHCPv4, resp *dhcpv4.DHCPv4) error
}

Handler for DHCP requests created by a plugin factory (see Plugin). Each handler is responsible of calling the next handling in the chain which was passed to Plugin

type HandlerFunc

type HandlerFunc func(ctx context.Context, req *dhcpv4.DHCPv4, resp *dhcpv4.DHCPv4) error

HandlerFunc allows to easily wrap a function as a Handler type The provided context will always have a lease.Database assigned to it. A reference to the database can be loaded by using lease.GetDatabase(ctx)

func (HandlerFunc) Name

func (fn HandlerFunc) Name() string

Name returns "HandlerFunc" and implements the Handler interface

func (HandlerFunc) ServeDHCP

func (fn HandlerFunc) ServeDHCP(ctx context.Context, req, resp *dhcpv4.DHCPv4) error

ServeDHCP implements the Handler interface

type Plugin

type Plugin func(Handler) Handler

Plugin represents Setup func for a NextDHCP plugin. It is passed the next plugin in the chain

Directories

Path Synopsis
Package test contains utility and helper methods for testing plugins
Package test contains utility and helper methods for testing plugins

Jump to

Keyboard shortcuts

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