Documentation
¶
Index ¶
- func GenerateShortId(length int) string
- type AddClientRequest
- type ApiResponse
- type Client
- func (c *Client) AddClient(ctx context.Context, inboundId uint, clients []XrayClient) (*ApiResponse, error)
- func (c *Client) DeleteClient(ctx context.Context, inboundId uint, clientUuid string) (*ApiResponse, error)
- func (c *Client) Do(ctx context.Context, method, path string, in, out interface{}) error
- func (c *Client) DoForm(ctx context.Context, method, path string, form url.Values, out interface{}) error
- func (c *Client) DoRaw(ctx context.Context, method, baseurl, path, contentType string, body []byte) ([]byte, error)
- func (c *Client) EditPanelSettings(ctx context.Context, settings PanelSettings) error
- func (c *Client) GetClientByEmail(ctx context.Context, email string) (*ClientStat, error)
- func (c *Client) GetInbound(ctx context.Context, inbound_id uint) (*GetInboundResponse, error)
- func (c *Client) GetInbounds(ctx context.Context) (*GetInboundsResponse, error)
- func (c *Client) GetNewX25519Cert(ctx context.Context) (*X25519Response, error)
- func (c *Client) GetOnlineClients(ctx context.Context) ([]string, error)
- func (c *Client) GetPanelSettings(ctx context.Context) (*PanelSettingsResponse, error)
- func (c *Client) GetSubJson(ctx context.Context, subID string) ([]byte, error)
- func (c *Client) RestartPanel(ctx context.Context) (*ApiResponse, error)
- func (c *Client) ServerStatus(ctx context.Context) (*ServerStatusResponse, error)
- func (c *Client) UpdateClient(ctx context.Context, inboundId uint, clientId string, clients []XrayClient) (*ApiResponse, error)
- type ClientOptions
- type ClientSettings
- type ClientStat
- type Config
- type FallbackOptions
- type GetClientResponse
- type GetInboundResponse
- type GetInboundsResponse
- type HeaderSetting
- type Inbound
- type InboundSetting
- type PanelSettings
- type PanelSettingsResponse
- type ProcessState
- type QuicSetting
- type QuicStreamSetting
- type RealitySettings
- type RealitySettingsInner
- type ServerStatusResponse
- type SniffingSetting
- type TcpSetting
- type TcpStreamSetting
- type UpdateClientRequest
- type VlessSetting
- type VmessSetting
- type X25519Response
- type XhttpSetting
- type XhttpStreamSetting
- type XrayClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateShortId ¶
Specified in hex strings, with the length as multiples of 2. Cannot be longer than 16 characters.
Types ¶
type AddClientRequest ¶
type ApiResponse ¶
type ApiResponse struct {
Success bool `json:"success"`
Msg string `json:"msg"`
Obj json.RawMessage `json:"obj"`
}
Generic API response
func AddInbound ¶
func AddInbound[T VlessSetting | VmessSetting, K TcpStreamSetting | QuicStreamSetting | XhttpStreamSetting](ctx context.Context, c *Client, inOpt InboundSetting, pOpt T, strOpt K, sniOpt SniffingSetting) (*ApiResponse, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddClient ¶
func (c *Client) AddClient(ctx context.Context, inboundId uint, clients []XrayClient) (*ApiResponse, error)
Add client to an inbound.
func (*Client) DeleteClient ¶
func (c *Client) DeleteClient(ctx context.Context, inboundId uint, clientUuid string) (*ApiResponse, error)
Add client to an inbound.
func (*Client) EditPanelSettings ¶
func (c *Client) EditPanelSettings(ctx context.Context, settings PanelSettings) error
func (*Client) GetClientByEmail ¶ added in v1.0.5
func (*Client) GetInbound ¶
func (*Client) GetInbounds ¶
func (c *Client) GetInbounds(ctx context.Context) (*GetInboundsResponse, error)
func (*Client) GetNewX25519Cert ¶
func (c *Client) GetNewX25519Cert(ctx context.Context) (*X25519Response, error)
Get keys for use in inbound creation
func (*Client) GetOnlineClients ¶
Get online clients. Returns a slice of client IDs/emails.
func (*Client) GetPanelSettings ¶
func (c *Client) GetPanelSettings(ctx context.Context) (*PanelSettingsResponse, error)
func (*Client) GetSubJson ¶
func (*Client) RestartPanel ¶
func (c *Client) RestartPanel(ctx context.Context) (*ApiResponse, error)
func (*Client) ServerStatus ¶
func (c *Client) ServerStatus(ctx context.Context) (*ServerStatusResponse, error)
func (*Client) UpdateClient ¶
func (c *Client) UpdateClient(ctx context.Context, inboundId uint, clientId string, clients []XrayClient) (*ApiResponse, error)
Update client in inbound.
type ClientOptions ¶
type ClientOptions struct {
ID string `json:"id"`
Flow string `json:"flow"`
Email string `json:"email"`
LimitIp int `json:"limitIp"`
TotalGb int `json:"totalGB"`
ExpiryTime int `json:"expiryTime"`
Enable bool `json:"enable"`
TgId string `json:"tgId"`
SubId string `json:"subId"`
Reset int `json:"reset"`
}
type ClientSettings ¶
type ClientSettings struct {
Clients []XrayClient `json:"clients"`
}
type ClientStat ¶
type FallbackOptions ¶
type GetClientResponse ¶ added in v1.0.5
type GetClientResponse struct {
Success bool `json:"success"`
Msg string `json:"msg"`
Obj ClientStat `json:"obj"`
}
type GetInboundResponse ¶
type GetInboundsResponse ¶
type HeaderSetting ¶
type HeaderSetting struct {
Type string `json:"type"`
}
type Inbound ¶
type Inbound struct {
ID int `json:"id"`
Up int `json:"up"`
Down int `json:"down"`
Total int `json:"total"`
Remark string `json:"remark"`
Enable bool `json:"enable"`
ExpiryTime int `json:"expiryTime"`
ClientStats []ClientStat `json:"clientStats"`
Listen string `json:"listen"`
Port int `json:"port"`
Protocol string `json:"protocol"`
Settings string `json:"settings"`
StreamSettings string `json:"streamSettings"`
Tag string `json:"tag"`
Sniffing string `json:"sniffing"`
}
type InboundSetting ¶
type InboundSetting struct {
Up, Down, Total, Remark, Enable, ExpiryTime, Listen, Port, Protocol string
}
type PanelSettings ¶
type PanelSettings struct {
WebListen string `json:"webListen"`
WebDomain string `json:"webDomain"`
WebPort int `json:"webPort"`
WebCertFile string `json:"webCertFile"`
WebKeyFile string `json:"webKeyFile"`
WebBasePath string `json:"webBasePath"`
SessionMaxAge int `json:"sessionMaxAge"`
PageSize int `json:"pageSize"`
ExpireDiff int `json:"expireDiff"`
TrafficDiff int `json:"trafficDiff"`
RemarkModel string `json:"remarkModel"`
TgBotEnable bool `json:"tgBotEnable"`
TgBotToken string `json:"tgBotToken"`
TgBotProxy string `json:"tgBotProxy"`
TgBotChatId string `json:"tgBotChatId"`
TgRunTime string `json:"tgRunTime"`
TgBotBackup bool `json:"tgBotBackup"`
TgBotLoginNotify bool `json:"tgBotLoginNotify"`
TgCpu int `json:"tgCpu"`
TgLang string `json:"tgLang"`
TimeLocation string `json:"timeLocation"`
SecretEnable bool `json:"secretEnable"`
SubEnable bool `json:"subEnable"`
SubListen string `json:"subListen"`
SubPort int `json:"subPort"`
SubPath string `json:"subPath"`
SubDomain string `json:"subDomain"`
SubCertFile string `json:"subCertFile"`
SubKeyFile string `json:"subKeyFile"`
SubUpdates int `json:"subUpdates"`
SubEncrypt bool `json:"subEncrypt"`
SubShowInfo bool `json:"subShowInfo"`
SubURI string `json:"subURI"`
SubJsonPath string `json:"subJsonPath"`
SubJsonURI string `json:"subJsonURI"`
SubJsonFragment string `json:"subJsonFragment"`
SubJsonMux string `json:"subJsonMux"`
SubJsonRules string `json:"subJsonRules"`
Datepicker string `json:"datepicker"`
}
type PanelSettingsResponse ¶
type PanelSettingsResponse struct {
Success bool `json:"success"`
Msg string `json:"msg"`
Obj *PanelSettings `json:"obj"`
}
type ProcessState ¶
type ProcessState string
const ( Running ProcessState = "running" Stop ProcessState = "stop" Error ProcessState = "error" )
type QuicSetting ¶
type QuicSetting struct {
Security string `json:"security"`
Key string `json:"key"`
Header HeaderSetting `json:"header"`
}
QUIC was deprecated in favor of XHTTP in Xray-core v24.9.30
type QuicStreamSetting ¶
type QuicStreamSetting struct {
Network string `json:"network"`
Security string `json:"security"`
ExternalProxy []string `json:"externalProxy"`
QuicSettings QuicSetting `json:"quicSettings"`
}
type RealitySettings ¶
type RealitySettings struct {
Show bool `json:"show"`
Xver int `json:"xver"`
Dest string `json:"dest"`
ServerNames []string `json:"serverNames"`
PrivateKey string `json:"privateKey"`
MinClient string `json:"minClient"`
MaxClient string `json:"maxClient"`
MaxTimediff int `json:"maxTimediff"`
ShortIds []string `json:"shortIds"`
Settings RealitySettingsInner `json:"settings"`
}
type RealitySettingsInner ¶
type ServerStatusResponse ¶
type ServerStatusResponse struct {
Success bool `json:"success"`
Msg string `json:"msg"`
Obj *struct {
Cpu float64 `json:"cpu"`
CpuCores int `json:"cpuCores"`
CpuSpeedMhz float64 `json:"cpuSpeedMhz"`
Mem struct {
Current uint64 `json:"current"`
Total uint64 `json:"total"`
} `json:"mem"`
Swap struct {
Current uint64 `json:"current"`
Total uint64 `json:"total"`
} `json:"swap"`
Disk struct {
Current uint64 `json:"current"`
Total uint64 `json:"total"`
} `json:"disk"`
Xray struct {
State ProcessState `json:"state"`
ErrorMsg string `json:"errorMsg"`
Version string `json:"version"`
} `json:"xray"`
Uptime uint64 `json:"uptime"`
Loads []float64 `json:"loads"`
TcpCount int `json:"tcpCount"`
UdpCount int `json:"udpCount"`
NetIO struct {
Up uint64 `json:"up"`
Down uint64 `json:"down"`
} `json:"netIO"`
NetTraffic struct {
Sent uint64 `json:"sent"`
Recv uint64 `json:"recv"`
} `json:"netTraffic"`
PublicIP struct {
IPv4 string `json:"ipv4"`
IPv6 string `json:"ipv6"`
} `json:"publicIP"`
AppStats struct {
Threads uint32 `json:"threads"`
Mem uint64 `json:"mem"`
Uptime uint64 `json:"uptime"`
} `json:"appStats"`
} `json:"obj"`
}
type SniffingSetting ¶
type TcpSetting ¶
type TcpSetting struct {
AcceptProxyProtocol bool `json:"acceptProxyProtocol"`
Header HeaderSetting `json:"header"`
}
type TcpStreamSetting ¶
type TcpStreamSetting struct {
Network string `json:"network"`
Security string `json:"security"`
ExternalProxy []string `json:"externalProxy"`
TcpSettings TcpSetting `json:"tcpSettings"`
}
type UpdateClientRequest ¶
type VlessSetting ¶
type VlessSetting struct {
Clients []ClientOptions `json:"clients"`
Decryption string `json:"decryption"`
Fallbacks []FallbackOptions `json:"fallbacks"`
}
type VmessSetting ¶
type VmessSetting struct {
Clients []ClientOptions `json:"clients"`
}
type X25519Response ¶
type XhttpSetting ¶
type XhttpSetting struct {
Path string `json:"path"`
Host string `json:"host"`
Headers map[string]string `json:"headers"`
ScMaxBufferedPosts int `json:"scMaxBufferedPosts"`
ScMaxEachPostBytes string `json:"scMaxEachPostBytes"`
NoSSEHeader bool `json:"noSSEHeader"`
XPaddingBytes string `json:"xPaddingBytes"`
Mode string `json:"mode"`
}
type XhttpStreamSetting ¶
type XhttpStreamSetting struct {
Network string `json:"network"`
Security string `json:"security"`
ExternalProxy []string `json:"externalProxy"`
RealitySettings RealitySettings `json:"realitySettings"`
XhttpSettings XhttpSetting `json:"xhttpSettings"`
}
type XrayClient ¶
type XrayClient struct {
ID string `json:"id"`
AlterID uint `json:"alter_id,omitempty"`
Email string `json:"email"`
LimitIP uint `json:"limitIp"`
TotalGB uint64 `json:"totalGB"`
ExpiryTime int64 `json:"expiryTime"`
Enable bool `json:"enable"`
TgID uint `json:"tgId"`
SubID string `json:"subId"`
Flow string `json:"flow"`
}
Click to show internal directories.
Click to hide internal directories.
