airgo

package
v0.0.0-...-0cae4bf Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HyTrafficStats      = "http://127.0.0.1:7654/traffic"         //默认流量统计 API
	HyTrafficStatsClear = "http://127.0.0.1:7654/traffic?clear=1" //默认流量统计 API
)

Variables

This section is empty.

Functions

func ReadDate

func ReadDate[T any](resp *http.Response) (T, error)

Types

type ApiClient

type ApiClient struct {
	Client   *resty.Client
	ETags    map[string]string
	Panel    api.Panel
	UserList map[string]string
	// contains filtered or unexported fields
}

func New

func New(p api.Panel) *ApiClient

func (*ApiClient) Authenticate

func (a *ApiClient) Authenticate(addr net.Addr, auth string, tx uint64) (ok bool, id string)

func (*ApiClient) GetNodeInfo

func (a *ApiClient) GetNodeInfo() (*api.NodeInfo, error)

func (*ApiClient) GetUserList

func (a *ApiClient) GetUserList() error

func (*ApiClient) ReportNodeStatus

func (a *ApiClient) ReportNodeStatus() error

func (*ApiClient) ReportUserTraffic

func (a *ApiClient) ReportUserTraffic() error

type NodeInfoResponse

type NodeInfoResponse struct {
	ID             uint32 `json:"id"`
	NodeSpeedLimit uint64 `json:"node_speed_limit"`
	TrafficRate    uint32 `json:"traffic_rate"`
	Protocol       string `json:"protocol"`
	Remarks        string `json:"remarks"`
	Address        string `json:"address"`
	Port           uint32 `json:"port"`
	Host           string `json:"host"`
}

type NodeStatus

type NodeStatus struct {
	ID uint32 `json:"id"`
	NodeStatusItem
}

type NodeStatusItem

type NodeStatusItem struct {
	CPU    float64
	Mem    float64
	Disk   float64
	Uptime uint64
}

type UserResponse

type UserResponse struct {
	ID   uint32 `json:"id"`
	UUID string `json:"uuid"`
}

type UserTrafficRequest

type UserTrafficRequest struct {
	ID          uint32            `json:"id"`
	UserTraffic []api.UserTraffic `json:"user_traffic"`
}

Jump to

Keyboard shortcuts

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