summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6
diff options
context:
space:
mode:
authorChristopher Koch <chrisko@google.com>2018-12-29 11:29:25 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2019-01-14 23:19:04 +0000
commit833f274e1aca3b23320f6d31c246c73eefd38974 (patch)
treea25fab2a0597398262bc419a26ff2ffa058388a9 /dhcpv6
parent75d26a6410980df90d3a9d224956cfe5ed35a07f (diff)
iana: rename HwTypeType to HWType, add package comment.
Diffstat (limited to 'dhcpv6')
-rw-r--r--dhcpv6/async/client_test.go2
-rw-r--r--dhcpv6/dhcpv6_test.go2
-rw-r--r--dhcpv6/dhcpv6message.go2
-rw-r--r--dhcpv6/duid.go8
-rw-r--r--dhcpv6/duid_test.go6
-rw-r--r--dhcpv6/iputils_test.go2
-rw-r--r--dhcpv6/modifiers_test.go4
-rw-r--r--dhcpv6/option_clientid_test.go6
-rw-r--r--dhcpv6/option_serverid_test.go6
9 files changed, 19 insertions, 19 deletions
diff --git a/dhcpv6/async/client_test.go b/dhcpv6/async/client_test.go
index 0bc3a87..25a71a8 100644
--- a/dhcpv6/async/client_test.go
+++ b/dhcpv6/async/client_test.go
@@ -21,7 +21,7 @@ func solicit(input string) (dhcpv6.DHCPv6, error) {
}
duid := dhcpv6.Duid{
Type: dhcpv6.DUID_LLT,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
Time: dhcpv6.GetTime(),
LinkLayerAddr: mac,
}
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go
index b1da1d8..3a9e3f1 100644
--- a/dhcpv6/dhcpv6_test.go
+++ b/dhcpv6/dhcpv6_test.go
@@ -265,7 +265,7 @@ func TestNewMessageTypeSolicitWithCID(t *testing.T) {
duid := Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: hwAddr,
}
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go
index 545146c..a95d9ce 100644
--- a/dhcpv6/dhcpv6message.go
+++ b/dhcpv6/dhcpv6message.go
@@ -107,7 +107,7 @@ func NewSolicitForInterface(ifname string, modifiers ...Modifier) (DHCPv6, error
}
duid := Duid{
Type: DUID_LLT,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
Time: GetTime(),
LinkLayerAddr: iface.HardwareAddr,
}
diff --git a/dhcpv6/duid.go b/dhcpv6/duid.go
index 8530827..c9e38b2 100644
--- a/dhcpv6/duid.go
+++ b/dhcpv6/duid.go
@@ -34,7 +34,7 @@ func (d DuidType) String() string {
type Duid struct {
Type DuidType
- HwType iana.HwTypeType // for DUID-LLT and DUID-LL. Ignored otherwise. RFC 826
+ HwType iana.HWType // for DUID-LLT and DUID-LL. Ignored otherwise. RFC 826
Time uint32 // for DUID-LLT. Ignored otherwise
LinkLayerAddr net.HardwareAddr
EnterpriseNumber uint32 // for DUID-EN. Ignored otherwise
@@ -87,7 +87,7 @@ func (d *Duid) ToBytes() []byte {
func (d *Duid) String() string {
var hwaddr string
- if d.HwType == iana.HwTypeEthernet {
+ if d.HwType == iana.HWTypeEthernet {
for _, b := range d.LinkLayerAddr {
hwaddr += fmt.Sprintf("%02x:", b)
}
@@ -108,14 +108,14 @@ func DuidFromBytes(data []byte) (*Duid, error) {
if len(data) < 8 {
return nil, fmt.Errorf("Invalid DUID-LLT: shorter than 8 bytes")
}
- d.HwType = iana.HwTypeType(binary.BigEndian.Uint16(data[2:4]))
+ d.HwType = iana.HWType(binary.BigEndian.Uint16(data[2:4]))
d.Time = binary.BigEndian.Uint32(data[4:8])
d.LinkLayerAddr = data[8:]
} else if d.Type == DUID_LL {
if len(data) < 4 {
return nil, fmt.Errorf("Invalid DUID-LL: shorter than 4 bytes")
}
- d.HwType = iana.HwTypeType(binary.BigEndian.Uint16(data[2:4]))
+ d.HwType = iana.HWType(binary.BigEndian.Uint16(data[2:4]))
d.LinkLayerAddr = data[4:]
} else if d.Type == DUID_EN {
if len(data) < 6 {
diff --git a/dhcpv6/duid_test.go b/dhcpv6/duid_test.go
index abfe91d..840ab4a 100644
--- a/dhcpv6/duid_test.go
+++ b/dhcpv6/duid_test.go
@@ -43,7 +43,7 @@ func TestDuidLLTFromBytes(t *testing.T) {
require.Equal(t, 14, duid.Length())
require.Equal(t, DUID_LLT, duid.Type)
require.Equal(t, uint32(0x01020304), duid.Time)
- require.Equal(t, iana.HwTypeEthernet, duid.HwType)
+ require.Equal(t, iana.HWTypeEthernet, duid.HwType)
require.Equal(t, net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, duid.LinkLayerAddr)
}
@@ -57,7 +57,7 @@ func TestDuidLLFromBytes(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 10, duid.Length())
require.Equal(t, DUID_LL, duid.Type)
- require.Equal(t, iana.HwTypeEthernet, duid.HwType)
+ require.Equal(t, iana.HWTypeEthernet, duid.HwType)
require.Equal(t, net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, duid.LinkLayerAddr)
}
@@ -83,7 +83,7 @@ func TestDuidLLTToBytes(t *testing.T) {
}
duid := Duid{
Type: DUID_LLT,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
Time: uint32(0x01020304),
LinkLayerAddr: []byte{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
}
diff --git a/dhcpv6/iputils_test.go b/dhcpv6/iputils_test.go
index 76806ba..e033d57 100644
--- a/dhcpv6/iputils_test.go
+++ b/dhcpv6/iputils_test.go
@@ -134,7 +134,7 @@ func Test_ExtractMAC(t *testing.T) {
// MAC extracted from DUID
duid := Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: []byte{0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa},
}
solicit, err := NewMessage(WithClientID(duid))
diff --git a/dhcpv6/modifiers_test.go b/dhcpv6/modifiers_test.go
index 6fc6ae7..9bf2da4 100644
--- a/dhcpv6/modifiers_test.go
+++ b/dhcpv6/modifiers_test.go
@@ -12,7 +12,7 @@ import (
func TestWithClientID(t *testing.T) {
duid := Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{0xfa, 0xce, 0xb0, 0x00, 0x00, 0x0c}),
}
m, err := NewMessage(WithClientID(duid))
@@ -26,7 +26,7 @@ func TestWithClientID(t *testing.T) {
func TestWithServerID(t *testing.T) {
duid := Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{0xfa, 0xce, 0xb0, 0x00, 0x00, 0x0c}),
}
m, err := NewMessage(WithServerID(duid))
diff --git a/dhcpv6/option_clientid_test.go b/dhcpv6/option_clientid_test.go
index 872651e..5e95d1a 100644
--- a/dhcpv6/option_clientid_test.go
+++ b/dhcpv6/option_clientid_test.go
@@ -17,7 +17,7 @@ func TestParseOptClientId(t *testing.T) {
opt, err := ParseOptClientId(data)
require.NoError(t, err)
require.Equal(t, DUID_LL, opt.Cid.Type)
- require.Equal(t, iana.HwTypeEthernet, opt.Cid.HwType)
+ require.Equal(t, iana.HWTypeEthernet, opt.Cid.HwType)
require.Equal(t, net.HardwareAddr([]byte{0, 1, 2, 3, 4, 5}), opt.Cid.LinkLayerAddr)
}
@@ -25,7 +25,7 @@ func TestOptClientIdToBytes(t *testing.T) {
opt := OptClientId{
Cid: Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{5, 4, 3, 2, 1, 0}),
},
}
@@ -58,7 +58,7 @@ func TestOptionClientId(t *testing.T) {
opt := OptClientId{
Cid: Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{0xde, 0xad, 0, 0, 0xbe, 0xef}),
},
}
diff --git a/dhcpv6/option_serverid_test.go b/dhcpv6/option_serverid_test.go
index 44f6cf4..72b1e33 100644
--- a/dhcpv6/option_serverid_test.go
+++ b/dhcpv6/option_serverid_test.go
@@ -17,7 +17,7 @@ func TestParseOptServerId(t *testing.T) {
opt, err := ParseOptServerId(data)
require.NoError(t, err)
require.Equal(t, DUID_LL, opt.Sid.Type)
- require.Equal(t, iana.HwTypeEthernet, opt.Sid.HwType)
+ require.Equal(t, iana.HWTypeEthernet, opt.Sid.HwType)
require.Equal(t, net.HardwareAddr([]byte{0, 1, 2, 3, 4, 5}), opt.Sid.LinkLayerAddr)
}
@@ -25,7 +25,7 @@ func TestOptServerIdToBytes(t *testing.T) {
opt := OptServerId{
Sid: Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{5, 4, 3, 2, 1, 0}),
},
}
@@ -58,7 +58,7 @@ func TestOptionServerId(t *testing.T) {
opt := OptServerId{
Sid: Duid{
Type: DUID_LL,
- HwType: iana.HwTypeEthernet,
+ HwType: iana.HWTypeEthernet,
LinkLayerAddr: net.HardwareAddr([]byte{0xde, 0xad, 0, 0, 0xbe, 0xef}),
},
}