mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 13:05:36 +03:00
f40ef76c79
Merge in DNS/adguard-home from 4923-gopacket-dhcp to master Updates #4923. Squashed commit of the following: commit edf36ce8b1873272c3daebe8cc8f8132793aac44 Merge: a17513d3e123ca8738
Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Jun 22 14:14:39 2023 +0300 Merge branch 'master' into 4923-gopacket-dhcp commit a17513d3e0a9e596d56444dfa46478eee15631de Merge: f04727c29994906fbd
Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Jun 21 17:49:09 2023 +0300 Merge branch 'master' into 4923-gopacket-dhcp commit f04727c29eaf22f9eb53f3aa33d42d00e177b224 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jun 20 15:42:31 2023 +0300 home: revert clients container commit c58284ac6b5b2274da5eed2e853847d757709e5b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Jun 19 21:10:36 2023 +0300 all: imp code, names, docs commit 4c4613c939e1325d11655822d9dbc3f05a6d203c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jun 13 18:51:12 2023 +0300 all: imp code commit 0b4a6e0dd561d9b7bb78dea21dcc947bcd0bd583 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Jun 7 18:40:15 2023 +0300 all: imp api commit 0425edea03d6ca0859657df683bef6ec45bfc399 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Jun 5 15:57:23 2023 +0300 dhcpsvc: introduce package commit 5628ebe6cccf91e2c48778966730bcbbe9e1d9f2 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Jun 1 17:49:12 2023 +0300 WIP
86 lines
2.5 KiB
Go
86 lines
2.5 KiB
Go
package dhcpsvc
|
|
|
|
import (
|
|
"net/netip"
|
|
"time"
|
|
|
|
"github.com/google/gopacket/layers"
|
|
)
|
|
|
|
// Config is the configuration for the DHCP service.
|
|
type Config struct {
|
|
// Interfaces stores configurations of DHCP server specific for the network
|
|
// interface identified by its name.
|
|
Interfaces map[string]*InterfaceConfig
|
|
|
|
// LocalDomainName is the top-level domain name to use for resolving DHCP
|
|
// clients' hostnames.
|
|
LocalDomainName string
|
|
|
|
// ICMPTimeout is the timeout for checking another DHCP server's presence.
|
|
ICMPTimeout time.Duration
|
|
|
|
// Enabled is the state of the service, whether it is enabled or not.
|
|
Enabled bool
|
|
}
|
|
|
|
// InterfaceConfig is the configuration of a single DHCP interface.
|
|
type InterfaceConfig struct {
|
|
// IPv4 is the configuration of DHCP protocol for IPv4.
|
|
IPv4 *IPv4Config
|
|
|
|
// IPv6 is the configuration of DHCP protocol for IPv6.
|
|
IPv6 *IPv6Config
|
|
}
|
|
|
|
// IPv4Config is the interface-specific configuration for DHCPv4.
|
|
type IPv4Config struct {
|
|
// GatewayIP is the IPv4 address of the network's gateway. It is used as
|
|
// the default gateway for DHCP clients and also used in calculating the
|
|
// network-specific broadcast address.
|
|
GatewayIP netip.Addr
|
|
|
|
// SubnetMask is the IPv4 subnet mask of the network. It should be a valid
|
|
// IPv4 subnet mask (i.e. all 1s followed by all 0s).
|
|
SubnetMask netip.Addr
|
|
|
|
// RangeStart is the first address in the range to assign to DHCP clients.
|
|
RangeStart netip.Addr
|
|
|
|
// RangeEnd is the last address in the range to assign to DHCP clients.
|
|
RangeEnd netip.Addr
|
|
|
|
// Options is the list of DHCP options to send to DHCP clients.
|
|
Options layers.DHCPOptions
|
|
|
|
// LeaseDuration is the TTL of a DHCP lease.
|
|
LeaseDuration time.Duration
|
|
|
|
// Enabled is the state of the DHCPv4 service, whether it is enabled or not
|
|
// on the specific interface.
|
|
Enabled bool
|
|
}
|
|
|
|
// IPv6Config is the interface-specific configuration for DHCPv6.
|
|
type IPv6Config struct {
|
|
// RangeStart is the first address in the range to assign to DHCP clients.
|
|
RangeStart netip.Addr
|
|
|
|
// Options is the list of DHCP options to send to DHCP clients.
|
|
Options layers.DHCPOptions
|
|
|
|
// LeaseDuration is the TTL of a DHCP lease.
|
|
LeaseDuration time.Duration
|
|
|
|
// RASlaacOnly defines whether the DHCP clients should only use SLAAC for
|
|
// address assignment.
|
|
RASLAACOnly bool
|
|
|
|
// RAAllowSlaac defines whether the DHCP clients may use SLAAC for address
|
|
// assignment.
|
|
RAAllowSLAAC bool
|
|
|
|
// Enabled is the state of the DHCPv6 service, whether it is enabled or not
|
|
// on the specific interface.
|
|
Enabled bool
|
|
}
|