DHCPv6.Config (DHCP v0.5.0)

View Source

DHCPv6 Server configuration schema and validation according to RFC 3315.

Provides structured configuration for DHCPv6 server with validation and sensible defaults.

Summary

Functions

Create a new DHCPv6 configuration from keyword options.

Create a new DHCPv6 configuration from keyword options, raising on errors.

Validate configuration and return error if any issues found.

Types

t()

@type t() :: %DHCPv6.Config{
  dns_servers: [:inet.ip6_address()],
  lease_time: integer(),
  options: [DHCPv6.Option.t()],
  prefix: :inet.ip6_address(),
  prefix_length: integer(),
  range_end: :inet.ip6_address(),
  range_start: :inet.ip6_address(),
  rapid_commit: boolean()
}

Functions

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, String.t()}

Create a new DHCPv6 configuration from keyword options.

Options

  • :prefix - IPv6 prefix address (required)
  • :prefix_length - Prefix length (required)
  • :range_start - Start of IPv6 range (required)
  • :range_end - End of IPv6 range (required)
  • :dns_servers - List of DNS servers (default: [])
  • :lease_time - Lease duration in seconds (default: 3600)
  • :rapid_commit - Enable rapid commit (default: false)
  • :options - Additional DHCPv6 options (default: [])

Examples

iex> config = DHCPv6.Config.new(
...>   prefix: {0x2001, 0x0DB8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
...>   prefix_length: 64,
...>   range_start: {0x2001, 0x0DB8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001},
...>   range_end: {0x2001, 0x0DB8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF},
...>   dns_servers: [{0x2001, 0x4860, 0x4860, 0, 0, 0, 0, 0x8888}],
...>   lease_time: 7200
...> )

new!(opts)

@spec new!(keyword()) :: t()

Create a new DHCPv6 configuration from keyword options, raising on errors.

validate(config)

@spec validate(t()) :: :ok | {:error, String.t()}

Validate configuration and return error if any issues found.