Documentation
¶
Index ¶
- Variables
- func Dial(addr string, tlsConfig *tls.Config, quicConfig *quic.Config) (net.Conn, error)
- func DialContext(ctx context.Context, addr string, tlsConfig *tls.Config, ...) (net.Conn, error)
- func Listen(network, laddr string, tlsConfig *tls.Config, quicConfig *quic.Config) (net.Listener, error)
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) CloseConn() 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) SetReadBuffer(bytes int) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteBuffer(bytes int) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) SyscallConn() (syscall.RawConn, error)
- func (c *Conn) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var StreamAcceptTimeout = 30 * time.Second
StreamAcceptTimeout bounds how long AcceptContext waits for a newly accepted connection to open its first stream. When it expires the connection is closed with a NO_ERROR code and AcceptContext keeps waiting for the next peer, so a client that never opens a stream cannot stall the listener. A zero or negative value disables the timeout. The value is read once when a listener is created; later changes only affect listeners created afterwards.
Functions ¶
func Dial ¶
Dial creates a new QUIC connection it returns once the connection is established and secured with forward-secure keys
func DialContext ¶
func DialContext(ctx context.Context, addr string, tlsConfig *tls.Config, quicConfig *quic.Config) (net.Conn, error)
DialContext creates a new QUIC connection with a context. The returned net.Conn owns its UDP socket; Close releases all resources associated with the connection, including the socket.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a generic quic connection implements net.Conn.
func (*Conn) Close ¶
Close closes the stream, sending a FIN to the peer. Data written before Close is still delivered, mirroring the semantics of closing a TCP connection. The QUIC connection itself stays alive until the peer closes it or the idle timeout expires; on the client side the owned UDP socket is released as soon as the QUIC connection ends. It is safe to call Close multiple times; subsequent calls return the result of the first one.
func (*Conn) CloseConn ¶
CloseConn immediately terminates the QUIC connection with a NO_ERROR code and closes the owned UDP socket on the client side. Unlike Close, data written but not yet transmitted to the network is discarded. It is safe to call CloseConn multiple times.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines for the QUIC stream. A zero time value disables the deadline.
func (*Conn) SetReadBuffer ¶
SetReadBuffer sets the size of the operating system's receive buffer associated with the connection. On the server side the buffer is shared by all connections served by the same listener.
func (*Conn) SetReadDeadline ¶
SetReadDeadline implements the Conn SetReadDeadline method.
func (*Conn) SetWriteBuffer ¶
SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection. On the server side the buffer is shared by all connections served by the same listener.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline implements the Conn SetWriteDeadline method.
func (*Conn) SyscallConn ¶
SyscallConn returns a raw network connection. This implements the syscall.Conn interface.