hysteria2

package
v0.4.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: GPL-2.0 Imports: 43 Imported by: 2

Documentation

Index

Constants

View Source
const ObfsTypeSalamander = "salamander"

Variables

This section is empty.

Functions

func NewSalamanderConn

func NewSalamanderConn(conn net.PacketConn, password []byte) net.PacketConn

Types

type Client

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

func NewClient

func NewClient(options ClientOptions) (*Client, error)

func (*Client) CloseWithError

func (c *Client) CloseWithError(err error) error

func (*Client) DialConn

func (c *Client) DialConn(ctx context.Context, destination M.Socksaddr) (net.Conn, error)

func (*Client) ListenPacket

func (c *Client) ListenPacket(ctx context.Context) (net.PacketConn, error)

type ClientOptions

type ClientOptions struct {
	Context            context.Context
	Dialer             N.Dialer
	Logger             logger.Logger
	BrutalDebug        bool
	ServerAddress      M.Socksaddr
	ServerPorts        []string
	HopInterval        time.Duration
	SendBPS            uint64
	ReceiveBPS         uint64
	SalamanderPassword string
	Password           string
	TLSConfig          aTLS.Config
	UDPDisabled        bool
}

type HopPacketConn added in v0.4.0

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

func NewHopPacketConn added in v0.4.0

func NewHopPacketConn(
	dialFunc func(M.Socksaddr) (net.PacketConn, error),
	destination M.Socksaddr,
	ports []uint16,
	interval time.Duration,
) (*HopPacketConn, error)

func (*HopPacketConn) Close added in v0.4.0

func (c *HopPacketConn) Close() error

func (*HopPacketConn) LocalAddr added in v0.4.0

func (c *HopPacketConn) LocalAddr() net.Addr

func (*HopPacketConn) ReadFrom added in v0.4.0

func (c *HopPacketConn) ReadFrom(b []byte) (n int, addr net.Addr, err error)

func (*HopPacketConn) SetDeadline added in v0.4.0

func (c *HopPacketConn) SetDeadline(t time.Time) error

func (*HopPacketConn) SetReadBuffer added in v0.4.0

func (c *HopPacketConn) SetReadBuffer(bytes int) error

func (*HopPacketConn) SetReadDeadline added in v0.4.0

func (c *HopPacketConn) SetReadDeadline(t time.Time) error

func (*HopPacketConn) SetWriteBuffer added in v0.4.0

func (c *HopPacketConn) SetWriteBuffer(bytes int) error

func (*HopPacketConn) SetWriteDeadline added in v0.4.0

func (c *HopPacketConn) SetWriteDeadline(t time.Time) error

func (*HopPacketConn) SyscallConn added in v0.4.0

func (c *HopPacketConn) SyscallConn() (syscall.RawConn, error)

func (*HopPacketConn) WriteTo added in v0.4.0

func (c *HopPacketConn) WriteTo(b []byte, _ net.Addr) (n int, err error)

type SalamanderPacketConn added in v0.1.3

type SalamanderPacketConn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

func (*SalamanderPacketConn) ReadFrom added in v0.1.3

func (s *SalamanderPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*SalamanderPacketConn) Upstream added in v0.4.0

func (s *SalamanderPacketConn) Upstream() any

func (*SalamanderPacketConn) WriteTo added in v0.1.3

func (s *SalamanderPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type ServerHandler

type ServerHandler interface {
	N.TCPConnectionHandlerEx
	N.UDPConnectionHandlerEx
}

type Service

type Service[U comparable] struct {
	// contains filtered or unexported fields
}

func NewService

func NewService[U comparable](options ServiceOptions) (*Service[U], error)

func (*Service[U]) Close

func (s *Service[U]) Close() error

func (*Service[U]) Start

func (s *Service[U]) Start(conn net.PacketConn) error

func (*Service[U]) UpdateUsers

func (s *Service[U]) UpdateUsers(userList []U, passwordList []string)

type ServiceOptions

type ServiceOptions struct {
	Context               context.Context
	Logger                logger.Logger
	BrutalDebug           bool
	SendBPS               uint64
	ReceiveBPS            uint64
	IgnoreClientBandwidth bool
	SalamanderPassword    string
	TLSConfig             aTLS.ServerConfig
	UDPDisabled           bool
	UDPTimeout            time.Duration
	Handler               ServerHandler
	MasqueradeHandler     http.Handler
}

type VectorisedSalamanderPacketConn added in v0.1.3

type VectorisedSalamanderPacketConn struct {
	SalamanderPacketConn
	// contains filtered or unexported fields
}

func (*VectorisedSalamanderPacketConn) WriteTo added in v0.1.3

func (s *VectorisedSalamanderPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

func (*VectorisedSalamanderPacketConn) WriteVectorisedPacket added in v0.1.3

func (s *VectorisedSalamanderPacketConn) WriteVectorisedPacket(buffers []*buf.Buffer, destination M.Socksaddr) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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