go.net/ipv6: simplify protocol constants generator
Also updates IANA protocol constants.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/14587043
diff --git a/ipv6/gen.go b/ipv6/gen.go
index 36517b2..5680bac 100644
--- a/ipv6/gen.go
+++ b/ipv6/gen.go
@@ -97,20 +97,16 @@
}
type icmpv6Parameters struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Registries []icmpv6ParamRegistry `xml:"registry"`
-}
-
-type icmpv6ParamRegistry struct {
- Title string `xml:"title"`
- Records []icmpv6ParamRecord `xml:"record"`
-}
-
-type icmpv6ParamRecord struct {
- Value string `xml:"value"`
- Name string `xml:"name"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Registries []struct {
+ Title string `xml:"title"`
+ Records []struct {
+ Value string `xml:"value"`
+ Name string `xml:"name"`
+ } `xml:"record"`
+ } `xml:"registry"`
}
type canonICMPv6ParamRecord struct {
@@ -188,18 +184,16 @@
}
type protocolNumbers struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- RegTitle string `xml:"registry>title"`
- Note string `xml:"registry>note"`
- Records []protocolRecord `xml:"registry>record"`
-}
-
-type protocolRecord struct {
- Value string `xml:"value"`
- Name string `xml:"name"`
- Descr string `xml:"description"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ RegTitle string `xml:"registry>title"`
+ Note string `xml:"registry>note"`
+ Records []struct {
+ Value string `xml:"value"`
+ Name string `xml:"name"`
+ Descr string `xml:"description"`
+ } `xml:"registry>record"`
}
type canonProtocolRecord struct {
diff --git a/ipv6/gentest.go b/ipv6/gentest.go
index fddbfd1..606930f 100644
--- a/ipv6/gentest.go
+++ b/ipv6/gentest.go
@@ -39,7 +39,7 @@
func main() {
var bb bytes.Buffer
- fmt.Fprintf(&bb, "// go run gentv.go\n")
+ fmt.Fprintf(&bb, "// go run gentest.go\n")
fmt.Fprintf(&bb, "// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT\n\n")
fmt.Fprintf(&bb, "package ipv6_test\n\n")
for _, r := range registries {
@@ -85,18 +85,19 @@
}
type dscpRegistry struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Note string `xml:"note"`
- RegTitle string `xml:"registry>title"`
- PoolRecords []dscpRecord `xml:"registry>record"`
- Records []dscpRecord `xml:"registry>registry>record"`
-}
-
-type dscpRecord struct {
- Name string `xml:"name"`
- Space string `xml:"space"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Note string `xml:"note"`
+ RegTitle string `xml:"registry>title"`
+ PoolRecords []struct {
+ Name string `xml:"name"`
+ Space string `xml:"space"`
+ } `xml:"registry>record"`
+ Records []struct {
+ Name string `xml:"name"`
+ Space string `xml:"space"`
+ } `xml:"registry>registry>record"`
}
type canonDSCPRecord struct {
@@ -145,17 +146,15 @@
}
type tosTCByte struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Note string `xml:"note"`
- RegTitle string `xml:"registry>title"`
- Records []tosTCByteRecord `xml:"registry>record"`
-}
-
-type tosTCByteRecord struct {
- Binary string `xml:"binary"`
- Keyword string `xml:"keyword"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Note string `xml:"note"`
+ RegTitle string `xml:"registry>title"`
+ Records []struct {
+ Binary string `xml:"binary"`
+ Keyword string `xml:"keyword"`
+ } `xml:"registry>record"`
}
type canonTOSTCByteRecord struct {
diff --git a/ipv6/iana.go b/ipv6/iana.go
index c888cf2..429087c 100644
--- a/ipv6/iana.go
+++ b/ipv6/iana.go
@@ -3,7 +3,7 @@
package ipv6
-// Internet Control Message Protocol version 6 (ICMPv6) Parameters, Updated: 2012-11-12
+// Internet Control Message Protocol version 6 (ICMPv6) Parameters, Updated: 2013-07-03
const (
ICMPTypeDestinationUnreachable ICMPType = 1 // Destination Unreachable
ICMPTypePacketTooBig ICMPType = 2 // Packet Too Big
@@ -41,7 +41,7 @@
ICMPTypeDuplicateAddressConfirmation ICMPType = 158 // Duplicate Address Confirmation
)
-// Internet Control Message Protocol version 6 (ICMPv6) Parameters, Updated: 2012-11-12
+// Internet Control Message Protocol version 6 (ICMPv6) Parameters, Updated: 2013-07-03
var icmpTypes = map[ICMPType]string{
1: "destination unreachable",
2: "packet too big",
diff --git a/ipv6/iana_test.go b/ipv6/iana_test.go
index 7b6bb85..03e8bfe 100644
--- a/ipv6/iana_test.go
+++ b/ipv6/iana_test.go
@@ -1,9 +1,9 @@
-// go run gentv.go
+// go run gentest.go
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package ipv6_test
-// Differentiated Services Field Codepoints, Updated: 2010-05-11
+// Differentiated Services Field Codepoints (DSCP), Updated: 2013-06-25
const (
DiffServCS0 = 0x0 // CS0
DiffServCS1 = 0x20 // CS1