MotdBEAPI

package module
v0.0.0-...-f34c330 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

MotdBE协议封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MotdBEInfo

type MotdBEInfo struct {
	Status         string `json:"status"`           //服务器状态 (online/offline)
	Host           string `json:"host"`             //服务器Host
	Motd           string `json:"motd"`             //Motd信息
	Agreement      int    `json:"agreement"`        //协议版本
	Version        string `json:"version"`          //支持的游戏版本
	Online         int    `json:"online"`           //在线人数
	Max            int    `json:"max"`              //最大在线人数
	LevelName      string `json:"level_name"`       //存档名字
	GameMode       string `json:"gamemode"`         //游戏模式
	ServerUniqueID string `json:"server_unique_id"` //服务器唯一ID
	Delay          int64  `json:"delay"`            //连接延迟
}

MotdBE信息

func MotdBE

func MotdBE(Host string) (*MotdBEInfo, error)

*

  • @description: 通过UDP请求获取MotdBE信息
  • @param {string} Host 服务器地址,nyan.xyz:19132
  • @return {*MotdBEInfo} MotdBE信息
  • @return {error} 错误信息

type MotdJavaInfo

type MotdJavaInfo struct {
	Status    string `json:"status"`    //服务器状态
	Host      string `json:"host"`      //服务器Host
	Motd      string `json:"motd"`      //Motd信息
	Agreement int    `json:"agreement"` //协议版本
	Version   string `json:"version"`   //支持的游戏版本
	Online    int    `json:"online"`    //在线人数
	Max       int    `json:"max"`       //最大在线人数
	Sample    []struct {
		Id   string `json:"id"`   //在线玩家ID
		Name string `json:"name"` //在线玩家名字
	} `json:"sample"` //在线玩家列表
	Favicon string `json:"favicon"` //服务器图标
	Delay   int64  `json:"delay"`   //连接延迟
}

MotdJava信息

func MotdJava

func MotdJava(Host string) (MotdJavaInfo, error)

@description: 通过TCP请求获取Java服务器信息 @param {string} Host 服务器地址,nyan.xyz:19132 @return {MotdJavaInfo} @return {error}

type MotdJavaJson

type MotdJavaJson struct {
	Description json.RawMessage `json:"description"` //服务器说明文本
	Players     struct {
		Max    int `json:"max"`    //服务器最大在线
		Online int `json:"online"` //服务器当前在线
		Sample []struct {
			Id   string `json:"id"`   //在线玩家ID
			Name string `json:"name"` //在线玩家名字
		} `json:"sample"` //在线玩家列表
	} `json:"players"`
	Version struct {
		Name     string `json:"name"`     //可用游戏版本
		Protocol int    `json:"protocol"` //服务器协议版本
	} `json:"version"`

	Favicon string `json:"favicon"` //服务器图标
}

原始Motd信息解析

Jump to

Keyboard shortcuts

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