Documentation
¶
Index ¶
- type Client
- func (c *Client) AddClient(ctx context.Context, data map[string]any) (*Response, error)
- func (c *Client) ClearClientIPs(ctx context.Context, email string) (*Response, error)
- func (c *Client) CreateInbound(ctx context.Context, data map[string]any) (*Response, error)
- func (c *Client) DeleteClient(ctx context.Context, inboundID int, clientID string) (*Response, error)
- func (c *Client) DeleteClientByEmail(ctx context.Context, inboundID int, email string) (*Response, error)
- func (c *Client) DeleteDepletedClients(ctx context.Context, inboundID int) (*Response, error)
- func (c *Client) DeleteInbound(ctx context.Context, id int) (*Response, error)
- func (c *Client) Get(ctx context.Context, path string) (*Response, error)
- func (c *Client) GetClientIPs(ctx context.Context, email string) (*Response, error)
- func (c *Client) GetClientTraffic(ctx context.Context, email string) (*Response, error)
- func (c *Client) GetClientTrafficByID(ctx context.Context, id string) (*Response, error)
- func (c *Client) GetDefaultXrayConfig(ctx context.Context) (*Response, error)
- func (c *Client) GetInbound(ctx context.Context, id int) (*Response, error)
- func (c *Client) GetLastOnline(ctx context.Context) (*Response, error)
- func (c *Client) GetLogs(ctx context.Context, count int, level, syslog string) (*Response, error)
- func (c *Client) GetOnlineClients(ctx context.Context) (*Response, error)
- func (c *Client) GetOutboundsTraffic(ctx context.Context) (*Response, error)
- func (c *Client) GetSettings(ctx context.Context) (*Response, error)
- func (c *Client) GetXrayConfig(ctx context.Context) (*Response, error)
- func (c *Client) GetXrayLogs(ctx context.Context, count int, filter string) (*Response, error)
- func (c *Client) GetXrayResult(ctx context.Context) (*Response, error)
- func (c *Client) GetXrayTemplate(ctx context.Context) (*Response, error)
- func (c *Client) GetXrayVersions(ctx context.Context) (*Response, error)
- func (c *Client) ImportInbound(ctx context.Context, jsonData string) (*Response, error)
- func (c *Client) InstallXray(ctx context.Context, version string) (*Response, error)
- func (c *Client) ListInbounds(ctx context.Context) (*Response, error)
- func (c *Client) Post(ctx context.Context, path string) (*Response, error)
- func (c *Client) PostForm(ctx context.Context, path string, data url.Values) (*Response, error)
- func (c *Client) PostJSON(ctx context.Context, path string, data any) (*Response, error)
- func (c *Client) ResetAllClientTraffics(ctx context.Context, inboundID int) (*Response, error)
- func (c *Client) ResetAllTraffics(ctx context.Context) (*Response, error)
- func (c *Client) ResetClientTraffic(ctx context.Context, inboundID int, email string) (*Response, error)
- func (c *Client) ResetOutboundTraffic(ctx context.Context, tag string) (*Response, error)
- func (c *Client) RestartPanel(ctx context.Context) (*Response, error)
- func (c *Client) RestartXray(ctx context.Context) (*Response, error)
- func (c *Client) SearchInbounds(ctx context.Context, query string) (*Response, error)
- func (c *Client) ServerStatus(ctx context.Context) (*Response, error)
- func (c *Client) StopXray(ctx context.Context) (*Response, error)
- func (c *Client) TestOutbound(ctx context.Context, outbound string) (*Response, error)
- func (c *Client) UpdateClient(ctx context.Context, clientID string, data map[string]any) (*Response, error)
- func (c *Client) UpdateClientTraffic(ctx context.Context, email string, upload, download int64) (*Response, error)
- func (c *Client) UpdateInbound(ctx context.Context, id int, data map[string]any) (*Response, error)
- func (c *Client) UpdateSettings(ctx context.Context, data map[string]any) (*Response, error)
- func (c *Client) UpdateXrayTemplate(ctx context.Context, xraySetting string, outboundTestUrl string) (*Response, error)
- type ClientConfig
- type Inbound
- type InboundSettings
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the 3x-ui panel API. It manages session-based authentication transparently.
func (*Client) AddClient ¶
AddClient adds a client to an inbound. data must contain "id" (inbound ID) and "settings" (JSON string with clients array).
func (*Client) ClearClientIPs ¶
ClearClientIPs clears recorded IP addresses for a client.
func (*Client) CreateInbound ¶
CreateInbound creates a new inbound. data should contain all inbound fields.
func (*Client) DeleteClient ¶
func (c *Client) DeleteClient(ctx context.Context, inboundID int, clientID string) (*Response, error)
DeleteClient removes a client from an inbound by inbound ID and client UUID.
func (*Client) DeleteClientByEmail ¶
func (c *Client) DeleteClientByEmail(ctx context.Context, inboundID int, email string) (*Response, error)
DeleteClientByEmail removes a client from an inbound by email.
func (*Client) DeleteDepletedClients ¶
DeleteDepletedClients removes clients that exhausted their traffic/time.
func (*Client) DeleteInbound ¶
DeleteInbound removes an inbound by ID.
func (*Client) GetClientIPs ¶
GetClientIPs returns IP addresses recorded for a client.
func (*Client) GetClientTraffic ¶
GetClientTraffic returns traffic stats for a client by email.
func (*Client) GetClientTrafficByID ¶
GetClientTrafficByID returns traffic stats for a client by UUID.
func (*Client) GetDefaultXrayConfig ¶
GetDefaultXrayConfig returns the default Xray configuration template.
func (*Client) GetInbound ¶
GetInbound returns a single inbound by ID.
func (*Client) GetLastOnline ¶
GetLastOnline returns last online timestamps for all clients.
func (*Client) GetOnlineClients ¶
GetOnlineClients returns currently connected clients.
func (*Client) GetOutboundsTraffic ¶
GetOutboundsTraffic returns traffic statistics for all outbounds.
func (*Client) GetSettings ¶
GetSettings returns all panel settings.
func (*Client) GetXrayConfig ¶
GetXrayConfig returns the current Xray JSON configuration.
func (*Client) GetXrayLogs ¶
GetXrayLogs returns Xray proxy logs with optional filtering.
func (*Client) GetXrayResult ¶
GetXrayResult returns the current Xray service operational status.
func (*Client) GetXrayTemplate ¶
GetXrayTemplate returns the current Xray template config, inbound tags, and test URL. Response obj contains: xraySetting (JSON string), inboundTags ([]string), outboundTestUrl (string).
func (*Client) GetXrayVersions ¶
GetXrayVersions returns available Xray versions.
func (*Client) ImportInbound ¶
ImportInbound imports an inbound from JSON data (form field "data").
func (*Client) InstallXray ¶
InstallXray installs a specific Xray version.
func (*Client) ListInbounds ¶
ListInbounds returns all inbounds configured on the panel.
func (*Client) ResetAllClientTraffics ¶
ResetAllClientTraffics resets traffic for all clients in an inbound.
func (*Client) ResetAllTraffics ¶
ResetAllTraffics resets all inbound traffic counters.
func (*Client) ResetClientTraffic ¶
func (c *Client) ResetClientTraffic(ctx context.Context, inboundID int, email string) (*Response, error)
ResetClientTraffic resets traffic counters for a client within an inbound.
func (*Client) ResetOutboundTraffic ¶
ResetOutboundTraffic resets traffic counters for a specific outbound tag.
func (*Client) RestartPanel ¶
RestartPanel restarts the 3x-ui panel itself.
func (*Client) RestartXray ¶
RestartXray restarts the Xray proxy service.
func (*Client) SearchInbounds ¶
SearchInbounds searches inbounds (via query, not a standard API — reserved for extension).
func (*Client) ServerStatus ¶
ServerStatus returns current server resource usage (CPU, RAM, disk, etc).
func (*Client) TestOutbound ¶
TestOutbound tests an outbound configuration for connectivity.
func (*Client) UpdateClient ¶
func (c *Client) UpdateClient(ctx context.Context, clientID string, data map[string]any) (*Response, error)
UpdateClient updates a client within an inbound. clientID is the UUID/ID of the client to update.
func (*Client) UpdateClientTraffic ¶
func (c *Client) UpdateClientTraffic(ctx context.Context, email string, upload, download int64) (*Response, error)
UpdateClientTraffic sets specific traffic values for a client.
func (*Client) UpdateInbound ¶
UpdateInbound updates an existing inbound by ID.
func (*Client) UpdateSettings ¶
UpdateSettings updates panel settings.
type ClientConfig ¶
type ClientConfig struct {
ID string `json:"id,omitempty"`
Password string `json:"password,omitempty"`
Flow string `json:"flow,omitempty"`
Email string `json:"email"`
LimitIP int `json:"limitIp"`
TotalGB int64 `json:"totalGB"`
ExpiryTime int64 `json:"expiryTime"`
Enable bool `json:"enable"`
TgID int64 `json:"tgId"`
SubID string `json:"subId"`
Comment string `json:"comment,omitempty"`
Reset int `json:"reset"`
}
ClientConfig represents a client within an inbound's settings JSON.
type Inbound ¶
type Inbound struct {
ID int `json:"id"`
Up int64 `json:"up"`
Down int64 `json:"down"`
Total int64 `json:"total"`
Remark string `json:"remark"`
Enable bool `json:"enable"`
ExpiryTime int64 `json:"expiryTime"`
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"`
}
Inbound represents a 3x-ui inbound connection.
type InboundSettings ¶
type InboundSettings struct {
Clients []ClientConfig `json:"clients"`
}
InboundSettings wraps the clients array within inbound settings JSON.