1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 "golang.org/x/net/internal/iana"
14 "golang.org/x/net/ipv6"
18 wireHeaderFromKernel = [ipv6.HeaderLen]byte{
19 0x69, 0x8b, 0xee, 0xf1,
20 0xca, 0xfe, 0x2c, 0x01,
21 0x20, 0x01, 0x0d, 0xb8,
22 0x00, 0x01, 0x00, 0x00,
23 0x00, 0x00, 0x00, 0x00,
24 0x00, 0x00, 0x00, 0x01,
25 0x20, 0x01, 0x0d, 0xb8,
26 0x00, 0x02, 0x00, 0x00,
27 0x00, 0x00, 0x00, 0x00,
28 0x00, 0x00, 0x00, 0x01,
31 testHeader = &ipv6.Header{
32 Version: ipv6.Version,
33 TrafficClass: iana.DiffServAF43,
36 NextHeader: iana.ProtocolIPv6Frag,
38 Src: net.ParseIP("2001:db8:1::1"),
39 Dst: net.ParseIP("2001:db8:2::1"),
43 func TestParseHeader(t *testing.T) {
44 h, err := ipv6.ParseHeader(wireHeaderFromKernel[:])
48 if !reflect.DeepEqual(h, testHeader) {
49 t.Fatalf("got %#v; want %#v", h, testHeader)
52 if strings.Contains(s, ",") {
53 t.Fatalf("should be space-separated values: %s", s)