net, cmd/fix: add IPv6 scoped addressing zone to INET, INET6 address structs

This CL starts to introduce IPv6 scoped addressing capability
into the net package.

The Public API changes are:
+pkg net, type IPAddr struct, Zone string
+pkg net, type IPNet struct, Zone string
+pkg net, type TCPAddr struct, Zone string
+pkg net, type UDPAddr struct, Zone string

Update #4234.

R=rsc, bradfitz, iant
CC=golang-dev
https://golang.org/cl/6849045
This commit is contained in:
Mikio Hara 2012-11-27 00:45:42 +09:00
parent f02cf1997d
commit e8cf49f701
16 changed files with 259 additions and 117 deletions

View file

@ -36,6 +36,7 @@ type IPMask []byte
type IPNet struct {
IP IP // network number
Mask IPMask // network mask
Zone string // IPv6 scoped addressing zone
}
// IPv4 returns the IP address (in 16-byte form) of the
@ -645,5 +646,5 @@ func ParseCIDR(s string) (IP, *IPNet, error) {
return nil, nil, &ParseError{"CIDR address", s}
}
m := CIDRMask(n, 8*iplen)
return ip, &IPNet{ip.Mask(m), m}, nil
return ip, &IPNet{IP: ip.Mask(m), Mask: m}, nil
}