example

package
v0.0.0-...-fda5957 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Plugin = plugins.Plugin{
	Name:   "example",
	Setup6: setup6,
	Setup4: setup4,
}

Plugin wraps the information necessary to register a plugin. In the main package, you need to export a `plugins.Plugin` object called `Plugin`, so it can be registered into the plugin registry. Just import your plugin, and fill the structure with plugin name and setup functions:

import (

"github.com/coredhcp/coredhcp/plugins"
"github.com/coredhcp/coredhcp/plugins/example"

)

var Plugin = plugins.Plugin{
    Name: "example",
    Setup6: setup6,
    Setup4: setup4,
}

Name is simply the name used to register the plugin. It must be unique to other registered plugins, or the operation will fail. In other words, don't declare plugins with colliding names.

Setup6 and Setup4 are the setup functions for DHCPv6 and DHCPv4 traffic handlers. They conform to the `plugins.SetupFunc6` and `plugins.SetupFunc4` interfaces, so they must return a `plugins.Handler6` and a `plugins.Handler4` respectively. A `nil` setup function means that that protocol won't be handled by this plugin.

Note that importing the plugin is not enough to use it: you have to explicitly specify the intention to use it in the `config.yml` file, in the plugins section. For example:

server6:

listen: '[::]547'
- example:
- server_id: LL aa:bb:cc:dd:ee:ff
- file: "leases.txt"

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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