go3xui

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 10 Imported by: 0

README

go3xui

Soon...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string
	Method  string
}

func (APIError) Error

func (e APIError) Error() string

type APIResponse

type APIResponse[T any] struct {
	Success bool   `json:"success"`
	Msg     string `json:"msg"`
	Obj     T      `json:"obj,omitempty"`
}

func (*APIResponse[T]) Err

func (response *APIResponse[T]) Err(method string) error

type Allocate

type Allocate struct {
	Strategy    string `json:"strategy"`
	Refresh     int    `json:"refresh"`
	Concurrency int    `json:"concurrency"`
}

func (*Allocate) UnmarshalJSON

func (a *Allocate) UnmarshalJSON(data []byte) error

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     int64           `json:"expiryTime"`
	ClientStats    interface{}     `json:"clientStats"`
	Listen         string          `json:"listen"`
	Port           int             `json:"port"`
	Protocol       string          `json:"protocol"`
	Settings       *Settings       `json:"settings"`
	StreamSettings *StreamSettings `json:"streamSettings"`
	Tag            string          `json:"tag"`
	Sniffing       *Sniffing       `json:"sniffing"`
	Allocate       *Allocate       `json:"allocate"`
}

type InboundClient

type InboundClient struct {
	Comment    string `json:"comment"`
	Email      string `json:"email,omitempty"`
	Password   string `json:"password,omitempty"`
	Enable     bool   `json:"enable"`
	ExpiryTime int64  `json:"expiryTime,omitempty"`
	Flow       string `json:"flow,omitempty"`
	ID         string `json:"id,omitempty"`
	LimitIp    int    `json:"limitIp,omitempty"`
	Reset      int    `json:"reset,omitempty"`
	SubId      string `json:"subId,omitempty"`
	TgId       any    `json:"tgId,omitempty"`
	TotalGB    int    `json:"totalGB,omitempty"`
}

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    struct {
		PublicKey   string `json:"publicKey"`
		Fingerprint string `json:"fingerprint"`
		ServerName  string `json:"serverName"`
		SpiderX     string `json:"spiderX"`
	} `json:"settings"`
}

type ServerStatus

type ServerStatus 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    string `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"`
}

type Settings

type Settings struct {
	Clients    []*InboundClient `json:"clients"`
	Decryption string           `json:"decryption"`
	Fallbacks  []interface{}    `json:"fallbacks"`
}

func (*Settings) UnmarshalJSON

func (s *Settings) UnmarshalJSON(data []byte) error

type Sniffing

type Sniffing struct {
	Enabled      bool     `json:"enabled"`
	DestOverride []string `json:"destOverride"`
	MetadataOnly bool     `json:"metadataOnly"`
	RouteOnly    bool     `json:"routeOnly"`
}

func (*Sniffing) UnmarshalJSON

func (sn *Sniffing) UnmarshalJSON(data []byte) error

type StreamSettings

type StreamSettings struct {
	Network         string          `json:"network"`
	Security        string          `json:"security"`
	ExternalProxy   []interface{}   `json:"externalProxy"`
	RealitySettings RealitySettings `json:"realitySettings"`
	TcpSettings     TcpSettings     `json:"tcpSettings"`
}

func (*StreamSettings) UnmarshalJSON

func (ss *StreamSettings) UnmarshalJSON(data []byte) error

type TcpSettings

type TcpSettings struct {
	AcceptProxyProtocol bool `json:"acceptProxyProtocol"`
	Header              struct {
		Type string `json:"type"`
	} `json:"header"`
}

type XUIClient

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

func NewClient

func NewClient(host, username, password string, enableLogger bool) *XUIClient

func (*XUIClient) AddClient

func (c *XUIClient) AddClient(inboundId int, inboundClient *InboundClient) error

func (*XUIClient) DeleteClient

func (c *XUIClient) DeleteClient(inboundId int, clientUuid string) error

func (*XUIClient) GetClientByEmail

func (c *XUIClient) GetClientByEmail(email string) (*InboundClient, error)

func (*XUIClient) GetIP added in v1.0.2

func (c *XUIClient) GetIP() (string, error)

func (*XUIClient) GetInbound

func (c *XUIClient) GetInbound(inboundId int) (*Inbound, error)

func (*XUIClient) GetInbounds

func (c *XUIClient) GetInbounds() ([]*Inbound, error)

func (*XUIClient) GetStatus

func (c *XUIClient) GetStatus() (*ServerStatus, error)

func (*XUIClient) UpdateClient

func (c *XUIClient) UpdateClient(inboundId int, clientUuid string, inboundClient *InboundClient) error

type XUICore

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

func (*XUICore) ApiCall

func (core *XUICore) ApiCall(method, endpoint string, data any, target any) error

func (*XUICore) Get

func (core *XUICore) Get(endpoint string, target any) (int, error)

func (*XUICore) Post

func (core *XUICore) Post(endpoint string, data any, target any) (int, error)

Jump to

Keyboard shortcuts

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