hysteria2

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRejectQuic = errors.New("reject quic over hysteria2")

Functions

This section is empty.

Types

type ActiveTimeConn

type ActiveTimeConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*ActiveTimeConn) Read

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

type ActiveTimeHyUDPConn

type ActiveTimeHyUDPConn struct {
	client.HyUDPConn
	// contains filtered or unexported fields
}

func (*ActiveTimeHyUDPConn) Receive

func (c *ActiveTimeHyUDPConn) Receive() ([]byte, string, error)

type Config

type Config struct {
	Tag                      string
	PacketListener           i.PacketListener
	Dialer                   i.Dialer
	HysteriaClientConfig     *client.Config
	SalamanderPassword       string
	Address                  net.Address
	PortSelector             i.PortSelector
	IpResolverForNodeAddress i.IPResolver
	DomainStrategy           domain.DomainStrategy
	RejectQuic               bool
	Realm                    RealmConfig
}

type HyPacketConn

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

Adapter for client.HyUDPConn to implement net.PacketConn

func (*HyPacketConn) Close

func (c *HyPacketConn) Close() error

Close implements net.PacketConn

func (*HyPacketConn) LocalAddr

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

LocalAddr implements net.PacketConn

func (*HyPacketConn) ReadFrom

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

ReadFrom implements net.PacketConn

func (*HyPacketConn) SetDeadline

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

SetDeadline implements net.PacketConn

func (*HyPacketConn) SetReadDeadline

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

SetReadDeadline implements net.PacketConn

func (*HyPacketConn) SetWriteDeadline

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

SetWriteDeadline implements net.PacketConn

func (*HyPacketConn) WriteTo

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

WriteTo implements net.PacketConn

type HyUdpConnToNetConn

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

func (*HyUdpConnToNetConn) Close

func (c *HyUdpConnToNetConn) Close() error

func (*HyUdpConnToNetConn) LocalAddr

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

func (*HyUdpConnToNetConn) Read

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

func (*HyUdpConnToNetConn) RemoteAddr

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

func (*HyUdpConnToNetConn) SetDeadline

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

func (*HyUdpConnToNetConn) SetReadDeadline

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

func (*HyUdpConnToNetConn) SetWriteDeadline

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

func (*HyUdpConnToNetConn) Write

func (c *HyUdpConnToNetConn) Write(p []byte) (int, error)

type HysClient

type HysClient struct {
	IpResolverForNodeAddress   i.IPResolver
	IpResolverForTargetAddress i.IPResolver
	DomainStrategy             domain.DomainStrategy

	RejectQuic bool

	sync.Mutex
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*HysClient, error)

func (*HysClient) HandleFlow

func (d *HysClient) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error

func (*HysClient) HandlePacketConn

func (d *HysClient) HandlePacketConn(ctx context.Context, dst net.Destination, p udp.PacketReaderWriter) error

func (*HysClient) ListenPacket

func (d *HysClient) ListenPacket(ctx context.Context, dst net.Destination) (udp.UdpConn, error)

func (*HysClient) ProxyDial

func (d *HysClient) ProxyDial(ctx context.Context, dst net.Destination,
	initialData buf.MultiBuffer) (i.FlowConn, error)

func (*HysClient) Tag

func (d *HysClient) Tag() string

type Inbound added in v1.4.0

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

func NewInbound added in v1.4.0

func NewInbound(config *InboundConfig) (*Inbound, error)

func (*Inbound) AddUser added in v1.4.0

func (in *Inbound) AddUser(user i.User)

func (*Inbound) Authenticate added in v1.4.0

func (in *Inbound) Authenticate(addr net.Addr, auth string, tx uint64) (ok bool, user i.User)

func (*Inbound) Close added in v1.4.0

func (in *Inbound) Close() error

func (*Inbound) Connect added in v1.4.0

func (in *Inbound) Connect(addr net.Addr, secret string, tx uint64)

Implements server.EventLogger

func (*Inbound) Disconnect added in v1.4.0

func (in *Inbound) Disconnect(addr net.Addr, id string, err error)

func (*Inbound) LogOnlineState added in v1.4.0

func (in *Inbound) LogOnlineState(user i.User, online bool)

func (*Inbound) LogTraffic added in v1.4.0

func (in *Inbound) LogTraffic(user i.User, tx, rx uint64) (ok bool)

rx is what received from final dest, and the data will be sent back to client. tx is the data sent to the final dest, in other words, the data received from the client data sent back to client is rx, data received from client is tx send(to client) traffic meter happens at the transport layer, so we don't need to count it here

func (*Inbound) RealmStatus added in v1.4.0

func (in *Inbound) RealmStatus() (active bool, realmID string, publicAddrs []string, peers int)

RealmStatus returns a snapshot of the realm server state. active is false when no realm server is running (realmRuntime is nil or session is empty). peers counts authenticated QUIC clients that connected via a successful realm STUN punch.

func (*Inbound) RemoveUser added in v1.4.0

func (in *Inbound) RemoveUser(user i.User)

func (*Inbound) Start added in v1.4.0

func (in *Inbound) Start() error

func (*Inbound) TCPError added in v1.4.0

func (in *Inbound) TCPError(addr net.Addr, id, reqAddr string, err error)

func (*Inbound) TCPRequest added in v1.4.0

func (in *Inbound) TCPRequest(addr net.Addr, id, reqAddr string)

func (*Inbound) Tag added in v1.4.0

func (in *Inbound) Tag() string

func (*Inbound) TraceStream added in v1.4.0

func (in *Inbound) TraceStream(stream server.HyStream, stats *server.StreamStats)

func (*Inbound) UDPError added in v1.4.0

func (in *Inbound) UDPError(addr net.Addr, id string, sessionID uint32, err error)

func (*Inbound) UDPRequest added in v1.4.0

func (in *Inbound) UDPRequest(addr net.Addr, id string, sessionID uint32, reqAddr string)

func (*Inbound) UntraceStream added in v1.4.0

func (in *Inbound) UntraceStream(stream server.HyStream)

func (*Inbound) WithOnUnauthorizedRequest added in v1.4.0

func (in *Inbound) WithOnUnauthorizedRequest(f i.UnauthorizedReport)

type InboundConfig added in v1.4.0

type InboundConfig struct {
	*configs.Hysteria2ServerConfig
	Addresses             []string
	Ports                 []uint16
	Tag                   string
	OnUnauthorizedRequest i.UnauthorizedReport
	Handler               i.Handler
	Listener              i.PacketListener
	Realm                 RealmConfig
	StatsUser             bool
}

type RealmConfig added in v1.4.0

type RealmConfig struct {
	RealmAddr         string
	LocalPort         uint16
	STUNServers       []string
	STUNTimeout       time.Duration
	PunchTimeout      time.Duration
	HeartbeatInterval time.Duration
	Insecure          bool
	IPMode            string
	PortMapping       RealmPortMappingConfig
	Resolver          i.IPResolver
}

type RealmPortMappingConfig added in v1.4.0

type RealmPortMappingConfig struct {
	Enabled  bool
	Timeout  time.Duration
	Lifetime time.Duration
}

Jump to

Keyboard shortcuts

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