DHCPv4.Config (DHCP v0.5.0)
View SourceDHCP Server configuration schema and validation.
Provides structured configuration for DHCP server with validation and sensible defaults.
Summary
Functions
Create a new DHCP configuration from keyword options.
Create a new DHCP configuration from keyword options, raising on errors.
Validate configuration and return error if any issues found.
Types
@type t() :: %DHCPv4.Config{ dns_servers: [:inet.ip4_address()], gateway: :inet.ip4_address() | nil, lease_time: integer(), netmask: :inet.ip4_address(), options: [DHCPv4.Message.Option.t()], range_end: :inet.ip4_address(), range_start: :inet.ip4_address(), subnet: :inet.ip4_address() }
Functions
Create a new DHCP configuration from keyword options.
Options
:subnet- Network subnet address (required):netmask- Subnet mask (required):range_start- Start of IP range (required):range_end- End of IP range (required):gateway- Default gateway (optional):dns_servers- List of DNS servers (default: []):lease_time- Lease duration in seconds (default: 3600):options- Additional DHCP options (default: [])
Examples
iex> config = DHCPv4.Config.new(
...> subnet: {192, 168, 1, 0},
...> netmask: {255, 255, 255, 0},
...> range_start: {192, 168, 1, 100},
...> range_end: {192, 168, 1, 200},
...> gateway: {192, 168, 1, 1},
...> dns_servers: [{8, 8, 8, 8}, {8, 8, 4, 4}],
...> lease_time: 7200
...> )
Create a new DHCP configuration from keyword options, raising on errors.
Validate configuration and return error if any issues found.