Documentation
¶
Overview ¶
Package panel orchestrates multiple nodes, periodic panel tasks and hot reload. Placeholder — implemented in Phase 1 (doc/03 T11).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoSpeedLimitConfig ¶
type AutoSpeedLimitConfig struct {
Limit int `mapstructure:"Limit"`
WarnTimes int `mapstructure:"WarnTimes"`
LimitSpeed int `mapstructure:"LimitSpeed"`
LimitDuration int `mapstructure:"LimitDuration"`
}
AutoSpeedLimitConfig is the T7 dynamic speed-limit policy (doc/09 §5.3). Consumed by the Controller when Limit > 0.
type CertConfig ¶
type CertConfig struct {
CertMode string `mapstructure:"CertMode"`
CertDomain string `mapstructure:"CertDomain"`
CertFile string `mapstructure:"CertFile"`
KeyFile string `mapstructure:"KeyFile"`
Provider string `mapstructure:"Provider"`
Email string `mapstructure:"Email"`
DNSEnv map[string]string `mapstructure:"DNSEnv"`
}
CertConfig — T10 cert automation policy (doc/09 §5.3). Mapped onto cert.CertConfig by the Controller before AddNode.
type Config ¶
type Config struct {
Log LogConfig `mapstructure:"Log"`
Nodes []NodeConfig `mapstructure:"Nodes"`
// --- sing-box passthrough blocks (doc/09 §6.1, §6.2) ---
//
// These are NOT parsed by viper: they carry literal sing-box config, which
// the base decodes itself (core/singbox/passthrough.go). They are held as raw
// JSON because viper LOWERCASES every map key it reads — harmless for
// sing-box's own snake_case keys, but it would silently mangle case-sensitive
// values such as a transport's `headers: {Host: ...}`. loadPassthrough reads
// them straight from the YAML instead, preserving case exactly.
//
// Empty means "not configured": DNS falls back to the Box default, outbounds
// fall back to a lone direct, and routing is absent (everything egresses via
// the default outbound).
DNSRaw json.RawMessage `mapstructure:"-"`
OutboundRaw json.RawMessage `mapstructure:"-"`
RouteRaw json.RawMessage `mapstructure:"-"`
// AccessLog is the process-level access-log reporting policy (doc/09 §4.3,
// doc/11 §13.1). It is the billing/accesslog.Config directly; the Manager's
// normalize() fills defaults. Enable=false (the zero value) leaves access
// logging off, so existing configs without an AccessLog block load cleanly.
AccessLog accesslog.Config `mapstructure:"AccessLog"`
}
Config is the top-level config.yml shape (doc/09 §3).
func LoadConfig ¶
LoadConfig reads a YAML config.yml from path (viper), unmarshals it into Config, and fills defaults. Key matching is case-insensitive (mapstructure), matching XrayR semantics.
type ConnLimitConfig ¶
type ConnLimitConfig struct {
Enable bool `mapstructure:"Enable"`
MaxConnPerUser int `mapstructure:"MaxConnPerUser"`
}
ConnLimitConfig — net-new (doc/09 §5.3): per-user concurrent-connection cap, pushed to the shared ConnLimiter per node tag before AddNode.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller drives one node. It satisfies Service.
func NewController ¶
func NewController(server *singbox.Server, apiClient api.API, config *ControllerConfig) *Controller
NewController wires a node orchestrator over a shared Core and a panel client. A dynamic speed limiter is constructed when the node enables one (Limit > 0).
func (*Controller) Close ¶
func (c *Controller) Close() error
Close stops the monitor and removes the node from the Core.
func (*Controller) Start ¶
func (c *Controller) Start() error
Start performs the initial sync and launches the periodic monitor.
type ControllerConfig ¶
type ControllerConfig struct {
ListenIP string `mapstructure:"ListenIP"`
SendIP string `mapstructure:"SendIP"`
UpdatePeriodic int `mapstructure:"UpdatePeriodic"`
EnableDNS bool `mapstructure:"EnableDNS"`
DNSType string `mapstructure:"DNSType"`
EnableProxyProtocol bool `mapstructure:"EnableProxyProtocol"`
EnableFallback bool `mapstructure:"EnableFallback"`
// Node-local REALITY: legacy panels keep the private key node-side and do not
// deliver reality-opts, so the Controller injects REALITYConfigs into the
// NodeInfo before AddNode when EnableREALITY is set (unless the operator forces
// the panel copy via DisableLocalREALITYConfig). doc/09 §5.3.
EnableREALITY bool `mapstructure:"EnableREALITY"`
DisableLocalREALITYConfig bool `mapstructure:"DisableLocalREALITYConfig"`
REALITYConfigs RealityConfig `mapstructure:"REALITYConfigs"`
// Local control sub-blocks, all consumed by the Controller: AutoSpeedLimit
// drives the T7 dynamic throttle; GlobalDeviceLimit / ConnLimit are pushed to
// the shared limiter before AddNode; Cert feeds the T10 inbound TLS build.
AutoSpeedLimitConfig AutoSpeedLimitConfig `mapstructure:"AutoSpeedLimitConfig"` // T7 dynamic speed limit
GlobalDeviceLimitConfig limiter.GlobalDeviceLimitConfig `mapstructure:"GlobalDeviceLimitConfig"` // cross-node device cap (Redis)
ConnLimitConfig ConnLimitConfig `mapstructure:"ConnLimitConfig"` // per-user concurrent conns
CertConfig CertConfig `mapstructure:"CertConfig"` // T10 cert automation
}
ControllerConfig is the node-level local control policy (doc/09 §5.3). Only ListenIP and UpdatePeriodic are load-bearing for increment D; the rest are parsed so configs round-trip and later increments can wire them.
type LogConfig ¶
type LogConfig struct {
Level string `mapstructure:"Level"`
AccessPath string `mapstructure:"AccessPath"`
ErrorPath string `mapstructure:"ErrorPath"`
}
LogConfig mirrors XrayR LogConfig (doc/09 §4.1).
type NodeConfig ¶
type NodeConfig struct {
PanelType string `mapstructure:"PanelType"`
ApiConfig api.Config `mapstructure:"ApiConfig"`
ControllerConfig ControllerConfig `mapstructure:"ControllerConfig"`
}
NodeConfig is one entry of Nodes[] (doc/09 §5): panel type + panel connection (api.Config) + local control policy.
type Panel ¶
type Panel struct {
// contains filtered or unexported fields
}
Panel owns the shared Core and the per-node services.
type RealityConfig ¶
type RealityConfig struct {
Show bool `mapstructure:"Show"`
Dest string `mapstructure:"Dest"`
ProxyProtocolVer uint64 `mapstructure:"ProxyProtocolVer"`
ServerNames []string `mapstructure:"ServerNames"`
PrivateKey string `mapstructure:"PrivateKey"`
MinClientVer string `mapstructure:"MinClientVer"`
MaxClientVer string `mapstructure:"MaxClientVer"`
MaxTimeDiff uint64 `mapstructure:"MaxTimeDiff"`
ShortIds []string `mapstructure:"ShortIds"`
}
RealityConfig is the node-local REALITY server config (doc/09 §5.3), mirroring api.REALITYConfig. Fields map to the REALITYConfigs YAML block.