@@ -542,12 +542,18 @@ func dialSingle(ctx context.Context, dp *dialParam, ra Addr) (c Conn, err error)
542542}
543543
544544// Listen announces on the local network address laddr.
545+ //
545546// The network net must be a stream-oriented network: "tcp", "tcp4",
546547// "tcp6", "unix" or "unixpacket".
547- // For TCP and UDP, the syntax of laddr is "host:port", like "127.0.0.1:8080".
548+ //
549+ // For TCP, the syntax of laddr is "host:port", like "127.0.0.1:8080".
548550// If host is omitted, as in ":8080", Listen listens on all available interfaces
549551// instead of just the interface with the given host address.
550- // See Dial for more details about address syntax.
552+ // Listening on network "tcp" with host "0.0.0.0" or "[::]" may listen on both
553+ // IPv4 and IPv6. To only use IPv4, use network "tcp4". To explicitly use both,
554+ // listen on ":port" without a host.
555+ //
556+ // See Dial for more details about the address syntax.
551557//
552558// Listening on a hostname is not recommended because this creates a socket
553559// for at most one of its IP addresses.
@@ -572,12 +578,18 @@ func Listen(net, laddr string) (Listener, error) {
572578}
573579
574580// ListenPacket announces on the local network address laddr.
581+ //
575582// The network net must be a packet-oriented network: "udp", "udp4",
576583// "udp6", "ip", "ip4", "ip6" or "unixgram".
577- // For TCP and UDP, the syntax of laddr is "host:port", like "127.0.0.1:8080".
578- // If host is omitted, as in ":8080", ListenPacket listens on all available interfaces
579- // instead of just the interface with the given host address.
580- // See Dial for the syntax of laddr.
584+ //
585+ // For UDP, the syntax of laddr is "host:port", like "127.0.0.1:8080".
586+ // If host is omitted, as in ":8080", ListenPacket listens on all available
587+ // interfaces instead of just the interface with the given host address.
588+ // Listening on network "udp" with host "0.0.0.0" or "[::]" may listen on both
589+ // IPv4 and IPv6. To only use IPv4, use network "udp4". To explicitly use both,
590+ // listen on ":port" without a host.
591+ //
592+ // See Dial for more details about the address syntax.
581593//
582594// Listening on a hostname is not recommended because this creates a socket
583595// for at most one of its IP addresses.
0 commit comments