xray

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Vmess       = "vmess"
	Vless       = "vless"
	Trojan      = "trojan"
	Shadowsocks = "shadowsocks"
)

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]interface{} `json:"dns"`
	InboundConfigs   []*Inbound             `json:"inbounds"`
	OutboundConfigs  interface{}            `json:"outbounds"`
	Policy           *conf.PolicyConfig     `json:"policy"`
	API              *conf.APIConfig        `json:"api"`
	Metrics          map[string]interface{} `json:"metrics,omitempty"`
	Stats            Stats                  `json:"stats"`
	Reverse          map[string]interface{} `json:"reverse,omitempty"`
	FakeDNS          map[string]interface{} `json:"fakeDns,omitempty"`
	Observatory      map[string]interface{} `json:"observatory,omitempty"`
	BurstObservatory map[string]interface{} `json:"burstObservatory,omitempty"`
}

func NewXRayConfig

func NewXRayConfig(config string, exclude []string) (*Config, error)

func (*Config) ApplyAPI

func (c *Config) ApplyAPI(apiPort int) (err error)

func (*Config) RemoveLogFiles

func (c *Config) RemoveLogFiles() (accessFile, errorFile string)

func (*Config) ToBytes

func (c *Config) ToBytes() ([]byte, error)

type Core

type Core struct {
	// contains filtered or unexported fields
}

func NewXRayCore

func NewXRayCore(executablePath, assetsPath, configPath string, logBufferSize int) (*Core, error)

func (*Core) GenerateConfigFile

func (c *Core) GenerateConfigFile(config []byte) error

func (*Core) Logs

func (c *Core) Logs() chan string

func (*Core) Restart

func (c *Core) Restart(config *Config, debugMode bool) error

func (*Core) Start

func (c *Core) Start(xConfig *Config, debugMode bool) error

func (*Core) Started

func (c *Core) Started() bool

func (*Core) Stop

func (c *Core) Stop()

func (*Core) Version

func (c *Core) Version() string

type Inbound

type Inbound struct {
	Tag            string                 `json:"tag"`
	Listen         string                 `json:"listen,omitempty"`
	Port           interface{}            `json:"port,omitempty"`
	Protocol       string                 `json:"protocol"`
	Settings       map[string]interface{} `json:"settings"`
	StreamSettings map[string]interface{} `json:"streamSettings,omitempty"`
	Sniffing       interface{}            `json:"sniffing,omitempty"`
	Allocation     map[string]interface{} `json:"allocate,omitempty"`
	// contains filtered or unexported fields
}

type Protocol

type Protocol string

type Stats

type Stats struct{}

type Xray

type Xray struct {
	// contains filtered or unexported fields
}

func NewXray

func NewXray(ctx context.Context, port int, cfg *config.Config) (*Xray, error)

func (*Xray) GetStats

func (x *Xray) GetStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error)

func (*Xray) GetSysStats

func (x *Xray) GetSysStats(ctx context.Context) (*common.BackendStatsResponse, error)

func (*Xray) GetUserOnlineIpListStats

func (x *Xray) GetUserOnlineIpListStats(ctx context.Context, email string) (*common.StatsOnlineIpListResponse, error)

func (*Xray) GetUserOnlineStats

func (x *Xray) GetUserOnlineStats(ctx context.Context, email string) (*common.OnlineStatResponse, error)

func (*Xray) Logs

func (x *Xray) Logs() chan string

func (*Xray) Restart

func (x *Xray) Restart() error

func (*Xray) Shutdown

func (x *Xray) Shutdown()

func (*Xray) Started

func (x *Xray) Started() bool

func (*Xray) SyncUser

func (x *Xray) SyncUser(ctx context.Context, user *common.User) error

func (*Xray) SyncUsers

func (x *Xray) SyncUsers(_ context.Context, users []*common.User) error

func (*Xray) Version

func (x *Xray) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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