yquic

package
v1.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package yquic provides a quic implementation of yomo.FrameConn.

Index

Constants

View Source
const YomoCloseErrorCode = quic.ApplicationErrorCode(0x13)

YomoCloseErrorCode is the error code for close quic Connection for yomo. If the Connection implemented by quic is closed, the quic ApplicationErrorCode is always 0x13.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrameConn

type FrameConn struct {
	// contains filtered or unexported fields
}

FrameConn is an implements of FrameConn, It transmits frames upon the first stream from a QUIC connection.

func DialAddr

func DialAddr(
	ctx context.Context,
	addr string,
	codec frame.Codec, prw frame.PacketReadWriter,
	tlsConfig *tls.Config, quicConfig *quic.Config,
) (*FrameConn, error)

DialAddr dials the given address and returns a new FrameConn.

func (*FrameConn) CloseWithError

func (p *FrameConn) CloseWithError(errString string) error

CloseWithError closes the connection. After calling CloseWithError, ReadFrame and WriteFrame will return frame.ErrConnClosed error.

func (*FrameConn) Context

func (p *FrameConn) Context() context.Context

Context returns the context of the connection.

func (*FrameConn) LocalAddr

func (p *FrameConn) LocalAddr() net.Addr

LocalAddr returns the local address of connection.

func (*FrameConn) ReadFrame

func (p *FrameConn) ReadFrame() (frame.Frame, error)

ReadFrame reads a frame. it usually be called in a for-loop.

func (*FrameConn) RemoteAddr

func (p *FrameConn) RemoteAddr() net.Addr

RemoteAddr returns the remote address of connection.

func (*FrameConn) WriteFrame

func (p *FrameConn) WriteFrame(f frame.Frame) error

WriteFrame writes a frame to connection.

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener listens a net.PacketConn and accepts connections.

func Listen

func Listen(
	conn net.PacketConn,
	codec frame.Codec, prw frame.PacketReadWriter,
	tlsConfig *tls.Config, quicConfig *quic.Config,
) (*Listener, error)

Listen returns a quic Listener that can accept connections.

func ListenAddr

func ListenAddr(
	addr string,
	codec frame.Codec, prw frame.PacketReadWriter,
	tlsConfig *tls.Config, quicConfig *quic.Config,
) (*Listener, error)

ListenAddr listens an address and returns a new Listener.

func (*Listener) Accept

func (listener *Listener) Accept(ctx context.Context) (frame.Conn, error)

Accept accepts FrameConns.

func (*Listener) Close

func (listener *Listener) Close() error

Close closes listener. If listener be closed, all connection receive quic application error that code=0, message="".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL