quicnet

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr            string
	Handler         Handler
	TunnelInterface *water.Interface
	quic.Connection
}

func NewClient

func NewClient(addr string, tunIface *water.Interface) *Client

func (*Client) Dial

func (s *Client) Dial() error

func (*Client) Send

func (s *Client) Send(data string) error

func (*Client) SendBytes

func (s *Client) SendBytes(data []byte) error

func (*Client) SendJson

func (s *Client) SendJson(data any) error

func (*Client) SetHandler

func (s *Client) SetHandler(handler Handler)

type Ctx

type Ctx struct {
	quic.Connection
	Data []byte
	// contains filtered or unexported fields
}

func (*Ctx) Parse

func (ctx *Ctx) Parse(data any) error

func (*Ctx) Send

func (ctx *Ctx) Send(data string) error

func (*Ctx) SendBytes

func (ctx *Ctx) SendBytes(data []byte) error

func (*Ctx) SendJson

func (ctx *Ctx) SendJson(data any) error

func (*Ctx) String

func (ctx *Ctx) String() string

type Handler

type Handler func(Ctx) error

type QuicNet

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

func NewQuicNet

func NewQuicNet(logger *zap.SugaredLogger,
	tunnelIp string,
	localIp string,
	peerIp string,
	qnetTunnelPort int,
	isServer bool,
	isClient bool) (*QuicNet, error)

func (*QuicNet) Start

func (qn *QuicNet) Start(ctx context.Context, wg *sync.WaitGroup) error

func (*QuicNet) Stop

func (qn *QuicNet) Stop()

type Server

type Server struct {
	Addr            string
	TunnelInterface *water.Interface
	Handler         Handler
}

func NewServer

func NewServer(addr string, tunIface *water.Interface) *Server

func (*Server) SetHandler

func (s *Server) SetHandler(handler Handler)

func (*Server) StartServer

func (s *Server) StartServer(ctx context.Context) error

Jump to

Keyboard shortcuts

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