diff options
author | Christopher Koch <chrisko@google.com> | 2018-12-29 11:29:25 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-14 23:19:04 +0000 |
commit | 833f274e1aca3b23320f6d31c246c73eefd38974 (patch) | |
tree | a25fab2a0597398262bc419a26ff2ffa058388a9 /iana | |
parent | 75d26a6410980df90d3a9d224956cfe5ed35a07f (diff) |
iana: rename HwTypeType to HWType, add package comment.
Diffstat (limited to 'iana')
-rw-r--r-- | iana/hwtypes.go | 155 | ||||
-rw-r--r-- | iana/iana.go | 2 | ||||
-rw-r--r-- | iana/statuscodes.go | 9 |
3 files changed, 85 insertions, 81 deletions
diff --git a/iana/hwtypes.go b/iana/hwtypes.go index 075cded..bbb3188 100644 --- a/iana/hwtypes.go +++ b/iana/hwtypes.go @@ -1,88 +1,91 @@ package iana -type HwTypeType uint8 +// HWType is a hardware type as per RFC 2132 and defined by the IANA. +type HWType uint8 +// See IANA for values. const ( - _ HwTypeType = iota // skip 0 - HwTypeEthernet - HwTypeExperimentalEthernet - HwTypeAmateurRadioAX25 - HwTypeProteonTokenRing - HwTypeChaos - HwTypeIEEE802 - HwTypeARCNET - HwTypeHyperchannel - HwTypeLanstar - HwTypeAutonet - HwTypeLocalTalk - HwTypeLocalNet - HwTypeUltraLink - HwTypeSMDS - HwTypeFrameRelay - HwTypeATM - HwTypeHDLC - HwTypeFibreChannel - HwTypeATM2 - HwTypeSerialLine - HwTypeATM3 - HwTypeMILSTD188220 - HwTypeMetricom - HwTypeIEEE1394 - HwTypeMAPOS - HwTypeTwinaxial - HwTypeEUI64 - HwTypeHIPARP - HwTypeISO7816 - HwTypeARPSec - HwTypeIPsec - HwTypeInfiniband - HwTypeCAI - HwTypeWiegandInterface - HwTypePureIP + _ HWType = iota // skip 0 + HWTypeEthernet + HWTypeExperimentalEthernet + HWTypeAmateurRadioAX25 + HWTypeProteonTokenRing + HWTypeChaos + HWTypeIEEE802 + HWTypeARCNET + HWTypeHyperchannel + HWTypeLanstar + HWTypeAutonet + HWTypeLocalTalk + HWTypeLocalNet + HWTypeUltraLink + HWTypeSMDS + HWTypeFrameRelay + HWTypeATM + HWTypeHDLC + HWTypeFibreChannel + HWTypeATM2 + HWTypeSerialLine + HWTypeATM3 + HWTypeMILSTD188220 + HWTypeMetricom + HWTypeIEEE1394 + HWTypeMAPOS + HWTypeTwinaxial + HWTypeEUI64 + HWTypeHIPARP + HWTypeISO7816 + HWTypeARPSec + HWTypeIPsec + HWTypeInfiniband + HWTypeCAI + HWTypeWiegandInterface + HWTypePureIP ) -var HwTypeToString = map[HwTypeType]string{ - HwTypeEthernet: "Ethernet", - HwTypeExperimentalEthernet: "Experimental Ethernet", - HwTypeAmateurRadioAX25: "Amateur Radio AX.25", - HwTypeProteonTokenRing: "Proteon ProNET Token Ring", - HwTypeChaos: "Chaos", - HwTypeIEEE802: "IEEE 802", - HwTypeARCNET: "ARCNET", - HwTypeHyperchannel: "Hyperchannel", - HwTypeLanstar: "Lanstar", - HwTypeAutonet: "Autonet Short Address", - HwTypeLocalTalk: "LocalTalk", - HwTypeLocalNet: "LocalNet", - HwTypeUltraLink: "Ultra link", - HwTypeSMDS: "SMDS", - HwTypeFrameRelay: "Frame Relay", - HwTypeATM: "ATM", - HwTypeHDLC: "HDLC", - HwTypeFibreChannel: "Fibre Channel", - HwTypeATM2: "ATM 2", - HwTypeSerialLine: "Serial Line", - HwTypeATM3: "ATM 3", - HwTypeMILSTD188220: "MIL-STD-188-220", - HwTypeMetricom: "Metricom", - HwTypeIEEE1394: "IEEE 1394.1995", - HwTypeMAPOS: "MAPOS", - HwTypeTwinaxial: "Twinaxial", - HwTypeEUI64: "EUI-64", - HwTypeHIPARP: "HIPARP", - HwTypeISO7816: "IP and ARP over ISO 7816-3", - HwTypeARPSec: "ARPSec", - HwTypeIPsec: "IPsec tunnel", - HwTypeInfiniband: "Infiniband", - HwTypeCAI: "CAI, TIA-102 Project 125 Common Air Interface", - HwTypeWiegandInterface: "Wiegand Interface", - HwTypePureIP: "Pure IP", +var hwTypeToString = map[HWType]string{ + HWTypeEthernet: "Ethernet", + HWTypeExperimentalEthernet: "Experimental Ethernet", + HWTypeAmateurRadioAX25: "Amateur Radio AX.25", + HWTypeProteonTokenRing: "Proteon ProNET Token Ring", + HWTypeChaos: "Chaos", + HWTypeIEEE802: "IEEE 802", + HWTypeARCNET: "ARCNET", + HWTypeHyperchannel: "Hyperchannel", + HWTypeLanstar: "Lanstar", + HWTypeAutonet: "Autonet Short Address", + HWTypeLocalTalk: "LocalTalk", + HWTypeLocalNet: "LocalNet", + HWTypeUltraLink: "Ultra link", + HWTypeSMDS: "SMDS", + HWTypeFrameRelay: "Frame Relay", + HWTypeATM: "ATM", + HWTypeHDLC: "HDLC", + HWTypeFibreChannel: "Fibre Channel", + HWTypeATM2: "ATM 2", + HWTypeSerialLine: "Serial Line", + HWTypeATM3: "ATM 3", + HWTypeMILSTD188220: "MIL-STD-188-220", + HWTypeMetricom: "Metricom", + HWTypeIEEE1394: "IEEE 1394.1995", + HWTypeMAPOS: "MAPOS", + HWTypeTwinaxial: "Twinaxial", + HWTypeEUI64: "EUI-64", + HWTypeHIPARP: "HIPARP", + HWTypeISO7816: "IP and ARP over ISO 7816-3", + HWTypeARPSec: "ARPSec", + HWTypeIPsec: "IPsec tunnel", + HWTypeInfiniband: "Infiniband", + HWTypeCAI: "CAI, TIA-102 Project 125 Common Air Interface", + HWTypeWiegandInterface: "Wiegand Interface", + HWTypePureIP: "Pure IP", } -func (h HwTypeType) String() string { - hwtype := HwTypeToString[h] +// String implements fmt.Stringer. +func (h HWType) String() string { + hwtype := hwTypeToString[h] if hwtype == "" { - hwtype = "Invalid" + hwtype = "unknown" } return hwtype } diff --git a/iana/iana.go b/iana/iana.go new file mode 100644 index 0000000..e0d5956 --- /dev/null +++ b/iana/iana.go @@ -0,0 +1,2 @@ +// Package iana contains constants defined by IANA. +package iana diff --git a/iana/statuscodes.go b/iana/statuscodes.go index f61f99e..ee45820 100644 --- a/iana/statuscodes.go +++ b/iana/statuscodes.go @@ -1,9 +1,9 @@ package iana +// StatusCode represents a IANA status code for DHCPv6 +// // IANA Status Codes for DHCPv6 // https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#dhcpv6-parameters-5 - -// StatusCode represents a IANA status code for DHCPv6 type StatusCode uint16 // IANA status codes @@ -40,14 +40,13 @@ const ( // String returns a mnemonic name for a given status code func (s StatusCode) String() string { - if sc := StatusCodeToStringMap[s]; sc != "" { + if sc := statusCodeToStringMap[s]; sc != "" { return sc } return "Unknown" } -// StatusCodeToStringMap maps status codes to their names -var StatusCodeToStringMap = map[StatusCode]string{ +var statusCodeToStringMap = map[StatusCode]string{ StatusSuccess: "Success", StatusUnspecFail: "UnspecFail", StatusNoAddrsAvail: "NoAddrsAvail", |