Documentation
¶
Index ¶
- Constants
- type Config
- type Core
- func (c *Core) ClearStartupDiagnostics()
- func (c *Core) CloseLogs()
- func (c *Core) DisableStartupDiagnostics()
- func (c *Core) EnableStartupDiagnostics(tailSize int)
- func (c *Core) GenerateConfigFile(config []byte) error
- func (c *Core) LatestStartupFailure() string
- func (c *Core) RecordRuntimeLog(line string)
- func (c *Core) RecordStartupLog(line string)
- func (c *Core) Restart(config *Config, debugMode bool) error
- func (c *Core) Restarting() bool
- func (c *Core) RuntimeLogTail(n int) []string
- func (c *Core) Start(xConfig *Config, debugMode bool) error
- func (c *Core) Started() bool
- func (c *Core) StartupLogTail(n int) []string
- func (c *Core) Stop()
- func (c *Core) Stopping() bool
- func (c *Core) SubscribeLogs(ctx context.Context) <-chan string
- func (c *Core) SwitchToRuntimeLogPhase()
- func (c *Core) Version() string
- type Inbound
- type ProcessInfo
- type Protocol
- type Stats
- type Xray
- func (x *Xray) AddRoutingRule(ctx context.Context, ruleJSON string, shouldAppend bool) error
- func (x *Xray) ApplyConfigLive(ctx context.Context, rawConfig string, exclude []string) (bool, error)
- func (x *Xray) GetBalancerInfo(ctx context.Context, tag string) (*common.BalancerInfoResponse, error)
- func (x *Xray) GetOutboundsLatency(ctx context.Context, request *common.LatencyRequest) (*common.LatencyResponse, error)
- func (x *Xray) GetStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error)
- func (x *Xray) GetSysStats(ctx context.Context) (*common.BackendStatsResponse, error)
- func (x *Xray) GetUserOnlineIpListStats(ctx context.Context, email string) (*common.StatsOnlineIpListResponse, error)
- func (x *Xray) GetUserOnlineStats(ctx context.Context, email string) (*common.OnlineStatResponse, error)
- func (x *Xray) ListRoutingRules(ctx context.Context) (*common.RoutingRulesResponse, error)
- func (x *Xray) OverrideBalancerTarget(ctx context.Context, balancerTag, target string) error
- func (x *Xray) RemoveRoutingRule(ctx context.Context, ruleTag string) error
- func (x *Xray) Restart() error
- func (x *Xray) Shutdown()
- func (x *Xray) Started() bool
- func (x *Xray) SubscribeLogs(ctx context.Context) <-chan string
- func (x *Xray) SyncUser(ctx context.Context, user *common.User) error
- func (x *Xray) SyncUsers(ctx context.Context, users []*common.User) error
- func (x *Xray) TestRoute(ctx context.Context, req *common.TestRouteRequest) (*common.RouteResult, error)
- func (x *Xray) UpdateUsers(ctx context.Context, users []*common.User) error
- func (x *Xray) UpdateUsersAndRestart(ctx context.Context, users []*common.User) error
- func (x *Xray) Version() string
Constants ¶
View Source
const ( Vmess = "vmess" Vless = "vless" Trojan = "trojan" Shadowsocks = "shadowsocks" Hysteria = "hysteria" Wireguard = "wireguard" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
LogConfig *conf.LogConfig `json:"log"`
RouterConfig *conf.RouterConfig `json:"routing"`
DNSConfig map[string]any `json:"dns"`
InboundConfigs []*Inbound `json:"inbounds"`
OutboundConfigs any `json:"outbounds"`
Policy *conf.PolicyConfig `json:"policy"`
API *conf.APIConfig `json:"api"`
Metrics map[string]any `json:"metrics,omitempty"`
Stats Stats `json:"stats"`
Reverse map[string]any `json:"reverse,omitempty"`
FakeDNS map[string]any `json:"fakeDns,omitempty"`
Observatory map[string]any `json:"observatory,omitempty"`
BurstObservatory map[string]any `json:"burstObservatory,omitempty"`
}
func (*Config) GetLogFiles ¶ added in v0.2.6
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func NewXRayCore ¶
func (*Core) ClearStartupDiagnostics ¶ added in v0.2.9
func (c *Core) ClearStartupDiagnostics()
func (*Core) DisableStartupDiagnostics ¶ added in v0.2.9
func (c *Core) DisableStartupDiagnostics()
func (*Core) EnableStartupDiagnostics ¶ added in v0.2.9
func (*Core) GenerateConfigFile ¶
func (*Core) LatestStartupFailure ¶ added in v0.2.9
func (*Core) RecordRuntimeLog ¶ added in v0.5.0
func (*Core) RecordStartupLog ¶ added in v0.2.9
func (*Core) Restarting ¶ added in v0.5.0
func (*Core) RuntimeLogTail ¶ added in v0.5.0
func (*Core) StartupLogTail ¶ added in v0.2.9
func (*Core) SubscribeLogs ¶ added in v0.5.5
func (*Core) SwitchToRuntimeLogPhase ¶ added in v0.2.9
func (c *Core) SwitchToRuntimeLogPhase()
type Inbound ¶
type Inbound struct {
Tag string `json:"tag"`
Listen string `json:"listen,omitempty"`
Port any `json:"port,omitempty"`
Protocol string `json:"protocol"`
Settings map[string]any `json:"settings"`
StreamSettings map[string]any `json:"streamSettings,omitempty"`
Sniffing any `json:"sniffing,omitempty"`
Allocation map[string]any `json:"allocate,omitempty"`
// contains filtered or unexported fields
}
type ProcessInfo ¶ added in v0.1.2
ProcessInfo holds information about a process
type Xray ¶
type Xray struct {
// contains filtered or unexported fields
}
Lock order: syncMu, then mu, then core.mu. syncMu serializes user syncs and restarts; Shutdown takes only mu, so it never waits for a sync.
func (*Xray) AddRoutingRule ¶ added in v0.5.4
func (*Xray) ApplyConfigLive ¶ added in v0.5.5
func (x *Xray) ApplyConfigLive(ctx context.Context, rawConfig string, exclude []string) (bool, error)
ApplyConfigLive applies a new panel config to the running xray through its API when it differs only in routing rules, balancers and outbounds that can be swapped live. It returns false when the change needs a restart.
func (*Xray) GetBalancerInfo ¶ added in v0.5.4
func (*Xray) GetOutboundsLatency ¶ added in v0.4.1
func (x *Xray) GetOutboundsLatency(ctx context.Context, request *common.LatencyRequest) (*common.LatencyResponse, error)
func (*Xray) GetStats ¶
func (x *Xray) GetStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error)
func (*Xray) GetSysStats ¶
func (*Xray) GetUserOnlineIpListStats ¶
func (*Xray) GetUserOnlineStats ¶
func (*Xray) ListRoutingRules ¶ added in v0.5.4
func (*Xray) OverrideBalancerTarget ¶ added in v0.5.4
func (*Xray) RemoveRoutingRule ¶ added in v0.5.4
func (*Xray) Restart ¶
Restart restarts the core from the current config and waits until its API answers.
func (*Xray) SubscribeLogs ¶ added in v0.5.5
func (*Xray) TestRoute ¶ added in v0.5.4
func (x *Xray) TestRoute(ctx context.Context, req *common.TestRouteRequest) (*common.RouteResult, error)
func (*Xray) UpdateUsers ¶ added in v0.2.0
func (*Xray) UpdateUsersAndRestart ¶ added in v0.2.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.