Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface {
FetchNodeConfig(ctx context.Context) (*NodeConfig, error)
FetchUsers(ctx context.Context) ([]User, error)
FetchDetectRules(ctx context.Context) ([]DetectRule, error)
Heartbeat(ctx context.Context, onlineUsers int) error
ReportTraffic(ctx context.Context, items []UserTraffic) error
ReportOnline(ctx context.Context, items []UserOnline) error
ReportDetectLogs(ctx context.Context, items []DetectLog) error
}
APIClient talks to the panel. The Fetch methods return (nil, nil) when the resource is unchanged since the last successful fetch.
type AnyTLSConfig ¶
type AnyTLSConfig struct {
PaddingScheme []string
}
type DetectRule ¶
type DetectRule struct {
ID int
Type DetectRuleType
Regexp *regexp.Regexp
}
type DetectRuleType ¶
type DetectRuleType int
DetectRuleType selects what a detect rule's regex is matched against.
const ( // DetectRuleTypePlain matches the destination host, the sniffed domain // and the first payload of the connection as text. DetectRuleTypePlain DetectRuleType = 1 // DetectRuleTypeHex matches the hex encoding of the first payload. DetectRuleTypeHex DetectRuleType = 2 )
type Hysteria2Config ¶
type NodeConfig ¶
type NodeConfig struct {
Type NodeType
ListenPort uint16
// SpeedLimit is the node-wide per-user limit in bytes per second, 0 for none.
SpeedLimit uint64
// TLS is nil for protocols or node settings without TLS.
TLS *boxOption.InboundTLSOptions
// Transport is nil for plain TCP.
Transport *boxOption.V2RayTransportOptions
Shadowsocks ShadowsocksConfig
TUIC TUICConfig
Hysteria2 Hysteria2Config
AnyTLS AnyTLSConfig
}
NodeConfig is everything a node server needs to listen, decoded from the panel's node info and merged with the local server options. Two configs that compare equal with reflect.DeepEqual produce the same listener, so the server only restarts when this changes.
type NodeServer ¶
NodeServer is one protocol listener. Users are swapped in place so that a user list change never drops the listener or other users' sessions.
type Router ¶
type Router interface {
boxAdapter.ConnectionRouterEx
}
Router receives every proxied connection from a node server. The context must carry the panel user ID, set with auth.ContextWithUser[int].
type ShadowsocksConfig ¶
type TUICConfig ¶
type TUICConfig struct {
CongestionControl string
}
type User ¶
type User struct {
ID int
UUID string
Password string
// SpeedLimit is in bytes per second, 0 for none.
SpeedLimit uint64
}
User is a panel account allowed on this node. Which credential a protocol reads depends on the node type: VMess and Trojan authenticate with UUID, TUIC with UUID and Password, everything else with Password.