plugin

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package plugin implements CoreRAD plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptivePortal added in v0.3.2

type CaptivePortal struct {
	Portal *ndp.CaptivePortal
}

CaptivePortal configures a NDP Captive Portal option.

func NewCaptivePortal added in v0.3.2

func NewCaptivePortal(uri string) (*CaptivePortal, error)

NewCaptivePortal creates a CaptivePortal from a string.

func UnrestrictedPortal added in v1.1.2

func UnrestrictedPortal() *CaptivePortal

UnrestrictedPortal creates a CaptivePortal which advertises itself as unrestricted.

func (*CaptivePortal) Apply added in v0.3.2

func (cp *CaptivePortal) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*CaptivePortal) Name added in v0.3.2

func (*CaptivePortal) Name() string

Name implements Plugin.

func (*CaptivePortal) Prepare added in v0.3.2

func (*CaptivePortal) Prepare(_ *net.Interface) error

Prepare implements Plugin.

func (*CaptivePortal) String added in v0.3.2

func (cp *CaptivePortal) String() string

String implements Plugin.

type DNSSL

type DNSSL struct {
	Lifetime    time.Duration
	DomainNames []string
}

DNSSL configures a NDP DNS Search List option.

func (*DNSSL) Apply

func (d *DNSSL) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*DNSSL) Name

func (d *DNSSL) Name() string

Name implements Plugin.

func (*DNSSL) Prepare

func (*DNSSL) Prepare(_ *net.Interface) error

Prepare implements Plugin.

func (*DNSSL) String

func (d *DNSSL) String() string

String implements Plugin.

type LLA added in v0.1.9

type LLA struct {
	Addr net.HardwareAddr
}

LLA configures a NDP Source Link Layer Address option.

func (*LLA) Apply added in v0.1.9

func (l *LLA) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*LLA) Name added in v0.1.9

func (l *LLA) Name() string

Name implements Plugin.

func (*LLA) Prepare added in v0.1.9

func (l *LLA) Prepare(ifi *net.Interface) error

Prepare implements Plugin.

func (*LLA) String added in v0.1.9

func (l *LLA) String() string

String implements Plugin.

type MTU

type MTU int

MTU configures a NDP MTU option.

func NewMTU added in v0.1.9

func NewMTU(mtu int) *MTU

NewMTU creates a MTU from an integer.

func (*MTU) Apply

func (m *MTU) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*MTU) Name

func (m *MTU) Name() string

Name implements Plugin.

func (*MTU) Prepare

func (*MTU) Prepare(_ *net.Interface) error

Prepare implements Plugin.

func (*MTU) String

func (m *MTU) String() string

String implements Plugin.

type PREF64 added in v1.3.0

type PREF64 struct {
	Inner *ndp.PREF64
}

PREF64 configures a NDP PREF64 option, used to communicate prefixes to clients for NAT64.

func NewPREF64 added in v1.3.0

func NewPREF64(prefix netip.Prefix, maxInterval time.Duration) *PREF64

NewPREF64 computes PREF64 plugin values given a prefix and router advertisement max interval value.

func (*PREF64) Apply added in v1.3.0

func (p *PREF64) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*PREF64) Name added in v1.3.0

func (*PREF64) Name() string

Name implements Plugin.

func (*PREF64) Prepare added in v1.3.0

func (*PREF64) Prepare(_ *net.Interface) error

Prepare implements Plugin.

func (*PREF64) String added in v1.3.0

func (p *PREF64) String() string

String implements Plugin.

type Plugin

type Plugin interface {
	// Name is the string name of the plugin.
	Name() string

	// String is the string representation of the plugin's configuration.
	String() string

	// Prepare prepares a Plugin for use with the specified network interface.
	Prepare(ifi *net.Interface) error

	// Apply applies Plugin data to the input RA.
	Apply(ra *ndp.RouterAdvertisement) error
}

A Plugin specifies a CoreRAD plugin's configuration.

type Prefix

type Prefix struct {
	// Whether or not this Prefix should automatically infer and apply the
	// appropriate IPv6 prefixes to the configuration.
	Auto bool

	// Parameters from configuration.
	Prefix            netip.Prefix
	OnLink            bool
	Autonomous        bool
	ValidLifetime     time.Duration
	PreferredLifetime time.Duration

	// Whether or not this prefix will be treated as deprecated when the Prefix
	// is applied, and the time used to calculate the expiration time.
	Epoch      time.Time
	Deprecated bool

	// Functions which can be swapped for tests.
	TimeNow func() time.Time
	Addrs   func() ([]system.IP, error)
}

A Prefix configures a NDP Prefix Information option.

func (*Prefix) Apply

func (p *Prefix) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*Prefix) Name

func (p *Prefix) Name() string

Name implements Plugin.

func (*Prefix) Prepare

func (p *Prefix) Prepare(ifi *net.Interface) error

Prepare implements Plugin.

func (*Prefix) String

func (p *Prefix) String() string

String implements Plugin.

type RDNSS

type RDNSS struct {
	// Whether or not this RDNSS should automatically infer and apply the
	// appropriate IPv6 DNS server address to the configuration.
	Auto bool

	// Parameters from configuration.
	Lifetime time.Duration
	Servers  []netip.Addr

	// Functions which can be swapped for tests.
	Addrs func() ([]system.IP, error)
}

RDNSS configures a NDP Recursive DNS Servers option.

func (*RDNSS) Apply

func (r *RDNSS) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*RDNSS) Name

func (r *RDNSS) Name() string

Name implements Plugin.

func (*RDNSS) Prepare

func (r *RDNSS) Prepare(ifi *net.Interface) error

Prepare implements Plugin.

func (*RDNSS) String

func (r *RDNSS) String() string

String implements Plugin.

type Route added in v0.2.1

type Route struct {
	// Whether or not this Route should automatically infer and apply the
	// appropriate IPv6 loopback interface routes to the configuration.
	Auto bool

	// Parameters from configuration.
	Prefix     netip.Prefix
	Preference ndp.Preference
	Lifetime   time.Duration

	// Whether or not this route will be treated as deprecated when the Route
	// is applied, and the time used to calculate the expiration time.
	Epoch      time.Time
	Deprecated bool

	// Functions which can be swapped for tests.
	TimeNow func() time.Time
	Routes  func() ([]system.Route, error)
}

A Route configures a NDP Route Information option.

func (*Route) Apply added in v0.2.1

func (r *Route) Apply(ra *ndp.RouterAdvertisement) error

Apply implements Plugin.

func (*Route) Name added in v0.2.1

func (*Route) Name() string

Name implements Plugin.

func (*Route) Prepare added in v0.2.1

func (r *Route) Prepare(_ *net.Interface) error

Prepare implements Plugin.

func (*Route) String added in v0.2.1

func (r *Route) String() string

String implements Plugin.

Jump to

Keyboard shortcuts

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