]> Cypherpunks repositories - gostls13.git/commitdiff
net: update documentation for IPConn and related stuff
authorMikio Hara <mikioh.mikioh@gmail.com>
Sun, 31 Mar 2013 07:46:59 +0000 (16:46 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Sun, 31 Mar 2013 07:46:59 +0000 (16:46 +0900)
Closes the API documentation gap between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8143044

src/pkg/net/iprawsock.go
src/pkg/net/iprawsock_plan9.go
src/pkg/net/iprawsock_posix.go

index 9d99e7591b13305004b9d6946c067b9a5b65fd50..0be94eb70eb35caa8cdc010d50c87e095e68beca 100644 (file)
@@ -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.
index 43a5eab414c332abadf8ffa391640b1b5d2286da..e62d116b817c75d7f8406b197ad17bb8cbd22439 100644 (file)
@@ -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) {
index 1bcaef9f2c31fb82f491d1bf3fcaed0b09b71a03..caeeb465383d1794755fe1569cdeebc3e19ab9c4 100644 (file)
@@ -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 {