api

package
v0.0.0-...-20f078d Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalConfig config.ConfigData

Functions

func APIHandler

func APIHandler(w http.ResponseWriter, r *http.Request)

func WebSocketHandler

func WebSocketHandler(w http.ResponseWriter, r *http.Request)

WebSocketHandler 处理WebSocket连接

Types

type DetailedInfo

type DetailedInfo struct {
	Time         time.Time `json:"time"`
	IsOnline     bool      `json:"is_online"`
	Tps          float64   `json:"tps"`
	OnlinePlayer int       `json:"online_player"`
	MaxPlayer    int       `json:"max_player"`
	PlayerList   string    `json:"player_list,omitempty"`
}

type Response

type Response struct {
	Code int          `json:"code"`
	Data []ServerData `json:"data"`
}

Response 是发送给WebSocket客户端的响应结构

type ServerData

type ServerData struct {
	Time         time.Time `json:"time"`
	IsOnline     bool      `json:"is_online"`
	Tps          float64   `json:"tps"`
	OnlinePlayer int       `json:"online_player"`
	MaxPlayer    int       `json:"max_player"`
}

type ServerInfo

type ServerInfo struct {
	ServerName        string `json:"server_name"`
	ServerAddress     string `json:"server_address"`
	ServerWebsite     string `json:"server_website"`
	ServerDescription string `json:"server_description"`
}

Jump to

Keyboard shortcuts

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