mem

package
v1.19.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mem provides a memory implementation of yomo.FrameConn.

Index

Constants

This section is empty.

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 golang channel.

func NewFrameConn

func NewFrameConn(ctx context.Context) *FrameConn

NewFrameConn creates FrameConn from read write channel.

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) Handshake

func (p *FrameConn) Handshake(hf *frame.HandshakeFrame) error

Handshake sends a HandshakeFrame to the connection. This function should be called before ReadFrame or WriteFrame.

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() *Listener

Listen returns a Listener that can accept connections.

func (*Listener) Accept

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

Accept accepts FrameConns.

func (*Listener) Close

func (l *Listener) Close() error

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

func (*Listener) Dial

func (l *Listener) Dial() (*FrameConn, error)

Jump to

Keyboard shortcuts

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