summaryrefslogtreecommitdiff
path: root/src/pkg/net/ip.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/ip.go')
-rw-r--r--src/pkg/net/ip.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/net/ip.go b/src/pkg/net/ip.go
index 61dc3be90..979d7acd5 100644
--- a/src/pkg/net/ip.go
+++ b/src/pkg/net/ip.go
@@ -12,8 +12,6 @@
package net
-import "os"
-
// IP address lengths (bytes).
const (
IPv4len = 4
@@ -452,6 +450,9 @@ func (n *IPNet) String() string {
return nn.String() + "/" + itod(uint(l))
}
+// Network returns the address's network name, "ip+net".
+func (n *IPNet) Network() string { return "ip+net" }
+
// Parse IPv4 address (d.d.d.d).
func parseIPv4(s string) IP {
var p [IPv4len]byte
@@ -594,7 +595,7 @@ type ParseError struct {
Text string
}
-func (e *ParseError) String() string {
+func (e *ParseError) Error() string {
return "invalid " + e.Type + ": " + e.Text
}
@@ -627,7 +628,7 @@ func ParseIP(s string) IP {
// It returns the IP address and the network implied by the IP
// and mask. For example, ParseCIDR("192.168.100.1/16") returns
// the IP address 192.168.100.1 and the network 192.168.0.0/16.
-func ParseCIDR(s string) (IP, *IPNet, os.Error) {
+func ParseCIDR(s string) (IP, *IPNet, error) {
i := byteIndex(s, '/')
if i < 0 {
return nil, nil, &ParseError{"CIDR address", s}