quicstream

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 14 Imported by: 18

Documentation

Overview

Package quicstream supports stream, based on quic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNetworkError

func IsNetworkError(err error) bool

func WritePrefix

func WritePrefix(w io.Writer, prefix string) error

Types

type Client

type Client struct {
	*logging.Logging

	sync.Mutex
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	addr *net.UDPAddr,
	tlsconfig *tls.Config,
	quicconfig *quic.Config,
	dialf DialFunc,
) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Dial

func (c *Client) Dial(ctx context.Context) (quic.EarlyConnection, error)

func (*Client) Session

func (c *Client) Session() quic.EarlyConnection

func (*Client) Write

func (c *Client) Write(ctx context.Context, f ClientWriteFunc) (quic.Stream, error)

type ClientWriteFunc

type ClientWriteFunc func(io.Writer) error

func DefaultClientWriteFunc

func DefaultClientWriteFunc(b []byte) ClientWriteFunc

type DialFunc

type DialFunc func(
	ctx context.Context,
	addr string,
	tlsconfig *tls.Config,
	quicconfig *quic.Config,
) (quic.EarlyConnection, error)

type ErrorHandler

type ErrorHandler func(net.Addr, io.Reader, io.Writer, error) error

type Handler

type Handler func(net.Addr, io.Reader, io.Writer) error

type PoolClient

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

func NewPoolClient

func NewPoolClient() *PoolClient

func (*PoolClient) Add

func (p *PoolClient) Add(addr *net.UDPAddr, client *Client) bool

func (*PoolClient) Clean

func (p *PoolClient) Clean(cleanDuration time.Duration) int

func (*PoolClient) Client

func (p *PoolClient) Client(addr *net.UDPAddr) (*Client, bool)

func (*PoolClient) Close

func (p *PoolClient) Close() error

func (*PoolClient) Dial

func (p *PoolClient) Dial(
	ctx context.Context,
	addr *net.UDPAddr,
	newClient func(*net.UDPAddr) *Client,
) (quic.EarlyConnection, error)

func (*PoolClient) Remove

func (p *PoolClient) Remove(addr *net.UDPAddr) bool

func (*PoolClient) Write

func (p *PoolClient) Write(
	ctx context.Context,
	addr *net.UDPAddr,
	f func(io.Writer) error,
	newClient func(*net.UDPAddr) *Client,
) (quic.Stream, error)

type PrefixHandler

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

func NewPrefixHandler

func NewPrefixHandler(errorHandler ErrorHandler) *PrefixHandler

func (*PrefixHandler) Add

func (h *PrefixHandler) Add(prefix string, handler Handler) *PrefixHandler

func (*PrefixHandler) Handler

func (h *PrefixHandler) Handler(addr net.Addr, r io.Reader, w io.Writer) error

type Server

type Server struct {
	*logging.Logging
	*util.ContextDaemon
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	bind *net.UDPAddr,
	tlsconfig *tls.Config,
	quicconfig *quic.Config,
	handler Handler,
) (*Server, error)

type UDPConnInfo

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

func MustNewUDPConnInfoFromString

func MustNewUDPConnInfoFromString(s string) UDPConnInfo

func NewUDPConnInfo

func NewUDPConnInfo(addr *net.UDPAddr, tlsinsecure bool) UDPConnInfo

func NewUDPConnInfoFromString

func NewUDPConnInfoFromString(s string) (UDPConnInfo, error)

func NewUDPConnInfoFromStringAddress

func NewUDPConnInfoFromStringAddress(s string, tlsinsecure bool) (ci UDPConnInfo, _ error)

func (UDPConnInfo) Addr

func (c UDPConnInfo) Addr() net.Addr

func (UDPConnInfo) IsValid

func (c UDPConnInfo) IsValid([]byte) error

func (UDPConnInfo) MarshalText

func (c UDPConnInfo) MarshalText() ([]byte, error)

func (UDPConnInfo) String

func (c UDPConnInfo) String() string

func (UDPConnInfo) TLSInsecure

func (c UDPConnInfo) TLSInsecure() bool

func (UDPConnInfo) UDPAddr

func (c UDPConnInfo) UDPAddr() *net.UDPAddr

func (*UDPConnInfo) UnmarshalText

func (c *UDPConnInfo) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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