core

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 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, protocol string, auth []byte, tlsConfig *tls.Config, quicConfig *quic.Config,
	transport *transport.ClientTransport, sendBPS uint64, recvBPS uint64, congestionFactory CongestionFactory,
	obfuscator obfs.Obfuscator,
) (*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() (UDPConn, error)

type CongestionFactory

type CongestionFactory func(refBPS uint64) congestion.CongestionControl

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 Server

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

func NewServer

func NewServer(addr string, protocol string, tlsConfig *tls.Config, quicConfig *quic.Config, transport *transport.ServerTransport,
	sendBPS uint64, recvBPS uint64, congestionFactory CongestionFactory, disableUDP bool, aclEngine *acl.Engine,
	obfuscator obfs.Obfuscator, 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 UDPConn

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

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