Fix the function documentation
This commit is contained in:
parent
20ddea5ac9
commit
892588a93c
8
udp.go
8
udp.go
|
@ -33,7 +33,6 @@ func setUDPSocketOptions(conn *net.UDPConn) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
setUDPSocketOptions6(conn)
|
setUDPSocketOptions6(conn)
|
||||||
|
|
||||||
if v6only == 0 {
|
if v6only == 0 {
|
||||||
setUDPSocketOptions4(conn)
|
setUDPSocketOptions4(conn)
|
||||||
}
|
}
|
||||||
|
@ -43,20 +42,19 @@ func setUDPSocketOptions(conn *net.UDPConn) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// readFromSessionUDP ... Just like net.UDPConn.ReadFrom(), but returns a session object instead of net.UDPAddr
|
// readFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
|
||||||
// (RemoteAddr() is available from the UDPSession object)
|
// net.UDPAddr.
|
||||||
func readFromSessionUDP(conn *net.UDPConn, b []byte) (int, *sessionUDP, error) {
|
func readFromSessionUDP(conn *net.UDPConn, b []byte) (int, *sessionUDP, error) {
|
||||||
oob := make([]byte, 40)
|
oob := make([]byte, 40)
|
||||||
n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob)
|
n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, nil, err
|
return n, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
session := &sessionUDP{raddr, oob[:oobn]}
|
session := &sessionUDP{raddr, oob[:oobn]}
|
||||||
return n, session, err
|
return n, session, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeToSessionUDP Just like net.UDPConn.WritetTo(), but uses a session object instead of net.Addr
|
// writeToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *sessionUDP instead of a net.Addr.
|
||||||
func writeToSessionUDP(conn *net.UDPConn, b []byte, session *sessionUDP) (int, error) {
|
func writeToSessionUDP(conn *net.UDPConn, b []byte, session *sessionUDP) (int, error) {
|
||||||
n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr)
|
n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr)
|
||||||
return n, err
|
return n, err
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// These actually do nothing. See udp_linux.go for an example of how to implement this.
|
// These do nothing. See udp_linux.go for an example of how to implement this.
|
||||||
|
|
||||||
func setUDPSocketOptions4(conn *net.UDPConn) error { return nil }
|
func setUDPSocketOptions4(conn *net.UDPConn) error { return nil }
|
||||||
func setUDPSocketOptions6(conn *net.UDPConn) error { return nil }
|
func setUDPSocketOptions6(conn *net.UDPConn) error { return nil }
|
||||||
|
|
Loading…
Reference in New Issue