hysteria2

package
v5.23.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CanNotUseUdpExtension = "Only hysteria2 proxy protocol can use udpExtension."
View Source
const Hy2MustNeedTLS = "Hysteria2 based on QUIC that requires TLS."

Variables

View Source
var ClientMutex sync.Mutex
View Source
var File_transport_internet_hysteria2_config_proto protoreflect.FileDescriptor
View Source
var MBps uint64 = 1000000 / 8 // MByte
View Source
var RunningClient map[dialerConf](hyClient.Client)

Functions

func CheckHyClientHealthy

func CheckHyClientHealthy(client hyClient.Client) bool

func CloseHyClient

func CloseHyClient(dest net.Destination, streamSettings *internet.MemoryStreamConfig) error

func Dial

func GetClientTLSConfig

func GetClientTLSConfig(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (*hyClient.TLSConfig, error)

func GetHyClient

func GetHyClient(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (hyClient.Client, error)

func GetServerTLSConfig

func GetServerTLSConfig(streamSettings *internet.MemoryStreamConfig) (*hyServer.TLSConfig, error)

func Listen

func Listen(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, handler internet.ConnHandler) (internet.Listener, error)

Listen creates a new Listener based on configurations.

func NewHyClient

func NewHyClient(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (hyClient.Client, error)

func ResolveAddress

func ResolveAddress(dest net.Destination) (net.Addr, error)

Types

type Authenticator

type Authenticator struct {
	Password string
}

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(addr net.Addr, auth string, tx uint64) (ok bool, id string)

type Config

type Config struct {
	Password              string      `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	Congestion            *Congestion `protobuf:"bytes,4,opt,name=congestion,proto3" json:"congestion,omitempty"`
	IgnoreClientBandwidth bool        `` /* 127-byte string literal not displayed */
	UseUdpExtension       bool        `protobuf:"varint,6,opt,name=use_udp_extension,json=useUdpExtension,proto3" json:"use_udp_extension,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetCongestion

func (x *Config) GetCongestion() *Congestion

func (*Config) GetIgnoreClientBandwidth

func (x *Config) GetIgnoreClientBandwidth() bool

func (*Config) GetPassword

func (x *Config) GetPassword() string

func (*Config) GetUseUdpExtension

func (x *Config) GetUseUdpExtension() bool

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type Congestion

type Congestion struct {
	Type     string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	UpMbps   uint64 `protobuf:"varint,2,opt,name=up_mbps,json=upMbps,proto3" json:"up_mbps,omitempty"`
	DownMbps uint64 `protobuf:"varint,3,opt,name=down_mbps,json=downMbps,proto3" json:"down_mbps,omitempty"`
	// contains filtered or unexported fields
}

func (*Congestion) Descriptor deprecated

func (*Congestion) Descriptor() ([]byte, []int)

Deprecated: Use Congestion.ProtoReflect.Descriptor instead.

func (*Congestion) GetDownMbps

func (x *Congestion) GetDownMbps() uint64

func (*Congestion) GetType

func (x *Congestion) GetType() string

func (*Congestion) GetUpMbps

func (x *Congestion) GetUpMbps() uint64

func (*Congestion) ProtoMessage

func (*Congestion) ProtoMessage()

func (*Congestion) ProtoReflect

func (x *Congestion) ProtoReflect() protoreflect.Message

func (*Congestion) Reset

func (x *Congestion) Reset()

func (*Congestion) String

func (x *Congestion) String() string

type HyConn

type HyConn struct {
	IsUDPExtension   bool
	IsServer         bool
	ClientUDPSession hyClient.HyUDPConn
	ServerUDPSession *hyServer.UdpSessionEntry
	// contains filtered or unexported fields
}

func (*HyConn) Close

func (c *HyConn) Close() error

func (*HyConn) LocalAddr

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

func (*HyConn) Read

func (c *HyConn) Read(b []byte) (int, error)

func (*HyConn) ReadPacket

func (c *HyConn) ReadPacket() (int, []byte, *net.Destination, error)

func (*HyConn) RemoteAddr

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

func (*HyConn) SetDeadline

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

func (*HyConn) SetReadDeadline

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

func (*HyConn) SetWriteDeadline

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

func (*HyConn) Write

func (c *HyConn) Write(b []byte) (int, error)

func (*HyConn) WritePacket

func (c *HyConn) WritePacket(b []byte, dest net.Destination) (int, error)

type Listener

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

Listener is an internet.Listener that listens for TCP connections.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr implements internet.Listener.Addr.

func (*Listener) Close

func (l *Listener) Close() error

Close implements internet.Listener.Close.

func (*Listener) StreamHijacker

func (l *Listener) StreamHijacker(ft http3.FrameType, conn quic.Connection, stream quic.Stream, err error) (bool, error)

func (*Listener) UdpHijacker

func (l *Listener) UdpHijacker(entry *hyServer.UdpSessionEntry, originalAddr string)

Jump to

Keyboard shortcuts

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