Documentation
¶
Overview ¶
Package controller Package generate the InboundConfig used by add inbound
Index ¶
- Variables
- func BuildWSEndpoint(wsConfig *api.WSConfig, runtimeConfig *WebSocketConfig) (string, error)
- func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.InboundHandlerConfig, error)
- func InboundBuilderWithUsers(config *Config, nodeInfo *api.NodeInfo, tag string, userInfo *[]api.UserInfo) (*core.InboundHandlerConfig, error)
- func OutboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.OutboundHandlerConfig, error)
- type AutoSpeedLimitConfig
- type Config
- type Controller
- func (c *Controller) AddInboundLimiter(tag string, nodeSpeedLimit uint64, userList *[]api.UserInfo, ...) error
- func (c *Controller) Close() error
- func (c *Controller) CloseContext(parent context.Context) error
- func (c *Controller) DeleteInboundLimiter(tag string) error
- func (c *Controller) ExecuteSyncAction(ctx context.Context, action syncAction) error
- func (c *Controller) GetDetectResult(tag string) (*[]api.DetectResult, error)
- func (c *Controller) GetOnlineDevice(tag string) (*[]api.OnlineUser, error)
- func (c *Controller) ObservabilitySnapshot() service.RuntimeSnapshot
- func (c *Controller) SetWSEventRuntimeFactory(factory WSEventRuntimeFactory)
- func (c *Controller) Start() error
- func (c *Controller) StartContext(parent context.Context) error
- func (c *Controller) SyncAliveList(tag string, aliveList map[int][]string) error
- func (c *Controller) SyncAliveSnapshot(tag string, snapshot *api.AliveSnapshot, reportedIPs map[int][]string) error
- func (c *Controller) UpdateInboundLimiter(tag string, updatedUserList *[]api.UserInfo) error
- func (c *Controller) UpdateRule(tag string, newRuleList []api.DetectRule) error
- type FallBackConfig
- type LimitInfo
- type NodeHandlerBuilder
- func (b *NodeHandlerBuilder) BuildInbound(tag string) (*core.InboundHandlerConfig, error)
- func (b *NodeHandlerBuilder) BuildInboundWithUsers(tag string, users []api.UserInfo) (*core.InboundHandlerConfig, error)
- func (b *NodeHandlerBuilder) BuildOutbound(tag string) (*core.OutboundHandlerConfig, error)
- type PanelClient
- type REALITYConfig
- type WSEventRuntimeFactory
- type WSEventSubmitter
- type WSRuntimeLifecycle
- type WebSocketConfig
Constants ¶
This section is empty.
Variables ¶
var AEADMethod = map[shadowsocks.CipherType]uint8{ shadowsocks.CipherType_AES_128_GCM: 0, shadowsocks.CipherType_AES_256_GCM: 0, shadowsocks.CipherType_CHACHA20_POLY1305: 0, shadowsocks.CipherType_XCHACHA20_POLY1305: 0, }
Functions ¶
func BuildWSEndpoint ¶
func BuildWSEndpoint(wsConfig *api.WSConfig, runtimeConfig *WebSocketConfig) (string, error)
func InboundBuilder ¶
func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.InboundHandlerConfig, error)
InboundBuilder is the compatibility adapter for callers that still provide api.NodeInfo. Internal controller paths call buildInbound with a focused view.
func InboundBuilderWithUsers ¶
func InboundBuilderWithUsers(config *Config, nodeInfo *api.NodeInfo, tag string, userInfo *[]api.UserInfo) (*core.InboundHandlerConfig, error)
InboundBuilderWithUsers is the compatibility adapter for callers that still provide api.NodeInfo. Internal controller paths call buildInboundWithUsers with the focused listener view.
func OutboundBuilder ¶
func OutboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.OutboundHandlerConfig, error)
OutboundBuilder is the compatibility adapter for callers that still provide api.NodeInfo. Internal controller paths call buildOutbound with a focused view.
Types ¶
type AutoSpeedLimitConfig ¶
type Config ¶
type Config struct {
ListenIP string `mapstructure:"ListenIP"`
SendIP string `mapstructure:"SendIP"`
UpdatePeriodic int `mapstructure:"UpdatePeriodic"`
CertConfig *mylego.CertConfig `mapstructure:"CertConfig"`
EnableDNS bool `mapstructure:"EnableDNS"`
DNSType string `mapstructure:"DNSType"`
DisableUploadTraffic bool `mapstructure:"DisableUploadTraffic"`
DisableGetRule bool `mapstructure:"DisableGetRule"`
EnableProxyProtocol bool `mapstructure:"EnableProxyProtocol"`
TrustedXForwardedFor []string `mapstructure:"TrustedXForwardedFor"`
EnableFallback bool `mapstructure:"EnableFallback"`
DisableIVCheck bool `mapstructure:"DisableIVCheck"`
DisableSniffing bool `mapstructure:"DisableSniffing"`
AutoSpeedLimitConfig *AutoSpeedLimitConfig `mapstructure:"AutoSpeedLimitConfig"`
GlobalDeviceLimitConfig *limiter.GlobalDeviceLimitConfig `mapstructure:"GlobalDeviceLimitConfig"`
FallBackConfigs []*FallBackConfig `mapstructure:"FallBackConfigs"`
DisableLocalREALITYConfig bool `mapstructure:"DisableLocalREALITYConfig"`
EnableREALITY bool `mapstructure:"EnableREALITY"`
REALITYConfigs *REALITYConfig `mapstructure:"REALITYConfigs"`
WebSocketConfig *WebSocketConfig `mapstructure:"WebSocketConfig"`
ShowErrorDetails bool `mapstructure:"-"`
GlobalPanelType string `mapstructure:"-"`
// contains filtered or unexported fields
}
func (*Config) CaptureLocalCertConfig ¶
func (config *Config) CaptureLocalCertConfig()
CaptureLocalCertConfig records the certificate configuration as declared locally, before any panel snapshot is merged into it. Panel snapshots are always merged over this basis rather than over the applied certificate configuration, so a value supplied by an earlier snapshot does not persist after a later snapshot stops supplying it. It is idempotent and nil-safe: once captured, later calls keep the recorded basis instead of recapturing merged values, so both the panel materialize step and New may call it.
func (*Config) Clone ¶
Clone returns an independently owned copy of the controller configuration. The copy keeps nil versus non-nil collection semantics and detaches every pointer, slice, and map reachable from Config.
func (*Config) MergePanelCertConfig ¶
func (config *Config) MergePanelCertConfig(panel *api.XrayRCertConfig) *mylego.CertConfig
MergePanelCertConfig returns the effective certificate configuration produced by one panel snapshot over the local basis. Supplied panel values take precedence; omitted values fall back to the local basis; DNS credentials are merged per key. Content material is taken from the panel only in content mode, so private keys from earlier snapshots never leak into other modes. The basis is captured on first use if the caller has not captured it yet. The result shares no maps or pointers with the config or the snapshot.
func (*Config) ValidateGlobalDeviceLimit ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func New ¶
func New(server *core.Instance, apiClient PanelClient, config *Config, panelType string) *Controller
New return a Controller service with default parameters.
func (*Controller) AddInboundLimiter ¶
func (c *Controller) AddInboundLimiter(tag string, nodeSpeedLimit uint64, userList *[]api.UserInfo, globalDeviceLimitConfig *limiter.GlobalDeviceLimitConfig) error
func (*Controller) Close ¶
func (c *Controller) Close() error
Close implement the Close() function of the service interface.
func (*Controller) CloseContext ¶
func (c *Controller) CloseContext(parent context.Context) error
func (*Controller) DeleteInboundLimiter ¶
func (c *Controller) DeleteInboundLimiter(tag string) error
func (*Controller) ExecuteSyncAction ¶
func (c *Controller) ExecuteSyncAction(ctx context.Context, action syncAction) error
func (*Controller) GetDetectResult ¶
func (c *Controller) GetDetectResult(tag string) (*[]api.DetectResult, error)
func (*Controller) GetOnlineDevice ¶
func (c *Controller) GetOnlineDevice(tag string) (*[]api.OnlineUser, error)
func (*Controller) ObservabilitySnapshot ¶
func (c *Controller) ObservabilitySnapshot() service.RuntimeSnapshot
func (*Controller) SetWSEventRuntimeFactory ¶
func (c *Controller) SetWSEventRuntimeFactory(factory WSEventRuntimeFactory)
func (*Controller) Start ¶
func (c *Controller) Start() error
Start implement the Start() function of the service interface.
func (*Controller) StartContext ¶
func (c *Controller) StartContext(parent context.Context) error
func (*Controller) SyncAliveList ¶
func (c *Controller) SyncAliveList(tag string, aliveList map[int][]string) error
func (*Controller) SyncAliveSnapshot ¶
func (c *Controller) SyncAliveSnapshot(tag string, snapshot *api.AliveSnapshot, reportedIPs map[int][]string) error
func (*Controller) UpdateInboundLimiter ¶
func (c *Controller) UpdateInboundLimiter(tag string, updatedUserList *[]api.UserInfo) error
func (*Controller) UpdateRule ¶
func (c *Controller) UpdateRule(tag string, newRuleList []api.DetectRule) error
type FallBackConfig ¶
type NodeHandlerBuilder ¶
type NodeHandlerBuilder struct {
// contains filtered or unexported fields
}
NodeHandlerBuilder owns normalized node and configuration inputs for constructing Xray inbound and outbound handlers. Its fields are deliberately opaque because the owned inputs may contain credentials or private keys.
func NewNodeHandlerBuilder ¶
func NewNodeHandlerBuilder(config *Config, nodeInfo *api.NodeInfo) (*NodeHandlerBuilder, error)
NewNodeHandlerBuilder prepares an owned handler-construction interface. Mutating config or nodeInfo after this call does not affect later builds.
func (*NodeHandlerBuilder) BuildInbound ¶
func (b *NodeHandlerBuilder) BuildInbound(tag string) (*core.InboundHandlerConfig, error)
BuildInbound constructs an inbound handler from the owned inputs.
func (*NodeHandlerBuilder) BuildInboundWithUsers ¶
func (b *NodeHandlerBuilder) BuildInboundWithUsers(tag string, users []api.UserInfo) (*core.InboundHandlerConfig, error)
BuildInboundWithUsers constructs a Socks or HTTP inbound with embedded users.
func (*NodeHandlerBuilder) BuildOutbound ¶
func (b *NodeHandlerBuilder) BuildOutbound(tag string) (*core.OutboundHandlerConfig, error)
BuildOutbound constructs an outbound handler from the owned inputs.
type PanelClient ¶
type PanelClient = api.PanelClient
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"`
}
type WSEventRuntimeFactory ¶
type WSEventRuntimeFactory func(WSEventSubmitter) (WSRuntimeLifecycle, error)
type WSEventSubmitter ¶
type WSEventSubmitter interface {
SubmitWSEvent(*newV2board.WSEvent)
SubmitWSParseError()
SubmitWSDisconnect()
SubmitWSReconnect()
}
type WSRuntimeLifecycle ¶
type WSRuntimeLifecycle interface {
Start()
Stop()
}
type WebSocketConfig ¶
Source Files
¶
- certconfig_merge.go
- certificate.go
- config.go
- config_clone.go
- control.go
- controller.go
- devicestate.go
- errors.generated.go
- handlerbuilder.go
- inboundbuilder.go
- lifecycle.go
- nodevalue.go
- nodeviews.go
- observability.go
- outboundbuilder.go
- outboundpolicy.go
- periodic.go
- reporting.go
- state.go
- submit.go
- syncapply.go
- synccoordinator.go
- syncevent.go
- syncexecutionstate.go
- userbuilder.go
- userdiff.go
- wsruntime.go
- xray_handlers.go