We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a662cc4 + a2d2050 commit b56fa0dCopy full SHA for b56fa0d
dhcpv4/dhcpv4.go
@@ -602,6 +602,13 @@ func (d *DHCPv4) NTPServers() []net.IP {
602
return GetIPs(OptionNTPServers, d.Options)
603
}
604
605
+// NetBIOSNameServers parses the DHCPv4 NetBIOS Name Servers option if present.
606
+//
607
+// The NetBIOS over TCP/IP Name Server option is described by RFC 2132, Section 8.5.
608
+func (d *DHCPv4) NetBIOSNameServers() []net.IP {
609
+ return GetIPs(OptionNetBIOSOverTCPIPNameServer, d.Options)
610
+}
611
+
612
// DNS parses the DHCPv4 Domain Name Server option if present.
613
//
614
// The DNS server option is described by RFC 2132, Section 3.8.
dhcpv4/option_ips.go
@@ -87,6 +87,16 @@ func OptNTPServers(ntpServers ...net.IP) Option {
87
88
89
90
+// OptNetBIOSNameServers returns a new DHCPv4 NetBIOS Name Server option.
91
92
93
+func OptNetBIOSNameServers(netBIOSNameServers ...net.IP) Option {
94
+ return Option{
95
+ Code: OptionNetBIOSOverTCPIPNameServer,
96
+ Value: IPs(netBIOSNameServers),
97
+ }
98
99
100
// OptDNS returns a new DHCPv4 Domain Name Server option.
101
102
dhcpv4/option_ips_test.go
@@ -69,6 +69,25 @@ func TestGetNTPServers(t *testing.T) {
69
require.Nil(t, m.NTPServers())
70
71
72
+func TestOptNetBIOSNameServers(t *testing.T) {
73
+ o := OptNetBIOSNameServers(net.IPv4(192, 168, 0, 1), net.IPv4(192, 168, 0, 10))
74
+ require.Equal(t, OptionNetBIOSOverTCPIPNameServer, o.Code)
75
+ require.Equal(t, []byte{192, 168, 0, 1, 192, 168, 0, 10}, o.Value.ToBytes())
76
+ require.Equal(t, "NetBIOS over TCP/IP Name Server: 192.168.0.1, 192.168.0.10", o.String())
77
78
79
+func TestGetNetBIOSNameServers(t *testing.T) {
80
+ ips := []net.IP{
81
+ net.IP{192, 168, 0, 1},
82
+ net.IP{192, 168, 0, 10},
83
84
+ m, _ := New(WithOption(OptNetBIOSNameServers(ips...)))
85
+ require.Equal(t, ips, m.NetBIOSNameServers())
86
+ m, _ = New()
+ require.Nil(t, m.NetBIOSNameServers())
func TestOptRouter(t *testing.T) {
o := OptRouter(net.IPv4(192, 168, 0, 1), net.IPv4(192, 168, 0, 10))
require.Equal(t, OptionRouter, o.Code)
0 commit comments