core

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("closed")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(serverAddr string, auth []byte, tlsConfig *tls.Config, quicConfig *quic.Config,
	pktConnFunc pktconns.ClientPacketConnFunc, sendBPS uint64, recvBPS uint64, quicReconnectFunc func(err error),
) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialTCP

func (c *Client) DialTCP(addr string) (net.Conn, error)

func (*Client) DialUDP

func (c *Client) DialUDP() (HyUDPConn, error)

type ConnectFunc

type ConnectFunc func(addr net.Addr, auth []byte, sSend uint64, sRecv uint64) (bool, string)

type DisconnectFunc

type DisconnectFunc func(addr net.Addr, auth []byte, err error)

type HyUDPConn added in v1.2.2

type HyUDPConn interface {
	ReadFrom() ([]byte, string, error)
	WriteTo([]byte, string) error
	Close() error
}

type Server

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

func NewServer

func NewServer(tlsConfig *tls.Config, quicConfig *quic.Config,
	pktConn net.PacketConn, transport *transport.ServerTransport,
	sendBPS uint64, recvBPS uint64, disableUDP bool, aclEngine *acl.Engine,
	connectFunc ConnectFunc, disconnectFunc DisconnectFunc,
	tcpRequestFunc TCPRequestFunc, tcpErrorFunc TCPErrorFunc,
	udpRequestFunc UDPRequestFunc, udpErrorFunc UDPErrorFunc, promRegistry *prometheus.Registry,
) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve() error

type TCPErrorFunc

type TCPErrorFunc func(addr net.Addr, auth []byte, reqAddr string, err error)

type TCPRequestFunc

type TCPRequestFunc func(addr net.Addr, auth []byte, reqAddr string, action acl.Action, arg string)

type UDPErrorFunc

type UDPErrorFunc func(addr net.Addr, auth []byte, sessionID uint32, err error)

type UDPRequestFunc

type UDPRequestFunc func(addr net.Addr, auth []byte, sessionID uint32)

Jump to

Keyboard shortcuts

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