Documentation ¶
Overview ¶
Package dst implements the Datagram Stream Transfer protocol.
DST is a way to get reliable stream connections (like TCP) on top of UDP.
Index ¶
- Variables
- func SetLogger(l *logger.Logger)
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) GetStatistics() Statistics
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) String() string
- func (c *Conn) Write(b []byte) (n int, err error)
- type Error
- type Mux
- type Statistics
- Bugs
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is an SDT connection carried over a Mux.
func (*Conn) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*Conn) GetStatistics ¶
func (c *Conn) GetStatistics() Statistics
GetStatistics returns a snapsht of the current connection statistics.
func (*Conn) Read ¶
Read reads data from the connection. Read can be made to time out and return a Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future I/O, not just the immediately following call to Read or Write.
An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out.
BUG(jb): SetDeadline is not implemented.
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
BUG(jb): SetReadDeadline is not implemented.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
BUG(jb): SetWriteDeadline is not implemented.
type Error ¶
type Error struct {
Err string
}
Error represents the various dst-internal error conditions.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a UDP multiplexer of DST connections.
func NewMux ¶
func NewMux(conn net.PacketConn, packetSize int) *Mux
NewMux creates a new DST Mux on top of a packet connection.
func (*Mux) Close ¶
Close closes the listener. Any blocked Accept operations will be unblocked and return errors.
func (*Mux) Dial ¶
Dial connects to the address on the named network.
Network must be "dst".
Addresses have the form host:port. If host is a literal IPv6 address or host name, it must be enclosed in square brackets as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80". The functions JoinHostPort and SplitHostPort manipulate addresses in this form.
Examples:
Dial("dst", "12.34.56.78:80") Dial("dst", "google.com:http") Dial("dst", "[2001:db8::1]:http") Dial("dst", "[fe80::1%lo0]:80")
func (*Mux) DialDST ¶
Dial connects to the address on the named network.
Network must be "dst".
Addresses have the form host:port. If host is a literal IPv6 address or host name, it must be enclosed in square brackets as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80". The functions JoinHostPort and SplitHostPort manipulate addresses in this form.
Examples:
Dial("dst", "12.34.56.78:80") Dial("dst", "google.com:http") Dial("dst", "[2001:db8::1]:http") Dial("dst", "[fe80::1%lo0]:80")
type Statistics ¶
type Statistics struct { DataPacketsIn int64 DataPacketsOut int64 DataBytesIn int64 DataBytesOut int64 ResentPackets int64 DroppedPackets int64 OutOfOrderPackets int64 }
func (Statistics) String ¶
func (s Statistics) String() string
String returns a printable represetnation of the Statistics.
Notes ¶
Bugs ¶
SetDeadline is not implemented.
SetReadDeadline is not implemented.
SetWriteDeadline is not implemented.