anytls

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: GPL-3.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Verbatim copy of sing-box protocol/anytls/inbound.go, moved into this module so the panel can reach the unexported `service`/`users` fields that the sing-box Inbound type does not expose. That access is what lets core.UpdateInboundUsers swap an inbound's user table in place instead of tearing the listener down (see core/inbound_users.go).

UPGRADING sing-box: re-copy this file from the new tag and re-apply the changes below. Nothing here will fail to compile if you forget, it will just silently keep running the old implementation.

Local change vs sing-box: two lines, both for the user-session registry. NewInbound wraps the router with it, and NewConnection -- which owns an anytls session for as long as that session lives -- is redirected through newSessionConnection in users.go, so the session can be registered there and closed later. Without it, removing a user only stops new sessions while the one the client already holds keeps being served. See core/usersession.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInbound

func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.AnyTLSInboundOptions) (adapter.Inbound, error)

func RegisterInbound

func RegisterInbound(registry *inbound.Registry)

Types

type Inbound

type Inbound struct {
	inbound.Adapter
	// contains filtered or unexported fields
}

func (*Inbound) KickUser added in v1.9.0

func (h *Inbound) KickUser(user string) usersession.Result

KickUser cuts the sessions of a user who stays on the inbound -- see Core.DisconnectUser.

func (*Inbound) NewConnection added in v1.8.0

func (h *Inbound) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc)

func (*Inbound) Start

func (h *Inbound) Start(stage adapter.StartStage, scope *adapter.Scope) error

func (*Inbound) UpdateUsers

func (h *Inbound) UpdateUsers(users []option.AnyTLSUser) error

UpdateUsers swaps the user table of a running inbound, and cuts the sessions of everyone who just left it. Both halves are needed: the table alone only decides who may open a *new* session, while an anytls client that authenticated before the change keeps opening streams on the one it has.

Jump to

Keyboard shortcuts

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