Documentation
¶
Index ¶
- Variables
- func RegisterAnyTLS(registry *inbound.Registry)
- func RegisterHysteria2(registry *inbound.Registry)
- func RegisterNaive(registry *inbound.Registry)
- func RegisterShadowTLS(registry *inbound.Registry)
- func RegisterShadowsocks(registry *inbound.Registry)
- func RegisterTUIC(registry *inbound.Registry)
- func RegisterTrojan(registry *inbound.Registry)
- func RegisterVLESS(registry *inbound.Registry)
- func RegisterVMess(registry *inbound.Registry)
- type AnyTLSInbound
- func (h *AnyTLSInbound) AddUsers(users []option.AnyTLSUser) error
- func (h *AnyTLSInbound) Close() error
- func (h *AnyTLSInbound) DelUsers(names []string) error
- func (h *AnyTLSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *AnyTLSInbound) Start(stage adapter.StartStage) error
- type Hysteria2Inbound
- func (h *Hysteria2Inbound) AddUsers(users []option.Hysteria2User) error
- func (h *Hysteria2Inbound) Close() error
- func (h *Hysteria2Inbound) DelUsers(names []string) error
- func (h *Hysteria2Inbound) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, ...)
- func (h *Hysteria2Inbound) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, ...)
- func (h *Hysteria2Inbound) Start(stage adapter.StartStage) error
- type NaiveInbound
- type ShadowTLSInbound
- func (h *ShadowTLSInbound) AddUsers(users []option.ShadowTLSUser) error
- func (h *ShadowTLSInbound) Close() error
- func (h *ShadowTLSInbound) DelUsers(names []string) error
- func (h *ShadowTLSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *ShadowTLSInbound) Start(stage adapter.StartStage) error
- type ShadowsocksInbound
- func (h *ShadowsocksInbound) AddUsers(users []option.ShadowsocksUser) error
- func (h *ShadowsocksInbound) Close() error
- func (h *ShadowsocksInbound) DelUsers(names []string) error
- func (h *ShadowsocksInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *ShadowsocksInbound) NewError(ctx context.Context, err error)
- func (h *ShadowsocksInbound) NewPacket(buffer *buf.Buffer, source M.Socksaddr)
- func (h *ShadowsocksInbound) SetTracker(tracker adapter.SSMTracker)
- func (h *ShadowsocksInbound) Start(stage adapter.StartStage) error
- func (h *ShadowsocksInbound) UpdateUsers(users []string, uPSKs []string) error
- type TUICInbound
- func (h *TUICInbound) AddUsers(users []option.TUICUser) error
- func (h *TUICInbound) Close() error
- func (h *TUICInbound) DelUsers(names []string) error
- func (h *TUICInbound) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, ...)
- func (h *TUICInbound) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, ...)
- func (h *TUICInbound) Start(stage adapter.StartStage) error
- type TrojanInbound
- func (h *TrojanInbound) AddUsers(users []option.TrojanUser) error
- func (h *TrojanInbound) Close() error
- func (h *TrojanInbound) DelUsers(names []string) error
- func (h *TrojanInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *TrojanInbound) Start(stage adapter.StartStage) error
- type VLESSInbound
- func (h *VLESSInbound) AddUsers(users []option.VLESSUser) error
- func (h *VLESSInbound) Close() error
- func (h *VLESSInbound) DelUsers(names []string) error
- func (h *VLESSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *VLESSInbound) Start(stage adapter.StartStage) error
- type VMessInbound
- func (h *VMessInbound) AddUsers(users []option.VMessUser) error
- func (h *VMessInbound) Close() error
- func (h *VMessInbound) DelUsers(names []string) error
- func (h *VMessInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, ...)
- func (h *VMessInbound) Start(stage adapter.StartStage) error
Constants ¶
This section is empty.
Variables ¶
var NaiveConfigureHTTP3ListenerFunc func( ctx context.Context, logger logger.Logger, listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, options option.NaiveInboundOptions, ) (io.Closer, error)
NaiveConfigureHTTP3ListenerFunc is set by the naivequic init package (built with the with_quic tag) to wire up HTTP/3 + QUIC support.
var NaiveWrapError func(error) error
NaiveWrapError is set by the naivequic init package to wrap QUIC errors.
Functions ¶
func RegisterAnyTLS ¶
func RegisterHysteria2 ¶
func RegisterNaive ¶
func RegisterShadowTLS ¶
RegisterShadowTLS overrides the built-in ShadowTLS factory in registry.
func RegisterShadowsocks ¶
RegisterShadowsocks overrides the built-in Shadowsocks factory in registry.
func RegisterTUIC ¶
RegisterTUIC overrides the built-in TUIC factory in registry.
func RegisterTrojan ¶
RegisterTrojan overrides the built-in Trojan factory in registry.
func RegisterVLESS ¶
RegisterVLESS overrides the built-in VLESS factory in registry.
func RegisterVMess ¶
RegisterVMess overrides the built-in VMess factory in registry.
Types ¶
type AnyTLSInbound ¶
func (*AnyTLSInbound) AddUsers ¶
func (h *AnyTLSInbound) AddUsers(users []option.AnyTLSUser) error
func (*AnyTLSInbound) Close ¶
func (h *AnyTLSInbound) Close() error
func (*AnyTLSInbound) DelUsers ¶
func (h *AnyTLSInbound) DelUsers(names []string) error
func (*AnyTLSInbound) NewConnection ¶
func (h *AnyTLSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*AnyTLSInbound) Start ¶
func (h *AnyTLSInbound) Start(stage adapter.StartStage) error
type Hysteria2Inbound ¶
func (*Hysteria2Inbound) AddUsers ¶
func (h *Hysteria2Inbound) AddUsers(users []option.Hysteria2User) error
func (*Hysteria2Inbound) Close ¶
func (h *Hysteria2Inbound) Close() error
func (*Hysteria2Inbound) DelUsers ¶
func (h *Hysteria2Inbound) DelUsers(names []string) error
func (*Hysteria2Inbound) NewConnectionEx ¶
func (*Hysteria2Inbound) NewPacketConnectionEx ¶
func (h *Hysteria2Inbound) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc)
func (*Hysteria2Inbound) Start ¶
func (h *Hysteria2Inbound) Start(stage adapter.StartStage) error
type NaiveInbound ¶
func (*NaiveInbound) Close ¶
func (h *NaiveInbound) Close() error
func (*NaiveInbound) DelUsers ¶
func (h *NaiveInbound) DelUsers(names []string) error
func (*NaiveInbound) ServeHTTP ¶
func (h *NaiveInbound) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*NaiveInbound) Start ¶
func (h *NaiveInbound) Start(stage adapter.StartStage) error
type ShadowTLSInbound ¶
ShadowTLSInbound is a full sing-box ShadowTLS inbound with zero-downtime user management. The shadowtls.Service is recreated and swapped atomically on user changes — the listener and TLS layer never restart.
Connection-safety guarantee: existing connections are NEVER closed when users are removed. shadowtls.Service has no UpdateUsers method, so we rebuild a new service object and atomically swap the pointer. Goroutines that are mid-handshake on the OLD service continue running to completion: they hold a reference to the old service via closure, keeping it alive in the GC until all those goroutines finish. After the handshake, the routed connection is owned by the router goroutine — entirely independent of whichever service pointer h.service currently holds.
func (*ShadowTLSInbound) AddUsers ¶
func (h *ShadowTLSInbound) AddUsers(users []option.ShadowTLSUser) error
AddUsers upserts ShadowTLS users by Name (v3 only; recreates service atomically).
func (*ShadowTLSInbound) Close ¶
func (h *ShadowTLSInbound) Close() error
func (*ShadowTLSInbound) DelUsers ¶
func (h *ShadowTLSInbound) DelUsers(names []string) error
DelUsers removes ShadowTLS users by Name (v3 only; recreates service atomically).
func (*ShadowTLSInbound) NewConnection ¶
func (h *ShadowTLSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*ShadowTLSInbound) Start ¶
func (h *ShadowTLSInbound) Start(stage adapter.StartStage) error
type ShadowsocksInbound ¶
func (*ShadowsocksInbound) AddUsers ¶
func (h *ShadowsocksInbound) AddUsers(users []option.ShadowsocksUser) error
AddUsers upserts Shadowsocks users by Name. Existing slots are updated in-place; new names get a fresh slot. Thread-safe, no restart required.
func (*ShadowsocksInbound) Close ¶
func (h *ShadowsocksInbound) Close() error
func (*ShadowsocksInbound) DelUsers ¶
func (h *ShadowsocksInbound) DelUsers(names []string) error
DelUsers removes users by Name. Deleted slots are zeroed but never reused, so in-flight authenticated connections can never be remapped to another user.
func (*ShadowsocksInbound) NewConnection ¶
func (h *ShadowsocksInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*ShadowsocksInbound) NewError ¶
func (h *ShadowsocksInbound) NewError(ctx context.Context, err error)
func (*ShadowsocksInbound) NewPacket ¶
func (h *ShadowsocksInbound) NewPacket(buffer *buf.Buffer, source M.Socksaddr)
func (*ShadowsocksInbound) SetTracker ¶
func (h *ShadowsocksInbound) SetTracker(tracker adapter.SSMTracker)
func (*ShadowsocksInbound) Start ¶
func (h *ShadowsocksInbound) Start(stage adapter.StartStage) error
func (*ShadowsocksInbound) UpdateUsers ¶
func (h *ShadowsocksInbound) UpdateUsers(users []string, uPSKs []string) error
UpdateUsers replaces the entire user list atomically and pushes the new set into the Shadowsocks service. Indices are assigned 0…N-1 in order.
type TUICInbound ¶
TUICInbound is a full sing-box TUIC inbound with zero-downtime user management.
func (*TUICInbound) Close ¶
func (h *TUICInbound) Close() error
func (*TUICInbound) DelUsers ¶
func (h *TUICInbound) DelUsers(names []string) error
func (*TUICInbound) NewConnectionEx ¶
func (*TUICInbound) NewPacketConnectionEx ¶
func (h *TUICInbound) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc)
func (*TUICInbound) Start ¶
func (h *TUICInbound) Start(stage adapter.StartStage) error
type TrojanInbound ¶
TrojanInbound is a full sing-box Trojan inbound with zero-downtime user management.
func (*TrojanInbound) AddUsers ¶
func (h *TrojanInbound) AddUsers(users []option.TrojanUser) error
func (*TrojanInbound) Close ¶
func (h *TrojanInbound) Close() error
func (*TrojanInbound) DelUsers ¶
func (h *TrojanInbound) DelUsers(names []string) error
func (*TrojanInbound) NewConnection ¶
func (h *TrojanInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*TrojanInbound) Start ¶
func (h *TrojanInbound) Start(stage adapter.StartStage) error
type VLESSInbound ¶
VLESSInbound is a full sing-box VLESS inbound with zero-downtime user management via AddUsers / DelUsers.
Connection-safety guarantee: existing connections are NEVER closed when users are removed. Authentication (UUID lookup in service.userMap) happens exactly once per TCP connection inside Service.NewConnection. After that point the authenticated slot index is stored in ctx; the router goroutine runs entirely independently of the user table. Calling DelUsers zeroes the slot and calls service.UpdateUsers — new connections from that UUID are rejected, but in-flight connections are not touched.
func (*VLESSInbound) AddUsers ¶
func (h *VLESSInbound) AddUsers(users []option.VLESSUser) error
AddUsers upserts VLESS users by Name. Existing slots are updated in-place; new names get a fresh slot. Thread-safe, no restart required.
func (*VLESSInbound) Close ¶
func (h *VLESSInbound) Close() error
func (*VLESSInbound) DelUsers ¶
func (h *VLESSInbound) DelUsers(names []string) error
DelUsers removes users by Name. Deleted slots are zeroed but never reused, so in-flight authenticated connections can never be remapped to another user.
func (*VLESSInbound) NewConnection ¶
func (h *VLESSInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*VLESSInbound) Start ¶
func (h *VLESSInbound) Start(stage adapter.StartStage) error
type VMessInbound ¶
VMessInbound is a full sing-box VMess inbound with zero-downtime user management.
func (*VMessInbound) Close ¶
func (h *VMessInbound) Close() error
func (*VMessInbound) DelUsers ¶
func (h *VMessInbound) DelUsers(names []string) error
func (*VMessInbound) NewConnection ¶
func (h *VMessInbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)
func (*VMessInbound) Start ¶
func (h *VMessInbound) Start(stage adapter.StartStage) error