-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
dhcp_options.go
47 lines (40 loc) · 1.36 KB
/
dhcp_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package types
import "github.com/insomniacslk/dhcp/dhcpv4"
type OptionTagName string
const (
TagNameSubnetMask = "subnet_mask"
TagNameRouter = "router"
TagNameTimeServer = "time_server"
TagNameNameServer = "name_server"
TagNameDomainName = "domain_name"
TagNameBootfile = "bootfile"
TagNameTFTPserver = "tftp_server"
)
// https://datatracker.ietf.org/doc/html/rfc2131
// https://datatracker.ietf.org/doc/html/rfc2132
var TagMap map[OptionTagName]uint8 = map[OptionTagName]uint8{
TagNameSubnetMask: dhcpv4.OptionSubnetMask.Code(),
TagNameRouter: dhcpv4.OptionRouter.Code(),
TagNameTimeServer: dhcpv4.OptionTimeServer.Code(),
TagNameNameServer: dhcpv4.OptionDomainNameServer.Code(),
TagNameDomainName: dhcpv4.OptionDomainName.Code(),
TagNameBootfile: dhcpv4.OptionBootfileName.Code(),
TagNameTFTPserver: dhcpv4.OptionTFTPServerName.Code(),
}
var IPTags = map[uint8]bool{
dhcpv4.OptionRouter.Code(): true,
dhcpv4.OptionSubnetMask.Code(): true,
dhcpv4.OptionNameServer.Code(): true,
dhcpv4.OptionDomainNameServer.Code(): true,
dhcpv4.OptionTimeServer.Code(): true,
}
type DHCPOption struct {
Tag *uint8 `json:"tag"`
TagName string `json:"tagName"`
Value *string `json:"value"`
Value64 []string `json:"value64"`
ValueHex []string `json:"valueHex"`
}
func OptionValue(input string) *string {
return &input
}