From: Mikio Hara Date: Sun, 31 Mar 2013 07:46:59 +0000 (+0900) Subject: net: update documentation for IPConn and related stuff X-Git-Tag: go1.1rc2~249 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=32f88f4ea1f09cc02554071a9c2c42f6e2a83da8;p=gostls13.git net: update documentation for IPConn and related stuff Closes the API documentation gap between platforms. R=golang-dev, r CC=golang-dev https://golang.org/cl/8143044 --- diff --git a/src/pkg/net/iprawsock.go b/src/pkg/net/iprawsock.go index 9d99e7591b..0be94eb70e 100644 --- a/src/pkg/net/iprawsock.go +++ b/src/pkg/net/iprawsock.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Raw IP sockets - package net // IPAddr represents the address of an IP end point. diff --git a/src/pkg/net/iprawsock_plan9.go b/src/pkg/net/iprawsock_plan9.go index 43a5eab414..e62d116b81 100644 --- a/src/pkg/net/iprawsock_plan9.go +++ b/src/pkg/net/iprawsock_plan9.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Raw IP sockets for Plan 9 - package net import ( @@ -76,7 +74,7 @@ func dialIP(netProto string, laddr, raddr *IPAddr, deadline time.Time) (*IPConn, } // ListenIP listens for incoming IP packets addressed to the local -// address laddr. The returned connection c's ReadFrom and WriteTo +// address laddr. The returned connection's ReadFrom and WriteTo // methods can be used to receive and send IP packets with per-packet // addressing. func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error) { diff --git a/src/pkg/net/iprawsock_posix.go b/src/pkg/net/iprawsock_posix.go index 1bcaef9f2c..caeeb46538 100644 --- a/src/pkg/net/iprawsock_posix.go +++ b/src/pkg/net/iprawsock_posix.go @@ -4,8 +4,6 @@ // +build darwin freebsd linux netbsd openbsd windows -// Raw IP sockets for POSIX - package net import ( @@ -51,8 +49,8 @@ func (a *IPAddr) toAddr() sockaddr { return a } -// IPConn is the implementation of the Conn and PacketConn -// interfaces for IP network connections. +// IPConn is the implementation of the Conn and PacketConn interfaces +// for IP network connections. type IPConn struct { conn } @@ -116,12 +114,13 @@ func (c *IPConn) ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err return } -// WriteToIP writes an IP packet to addr via c, copying the payload from b. +// WriteToIP writes an IP packet to addr via c, copying the payload +// from b. // -// WriteToIP can be made to time out and return -// an error with Timeout() == true after a fixed time limit; -// see SetDeadline and SetWriteDeadline. -// On packet-oriented connections, write timeouts are rare. +// WriteToIP can be made to time out and return an error with +// Timeout() == true after a fixed time limit; see SetDeadline and +// SetWriteDeadline. On packet-oriented connections, write timeouts +// are rare. func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error) { if !c.ok() { return 0, syscall.EINVAL @@ -159,8 +158,9 @@ func (c *IPConn) WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error return c.fd.WriteMsg(b, oob, sa) } -// DialIP connects to the remote address raddr on the network protocol netProto, -// which must be "ip", "ip4", or "ip6" followed by a colon and a protocol number or name. +// DialIP connects to the remote address raddr on the network protocol +// netProto, which must be "ip", "ip4", or "ip6" followed by a colon +// and a protocol number or name. func DialIP(netProto string, laddr, raddr *IPAddr) (*IPConn, error) { return dialIP(netProto, laddr, raddr, noDeadline) } @@ -185,10 +185,10 @@ func dialIP(netProto string, laddr, raddr *IPAddr, deadline time.Time) (*IPConn, return newIPConn(fd), nil } -// ListenIP listens for incoming IP packets addressed to the -// local address laddr. The returned connection c's ReadFrom -// and WriteTo methods can be used to receive and send IP -// packets with per-packet addressing. +// ListenIP listens for incoming IP packets addressed to the local +// address laddr. The returned connection's ReadFrom and WriteTo +// methods can be used to receive and send IP packets with per-packet +// addressing. func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error) { net, proto, err := parseNetwork(netProto) if err != nil {