common

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package common contains things shared by client and server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialURL

func DialURL(u *url.URL, ctx context.Context, dialFn func(ctx context.Context, network, address string) (net.Conn, error)) (net.Conn, error)

func GenerateTLSConfig

func GenerateTLSConfig() *tls.Config

Setup a bare-bones TLS config for the server

Types

type QuicConn

type QuicConn struct {
	Stream *quic.Stream
	Conn   *quic.Conn
}

QuicConn wraps a conn and a single stream and implements net.Conn

func NewQuicConn

func NewQuicConn(conn *quic.Conn, stream *quic.Stream) *QuicConn

NewQuicConn creates a new QuicConn with the provided connection and stream. Both conn and stream must be non-nil.

func (*QuicConn) Close

func (q *QuicConn) Close() error

Close implements net.Conn; all streams are closed.

func (*QuicConn) LocalAddr

func (q *QuicConn) LocalAddr() net.Addr

LocalAddr implements net.Conn

func (*QuicConn) Read

func (q *QuicConn) Read(b []byte) (n int, err error)

Read implements net.Conn

func (*QuicConn) RemoteAddr

func (q *QuicConn) RemoteAddr() net.Addr

RemoteAddr implements net.Conn

func (*QuicConn) SetDeadline

func (q *QuicConn) SetDeadline(t time.Time) error

SetDeadline implements net.Conn

func (*QuicConn) SetReadDeadline

func (q *QuicConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn

func (*QuicConn) SetWriteDeadline

func (q *QuicConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn

func (*QuicConn) Write

func (q *QuicConn) Write(b []byte) (n int, err error)

Write implements net.Conn

type QuicListener

type QuicListener struct {
	Listener *quic.Listener
}

QuicListener implements net.Listener

func (*QuicListener) Accept

func (l *QuicListener) Accept() (net.Conn, error)

Accept implements net.Listener. It starts a single QUIC Stream and returns a QuicConn that implements net.Conn for this single Stream.

func (*QuicListener) Addr

func (l *QuicListener) Addr() net.Addr

func (*QuicListener) Close

func (l *QuicListener) Close() error

Jump to

Keyboard shortcuts

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