summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6.go
diff options
context:
space:
mode:
authorChristopher Koch <chrisko@google.com>2019-02-28 13:44:56 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2019-03-11 21:54:10 -0700
commit5073ba65eb176fae79fdca21f28728a0c2c4ca19 (patch)
treed617173503f875ab6294ce870a93ac7a9b56c2f6 /dhcpv6/dhcpv6.go
parent5859695ac2f7e59f6a7de0a0353aa1e1f19aa6aa (diff)
dhcpv6: rename stuttering types.
dhcpv6.DHCPv6Message -> dhcpv6.Message dhcpv6.DHCPv6Relay -> dhcpv6.RelayMessage
Diffstat (limited to 'dhcpv6/dhcpv6.go')
-rw-r--r--dhcpv6/dhcpv6.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/dhcpv6/dhcpv6.go b/dhcpv6/dhcpv6.go
index 7eaf621..79ae299 100644
--- a/dhcpv6/dhcpv6.go
+++ b/dhcpv6/dhcpv6.go
@@ -33,7 +33,7 @@ func FromBytes(data []byte) (DHCPv6, error) {
messageType := MessageType(buf.Read8())
if messageType == MessageTypeRelayForward || messageType == MessageTypeRelayReply {
- d := DHCPv6Relay{
+ d := RelayMessage{
messageType: messageType,
hopCount: buf.Read8(),
}
@@ -46,7 +46,7 @@ func FromBytes(data []byte) (DHCPv6, error) {
}
return &d, nil
} else {
- d := DHCPv6Message{
+ d := Message{
messageType: messageType,
}
buf.ReadBytes(d.transactionID[:])
@@ -63,7 +63,7 @@ func NewMessage(modifiers ...Modifier) (DHCPv6, error) {
if err != nil {
return nil, err
}
- msg := DHCPv6Message{
+ msg := Message{
messageType: MessageTypeSolicit,
transactionID: tid,
}
@@ -125,20 +125,20 @@ func DecapsulateRelayIndex(l DHCPv6, index int) (DHCPv6, error) {
return l, nil
}
-// EncapsulateRelay creates a DHCPv6Relay message containing the passed DHCPv6
+// EncapsulateRelay creates a RelayMessage message containing the passed DHCPv6
// message as payload. The passed message type must be either RELAY_FORW or
// RELAY_REPL
func EncapsulateRelay(d DHCPv6, mType MessageType, linkAddr, peerAddr net.IP) (DHCPv6, error) {
if mType != MessageTypeRelayForward && mType != MessageTypeRelayReply {
return nil, fmt.Errorf("Message type must be either RELAY_FORW or RELAY_REPL")
}
- outer := DHCPv6Relay{
+ outer := RelayMessage{
messageType: mType,
linkAddr: linkAddr,
peerAddr: peerAddr,
}
if d.IsRelay() {
- relay := d.(*DHCPv6Relay)
+ relay := d.(*RelayMessage)
outer.hopCount = relay.hopCount + 1
} else {
outer.hopCount = 0
@@ -189,10 +189,10 @@ func IsUsingUEFI(msg DHCPv6) bool {
// GetTransactionID returns a transactionID of a message or its inner message
// in case of relay
func GetTransactionID(packet DHCPv6) (TransactionID, error) {
- if message, ok := packet.(*DHCPv6Message); ok {
+ if message, ok := packet.(*Message); ok {
return message.TransactionID(), nil
}
- if relay, ok := packet.(*DHCPv6Relay); ok {
+ if relay, ok := packet.(*RelayMessage); ok {
message, err := relay.GetInnerMessage()
if err != nil {
return TransactionID{0, 0, 0}, err