xray

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBinaryName

func GetBinaryName() string

func GetBinaryPath

func GetBinaryPath() string

func GetConfigPath

func GetConfigPath() string

func GetGeoipPath

func GetGeoipPath() string

func GetGeositePath

func GetGeositePath() string

Types

type ClientTraffic

type ClientTraffic struct {
	Id         int    `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
	InboundId  int    `json:"inboundId" form:"inboundId"`
	Enable     bool   `json:"enable" form:"enable"`
	Email      string `json:"email" form:"email" gorm:"unique"`
	Up         int64  `json:"up" form:"up"`
	Down       int64  `json:"down" form:"down"`
	ExpiryTime int64  `json:"expiryTime" form:"expiryTime"`
	Total      int64  `json:"total" form:"total"`
	Reset      int    `json:"reset" form:"reset" gorm:"default:0"`
}

type Config

type Config struct {
	LogConfig        json_util.RawMessage `json:"log"`
	RouterConfig     json_util.RawMessage `json:"routing"`
	DNSConfig        json_util.RawMessage `json:"dns"`
	InboundConfigs   []InboundConfig      `json:"inbounds"`
	OutboundConfigs  json_util.RawMessage `json:"outbounds"`
	Transport        json_util.RawMessage `json:"transport"`
	Policy           json_util.RawMessage `json:"policy"`
	API              json_util.RawMessage `json:"api"`
	Stats            json_util.RawMessage `json:"stats"`
	Reverse          json_util.RawMessage `json:"reverse"`
	FakeDNS          json_util.RawMessage `json:"fakedns"`
	Observatory      json_util.RawMessage `json:"observatory"`
	BurstObservatory json_util.RawMessage `json:"burstObservatory"`
	Metrics          json_util.RawMessage `json:"metrics"`
}

func (*Config) Equals

func (c *Config) Equals(other *Config) bool

type InboundConfig

type InboundConfig struct {
	Listen         json_util.RawMessage `json:"listen"` // listen cannot be an empty string
	Port           int                  `json:"port"`
	Protocol       string               `json:"protocol"`
	Settings       json_util.RawMessage `json:"settings"`
	StreamSettings json_util.RawMessage `json:"streamSettings"`
	Tag            string               `json:"tag"`
	Sniffing       json_util.RawMessage `json:"sniffing"`
}

func (*InboundConfig) Equals

func (c *InboundConfig) Equals(other *InboundConfig) bool

type LogWriter

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

func NewLogWriter

func NewLogWriter() *LogWriter

func (*LogWriter) Write

func (lw *LogWriter) Write(m []byte) (n int, err error)

type Process

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

func NewProcess

func NewProcess(xrayConfig *Config) *Process

func (*Process) GetAPIPort

func (p *Process) GetAPIPort() int

func (*Process) GetConfig

func (p *Process) GetConfig() *Config

func (Process) GetErr

func (p Process) GetErr() error

func (*Process) GetOnlineClients

func (p *Process) GetOnlineClients() []string

func (Process) GetResult

func (p Process) GetResult() string

func (*Process) GetUptime

func (p *Process) GetUptime() uint64

func (Process) GetVersion

func (p Process) GetVersion() string

func (Process) IsRunning

func (p Process) IsRunning() bool

func (*Process) SetOnlineClients

func (p *Process) SetOnlineClients(users []string)

func (Process) Start

func (p Process) Start() (err error)

func (Process) Stop

func (p Process) Stop() error

type Traffic

type Traffic struct {
	IsInbound bool
	Tag       string
	Up        int64
	Down      int64
}

type XrayAPI

type XrayAPI struct {
	HandlerServiceClient *command.HandlerServiceClient
	StatsServiceClient   *statsService.StatsServiceClient
	// contains filtered or unexported fields
}

func (*XrayAPI) AddInbound

func (x *XrayAPI) AddInbound(inbound []byte) error

func (*XrayAPI) AddUser

func (x *XrayAPI) AddUser(Protocol string, inboundTag string, user map[string]interface{}) error

func (*XrayAPI) Close

func (x *XrayAPI) Close()

func (*XrayAPI) DelInbound

func (x *XrayAPI) DelInbound(tag string) error

func (*XrayAPI) GetOnlineUsers

func (x *XrayAPI) GetOnlineUsers() ([]string, error)

func (*XrayAPI) GetTraffic

func (x *XrayAPI) GetTraffic(reset bool) ([]*Traffic, []*ClientTraffic, error)

func (*XrayAPI) Init

func (x *XrayAPI) Init(apiPort int) (err error)

func (*XrayAPI) RemoveUser

func (x *XrayAPI) RemoveUser(inboundTag string, email string) error

Jump to

Keyboard shortcuts

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