]> Cypherpunks repositories - gostls13.git/commitdiff
net: add examples to Addr definition
authorRuss Cox <rsc@golang.org>
Thu, 27 Oct 2016 00:05:20 +0000 (20:05 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 27 Oct 2016 17:55:58 +0000 (17:55 +0000)
Fixes #16014.

Change-Id: I68b096df7924a3258e940c4d94ec5d06f5bdfcbb
Reviewed-on: https://go-review.googlesource.com/32097
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/net.go

index 6198d94a14db21644d6028fdd54005a69b1ccde0..b9a78266b56383f401ea3efce46d0fa272ecf85a 100644 (file)
@@ -102,9 +102,13 @@ func init() {
 }
 
 // Addr represents a network end point address.
+//
+// The two methods Network and String conventionally return strings
+// that can be passed as the arguments to Dial, but the exact form
+// and meaning of the strings is up to the implementation.
 type Addr interface {
-       Network() string // name of the network
-       String() string  // string form of address
+       Network() string // name of the network (for example, "tcp", "udp")
+       String() string  // string form of address (for example, "127.0.0.1:25", "[2001:db8::1]:80")
 }
 
 // Conn is a generic stream-oriented network connection.