Commit ac7f7eca authored by Mikio Hara's avatar Mikio Hara

net: update documentation on JoinHostPort and SplitHostPort

This change adds a reference to the Dial to clarify the parameters and
return values.

Change-Id: I611b9a79f4033ef035acd7098aea5965905d9a4c
Reviewed-on: https://go-review.googlesource.com/34880Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent d23064d0
...@@ -127,6 +127,9 @@ func ipv6only(addr IPAddr) bool { ...@@ -127,6 +127,9 @@ func ipv6only(addr IPAddr) bool {
// //
// A literal IPv6 address in hostport must be enclosed in square // A literal IPv6 address in hostport must be enclosed in square
// brackets, as in "[::1]:80", "[::1%lo0]:80". // brackets, as in "[::1]:80", "[::1%lo0]:80".
//
// See func Dial for a description of the hostport parameter, and host
// and port results.
func SplitHostPort(hostport string) (host, port string, err error) { func SplitHostPort(hostport string) (host, port string, err error) {
const ( const (
missingPort = "missing port in address" missingPort = "missing port in address"
...@@ -196,6 +199,8 @@ func splitHostZone(s string) (host, zone string) { ...@@ -196,6 +199,8 @@ func splitHostZone(s string) (host, zone string) {
// JoinHostPort combines host and port into a network address of the // JoinHostPort combines host and port into a network address of the
// form "host:port". If host contains a colon, as found in literal // form "host:port". If host contains a colon, as found in literal
// IPv6 addresses, then JoinHostPort returns "[host]:port". // IPv6 addresses, then JoinHostPort returns "[host]:port".
//
// See func Dial for a description of the host and port parameters.
func JoinHostPort(host, port string) string { func JoinHostPort(host, port string) string {
// We assume that host is a literal IPv6 address if host has // We assume that host is a literal IPv6 address if host has
// colons. // colons.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment