serv

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 38 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MSG_GET_TRAFFIC_DATA_RESPONSE = "monitor_getTrafficData"
	MSG_GET_DIST_USAGE_RESPONSE   = "monitor_getDiskUsage"
	MSG_GET_PEER_LIST             = "monitor_getPeerList"
	MSG_GET_ONLINE_STATE          = "monitor_getOnlineState"
	MSG_GET_NODE_DETAILS          = "monitor_getNodeDetails"
)
View Source
const (
	DefaultMsg               = "Request Accepted"
	DefaultDesiredUploadTier = 2
)

Variables

This section is empty.

Functions

func CreateInitialToken added in v0.9.0

func CreateInitialToken() string

CreateInitialToken the initial token is used to generate all following tokens

func GetCurrentToken added in v0.9.0

func GetCurrentToken() string

GetCurrentToken

func MonitorApi added in v0.9.0

func MonitorApi() *monitorApi

func ShowMonitor

func ShowMonitor(ctx context.Context)

ShowMonitor

func StartDumpTrafficLog added in v0.5.0

func StartDumpTrafficLog(ctx context.Context)

func StopDumpTrafficLog added in v0.5.0

func StopDumpTrafficLog()

func StopMonitor

func StopMonitor()

StopMonitor

func TerminalAPI added in v0.5.0

func TerminalAPI() *terminalCmd

func TrafficInfoToMonitorClient added in v0.9.0

func TrafficInfoToMonitorClient(t TrafficInfo)

TrafficInfoToMonitorClient traffic info generator calls this to feed the notifiers to the subscribed clients

Types

type BaseServer added in v0.9.0

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

BaseServer base pp server

func (*BaseServer) Start added in v0.9.0

func (bs *BaseServer) Start() error

func (*BaseServer) Stop added in v0.9.0

func (bs *BaseServer) Stop()

type CmdResult added in v0.5.0

type CmdResult struct {
	Msg string
}

type CpuInfo added in v0.5.0

type CpuInfo struct {
	CpuInfos       []SingleCpuInfo `json:"cpu_infos"`
	CpuUsedPercent float64         `json:"cpu_used_percent"`
}

func NewCpuInfo added in v0.5.0

func NewCpuInfo(cpuInfos []SingleCpuInfo, cpuUsedPercent float64) CpuInfo

type DiskUsage added in v0.9.0

type DiskUsage struct {
	DataHost int64 `json:"data_host"`
}

type HdInfo added in v0.5.0

type HdInfo struct {
	HdTotal       uint64  `json:"hd_total"`
	HdFree        uint64  `json:"hd_free"`
	HdUsed        uint64  `json:"hd_used"`
	HdUsedPercent float64 `json:"hd_used_percent"`
}

func NewHdInfo added in v0.5.0

func NewHdInfo(hdTotal uint64, hdFree uint64, hdUsed uint64, hdUsedPercent float64) HdInfo

type MemInfo added in v0.5.0

type MemInfo struct {
	MemTotal       uint64  `json:"mem_total"`
	MemFree        uint64  `json:"mem_free"`
	MemUsed        uint64  `json:"mem_used"`
	MemUsedPercent float64 `json:"mem_used_percent"`
}

func NewMemInfo added in v0.5.0

func NewMemInfo(memTotal uint64, memFree uint64, memUsed uint64, memUsedPercent float64) MemInfo

type MonitorNotificationResult added in v0.9.0

type MonitorNotificationResult struct {
	TrafficInfo *TrafficInfo `json:"traffic_info"`
	OnlineState *OnlineState `json:"online_state,omitempty"`
	PeerList    *PeerList    `json:"peer_list,omitempty"`
	DiskUsage   *DiskUsage   `json:"disk_usage,omitempty"`
}

type MonitorResult added in v0.9.0

type MonitorResult struct {
	Return      string         `json:"return"`
	MessageType string         `json:"message_type"`
	TrafficInfo *[]TrafficInfo `json:"traffic_info,omitempty"`
	OnlineState *OnlineState   `json:"online_state,omitempty"`
	PeerList    *PeerList      `json:"peer_list,omitempty"`
	DiskUsage   *DiskUsage     `json:"disk_usage,omitempty"`
	NodeDetails *NodeDetails   `json:"node_details,omitempty"`
}

type NodeDetails added in v0.9.0

type NodeDetails struct {
	Id              string `json:"id"`
	Address         string `json:"address"`
	AdvancedDetails *[]struct {
		Id      string `json:"id"`
		Title   string `json:"title"`
		Details string `json:"details"`
	} `json:"advanced_details,omitempty"`
}

type OnlineState added in v0.9.0

type OnlineState struct {
	Online bool  `json:"online"`
	Since  int64 `json:"since"`
}

type ParamMonitor added in v0.9.0

type ParamMonitor struct {
	SubId string `json:"subid"`
}

type ParamTrafficInfo added in v0.9.0

type ParamTrafficInfo struct {
	SubId string `json:"subid"`
	Lines uint64 `json:"lines"`
}

type PeerInfo added in v0.9.0

type PeerInfo struct {
	NetworkAddress string `json:"network_address"`
	P2pAddress     string `json:"p2p_address"`
	Status         int    `json:"status"`
	Latency        int64  `json:"latency"`
	Connection     string `json:"connection"`
}

type PeerList added in v0.9.0

type PeerList struct {
	Total    int64      `json:"total"`
	PeerList []PeerInfo `json:"peerlist"`
}

type SingleCpuInfo added in v0.5.0

type SingleCpuInfo struct {
	CpuModelName string `json:"cpu_model_name"`
	CpuCores     int32  `json:"cpu_cores"`
}

func NewSingleCpuInfo added in v0.5.0

func NewSingleCpuInfo(cpuModelName string, cpuCores int32) SingleCpuInfo

type TrafficDumpInfo added in v0.5.0

type TrafficDumpInfo struct {
	MemInfo     MemInfo     `json:"mem_info"`
	CpuInfo     CpuInfo     `json:"cpu_info"`
	HdInfo      HdInfo      `json:"hd_info"`
	TrafficInfo TrafficInfo `json:"traffic_info"`
}

func NewTrafficDumpInfo added in v0.5.0

func NewTrafficDumpInfo(memInfo MemInfo, cpuInfo CpuInfo, hdInfo HdInfo, trafficInfo TrafficInfo) TrafficDumpInfo

type TrafficInfo added in v0.5.0

type TrafficInfo struct {
	TrafficInbound  uint64 `json:"traffic_inbound"`
	TrafficOutbound uint64 `json:"traffic_outbound"`
	TimeStamp       string `json:"time_stamp,omitempty"`
}

func NewTrafficInfo added in v0.5.0

func NewTrafficInfo(trafficInbound uint64, trafficOutbound uint64) TrafficInfo

Jump to

Keyboard shortcuts

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