Documentation ¶
Index ¶
- type Addr
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetKeepAlive(d time.Duration) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (int, error)
- type Dialer
- type Listener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶ added in v0.3.4
Addr represents the address of a UTP end point.
func ResolveAddr ¶ added in v0.3.4
ResolveAddr parses addr as a UTP address of the form "host:port" or "[ipv6-host%zone]:port" and resolves a pair of domain name and port name on the network net, which must be "utp", "utp4" or "utp6". A literal address or host name for IPv6 must be enclosed in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80".
type Conn ¶ added in v0.3.4
type Conn struct {
// contains filtered or unexported fields
}
Conn is an implementation of the Conn interface for UTP network connections.
func DialUTP ¶
DialUTP connects to the remote address raddr on the network net, which must be "utp", "utp4", or "utp6". If laddr is not nil, it is used as the local address for the connection.
func DialUTPTimeout ¶
DialUTPTimeout acts like Dial but takes a timeout. The timeout includes name resolution, if required.
func (*Conn) RemoteAddr ¶ added in v0.3.4
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶ added in v0.3.4
SetDeadline implements the Conn SetDeadline method.
func (*Conn) SetKeepAlive ¶ added in v0.3.4
SetKeepAlive sets the keepalive interval associated with the connection.
func (*Conn) SetReadDeadline ¶ added in v0.3.4
SetReadDeadline implements the Conn SetReadDeadline method.
func (*Conn) SetWriteDeadline ¶ added in v0.3.4
SetWriteDeadline implements the Conn SetWriteDeadline method.
type Dialer ¶
type Dialer struct { // Timeout is the maximum amount of time a dial will wait for // a connect to complete. If Deadline is also set, it may fail // earlier. // // The default is no timeout. // // With or without a timeout, the operating system may impose // its own earlier timeout. For instance, TCP timeouts are // often around 3 minutes. Timeout time.Duration // LocalAddr is the local address to use when dialing an // address. The address must be of a compatible type for the // network being dialed. // If nil, a local address is automatically chosen. LocalAddr net.Addr }
A Dialer contains options for connecting to an address.
The zero value for each field is equivalent to dialing without that option. Dialing with the zero value of Dialer is therefore equivalent to just calling the Dial function.
type Listener ¶ added in v0.3.4
type Listener struct { // RawConn represents an out-of-band connection. // This allows a single socket to handle multiple protocols. RawConn net.PacketConn // contains filtered or unexported fields }
Listener is a UTP network listener. Clients should typically use variables of type Listener instead of assuming UTP.
func Listen ¶
Listen announces on the UTP address laddr and returns a UTP listener. Net must be "utp", "utp4", or "utp6". If laddr has a port of 0, ListenUTP will choose an available port. The caller can use the Addr method of Listener to retrieve the chosen address.
func (*Listener) Accept ¶ added in v0.3.4
Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn.
func (*Listener) AcceptUTP ¶ added in v0.3.4
AcceptUTP accepts the next incoming call and returns the new connection.