hysteria

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MbpsToBps                      = 125000
	MinSpeedBPS                    = 16384
	DefaultStreamReceiveWindow     = 15728640 // 15 MB/s
	DefaultConnectionReceiveWindow = 67108864 // 64 MB/s
	DefaultMaxIncomingStreams      = 1024
	DefaultALPN                    = "hysteria"
	KeepAlivePeriod                = 10 * time.Second
)
View Source
const Version = 3

Variables

This section is empty.

Functions

func NewXPlusPacketConn

func NewXPlusPacketConn(conn net.PacketConn, key []byte) net.PacketConn

func StringToBps

func StringToBps(s string) uint64

func WriteClientHello

func WriteClientHello(stream io.Writer, hello ClientHello) error

func WriteClientRequest

func WriteClientRequest(stream io.Writer, request ClientRequest) error

func WriteServerHello

func WriteServerHello(stream io.Writer, hello ServerHello) error

func WriteServerResponse

func WriteServerResponse(stream io.Writer, response ServerResponse) error

func WriteUDPMessage

func WriteUDPMessage(conn quic.Connection, message UDPMessage) error

Types

type ClientHello

type ClientHello struct {
	SendBPS uint64
	RecvBPS uint64
	Auth    []byte
}

func ReadClientHello

func ReadClientHello(reader io.Reader) (*ClientHello, error)

type ClientRequest

type ClientRequest struct {
	UDP  bool
	Host string
	Port uint16
}

func ReadClientRequest

func ReadClientRequest(stream io.Reader) (*ClientRequest, error)

type Conn

type Conn struct {
	quic.Stream
	// contains filtered or unexported fields
}

func NewConn

func NewConn(stream quic.Stream, destination M.Socksaddr, isClient bool) *Conn

func (*Conn) LocalAddr

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

func (*Conn) Read added in v1.1.0

func (c *Conn) Read(p []byte) (n int, err error)

func (*Conn) ReaderReplaceable

func (c *Conn) ReaderReplaceable() bool

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) Upstream

func (c *Conn) Upstream() any

func (*Conn) WriterReplaceable

func (c *Conn) WriterReplaceable() bool

type Defragger

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

func (*Defragger) Feed

func (d *Defragger) Feed(m UDPMessage) *UDPMessage

type PacketConn

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

func NewPacketConn

func NewPacketConn(session quic.Connection, stream quic.Stream, sessionId uint32, destination M.Socksaddr, msgCh <-chan *UDPMessage, closer io.Closer) *PacketConn

func (*PacketConn) Close

func (c *PacketConn) Close() error

func (*PacketConn) Hold

func (c *PacketConn) Hold()

func (*PacketConn) LocalAddr

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

func (*PacketConn) NeedAdditionalReadDeadline added in v1.2.5

func (c *PacketConn) NeedAdditionalReadDeadline() bool

func (*PacketConn) Read

func (c *PacketConn) Read(b []byte) (n int, err error)

func (*PacketConn) ReadFrom

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

func (*PacketConn) ReadPacket

func (c *PacketConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error)

func (*PacketConn) ReadPacketThreadSafe

func (c *PacketConn) ReadPacketThreadSafe() (buffer *buf.Buffer, destination M.Socksaddr, err error)

func (*PacketConn) RemoteAddr

func (c *PacketConn) RemoteAddr() net.Addr

func (*PacketConn) SetDeadline

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

func (*PacketConn) SetReadDeadline

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

func (*PacketConn) SetWriteDeadline

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

func (*PacketConn) Write

func (c *PacketConn) Write(b []byte) (n int, err error)

func (*PacketConn) WritePacket

func (c *PacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error

func (*PacketConn) WriteTo

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

type PacketConnWrapper

type PacketConnWrapper struct {
	net.PacketConn
}

func (*PacketConnWrapper) File

func (c *PacketConnWrapper) File() (f *os.File, err error)

func (*PacketConnWrapper) SetReadBuffer

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

func (*PacketConnWrapper) SetWriteBuffer

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

func (*PacketConnWrapper) SyscallConn

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

func (*PacketConnWrapper) Upstream

func (c *PacketConnWrapper) Upstream() any

type ServerHello

type ServerHello struct {
	OK      bool
	SendBPS uint64
	RecvBPS uint64
	Message string
}

func ReadServerHello

func ReadServerHello(stream io.Reader) (*ServerHello, error)

type ServerResponse

type ServerResponse struct {
	OK           bool
	UDPSessionID uint32
	Message      string
}

func ReadServerResponse

func ReadServerResponse(stream io.Reader) (*ServerResponse, error)

type StreamWrapper

type StreamWrapper struct {
	Conn quic.Connection
	quic.Stream
}

func (*StreamWrapper) Close

func (s *StreamWrapper) Close() error

func (*StreamWrapper) LocalAddr

func (s *StreamWrapper) LocalAddr() net.Addr

func (*StreamWrapper) Read

func (s *StreamWrapper) Read(p []byte) (n int, err error)

func (*StreamWrapper) RemoteAddr

func (s *StreamWrapper) RemoteAddr() net.Addr

func (*StreamWrapper) Upstream

func (s *StreamWrapper) Upstream() any

func (*StreamWrapper) Write

func (s *StreamWrapper) Write(p []byte) (n int, err error)

type UDPMessage

type UDPMessage struct {
	SessionID uint32
	Host      string
	Port      uint16
	MsgID     uint16 // doesn't matter when not fragmented, but must not be 0 when fragmented
	FragID    uint8  // doesn't matter when not fragmented, starts at 0 when fragmented
	FragCount uint8  // must be 1 when not fragmented
	Data      []byte
}

func FragUDPMessage

func FragUDPMessage(m UDPMessage, maxSize int) []UDPMessage

func ParseUDPMessage

func ParseUDPMessage(packet []byte) (message UDPMessage, err error)

func (UDPMessage) HeaderSize

func (m UDPMessage) HeaderSize() int

func (UDPMessage) Size

func (m UDPMessage) Size() int

type VectorisedXPlusConn

type VectorisedXPlusConn struct {
	XPlusPacketConn
	// contains filtered or unexported fields
}

func (*VectorisedXPlusConn) WriteTo

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

func (*VectorisedXPlusConn) WriteVectorisedPacket

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

type XPlusPacketConn

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

func (*XPlusPacketConn) ReadFrom

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

func (*XPlusPacketConn) Upstream

func (c *XPlusPacketConn) Upstream() any

func (*XPlusPacketConn) WriteTo

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

Jump to

Keyboard shortcuts

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