service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrRankOverflow    = "无当前排名数据"
	ErrNoMoreRank      = "后续无排名数据"
	ErrUnknownRankType = "未知排名类型"
)

Variables

View Source
var (
	ServerCountRankList []*model.RankList
	OnlineCountRankList []*model.RankList
	MemTotalRankList    []*model.RankList
	MemUsedRankList     []*model.RankList
	DiskTotalRankList   []*model.RankList
	DiskUsedRankList    []*model.RankList
	Load15RankList      []*model.RankList
)
View Source
var (
	C              *cache.Cache
	UserMapLock    sync.RWMutex
	ValidUserMap   map[int64]*model.User
	InvalidUserMap map[int64]*model.User
)

Functions

func GetATAbleStringByUserID added in v0.0.3

func GetATAbleStringByUserID(userID int64) string

func GetAllRankList added in v0.0.5

func GetAllRankList(rank int) (string, error)

func GetBriefByUserID

func GetBriefByUserID(userID int64) (string, error)

func GetBriefByWebsocket

func GetBriefByWebsocket(url string) (string, error)

func GetRankByUserID

func GetRankByUserID(userID int64) (string, error)

func GetRankList added in v0.0.3

func GetRankList(rankType string, rank int) (string, error)

func GetSepRankList added in v0.0.5

func GetSepRankList(rankType string, rankPage int) (string, error)

func Init

func Init(b *tele.Bot)

func InvalidUserMapInit added in v0.0.3

func InvalidUserMapInit()

func RecordAllStatus

func RecordAllStatus()

func RecordRawStatus

func RecordRawStatus(user *model.User)

func Serve

func Serve()

func StartCronService

func StartCronService()

func SuspendUser added in v0.0.3

func SuspendUser(user *model.User)

func UpdateUserInfo added in v0.0.3

func UpdateUserInfo()

func ValidUserMapInit

func ValidUserMapInit()

Types

type Host

type Host struct {
	Platform        string   `json:"Platform"`
	PlatformVersion string   `json:"PlatformVersion"`
	CPU             []string `json:"CPU"`
	MemTotal        int64    `json:"MemTotal"`
	DiskTotal       int64    `json:"DiskTotal"`
	SwapTotal       int      `json:"SwapTotal"`
	Arch            string   `json:"Arch"`
	Virtualization  string   `json:"Virtualization"`
	BootTime        int      `json:"BootTime"`
	CountryCode     string   `json:"CountryCode"`
	Version         string   `json:"Version"`
}

type Servers

type Servers struct {
	ID           int         `json:"ID"`
	CreatedAt    time.Time   `json:"CreatedAt"`
	UpdatedAt    time.Time   `json:"UpdatedAt"`
	DeletedAt    interface{} `json:"DeletedAt"`
	Name         string      `json:"Name"`
	Tag          string      `json:"Tag"`
	DisplayIndex int         `json:"DisplayIndex"`
	Host         Host        `json:"Host"`
	State        State       `json:"State"`
	LastActive   time.Time   `json:"LastActive"`
}

type State

type State struct {
	CPU            float64 `json:"CPU"`
	MemUsed        int64   `json:"MemUsed"`
	SwapUsed       int     `json:"SwapUsed"`
	DiskUsed       int64   `json:"DiskUsed"`
	NetInTransfer  int64   `json:"NetInTransfer"`
	NetOutTransfer int64   `json:"NetOutTransfer"`
	NetInSpeed     int     `json:"NetInSpeed"`
	NetOutSpeed    int     `json:"NetOutSpeed"`
	Uptime         int     `json:"Uptime"`
	Load1          float64 `json:"Load1"`
	Load5          float64 `json:"Load5"`
	Load15         float64 `json:"Load15"`
	TCPConnCount   int     `json:"TcpConnCount"`
	UDPConnCount   int     `json:"UdpConnCount"`
	ProcessCount   int     `json:"ProcessCount"`
}

type UserMgr

type UserMgr struct {
	UserID    int64
	UserName  string
	FirstName string
	LastName  string
	URL       string
	Token     string
}

func (*UserMgr) Override

func (um *UserMgr) Override() error

func (*UserMgr) SetURL

func (um *UserMgr) SetURL() error

SetURL 注册用户

type WebsocketMsg

type WebsocketMsg struct {
	Now     int64     `json:"now"`
	Servers []Servers `json:"servers"`
}

func GetWebsocketMsg

func GetWebsocketMsg(url string) (*WebsocketMsg, error)

Jump to

Keyboard shortcuts

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