minor improvements

This commit is contained in:
Michael 2022-06-22 04:05:10 +01:00
parent b34986d594
commit b463d38e66
Signed by: michael
GPG Key ID: 523BD9EF68BDD44C
5 changed files with 122 additions and 112 deletions

View File

@ -22,6 +22,9 @@ clean:
go clean
proto:
protoc --go_out=/home/michael/go/src protobuf/*.proto
protoc \
--proto_path=/usr/local/include/google/protobuf \
--proto_path=protobuf/ \
--go_out=$(GOPATH)/src protobuf/*.proto
.PHONY: run doc build debs update-debs fmt proto

View File

@ -8,7 +8,7 @@ import (
"time"
"git.0cd.xyz/michael/mcstatus/mcstatuspb"
"github.com/golang/protobuf/jsonpb"
"google.golang.org/protobuf/encoding/protojson"
)
// Client TCP client
@ -60,8 +60,8 @@ func (client *Client) read() (*mcstatuspb.Response, error) {
b := bytes.Split(buf[:n], []byte("{"))
ne := bytes.SplitAfterN(buf[:n], b[0], 2)
trim := bytes.TrimSuffix(ne[1], []byte("\x00"))
js := &jsonpb.Unmarshaler{AllowUnknownFields: true}
if err := js.Unmarshal(bytes.NewBuffer(trim), &response); err != nil {
js := &protojson.UnmarshalOptions{DiscardUnknown: true}
if err := js.Unmarshal(trim, &response); err != nil {
return nil, err
}
return &response, nil

View File

@ -8,27 +8,24 @@ import (
// GetStatus gets minecraft server status
func (client *Client) GetStatus() (*mcstatuspb.Response, error) {
for {
if err := client.write(); err != nil {
return nil, err
}
resp, err := client.read()
if err != nil {
return nil, err
}
return resp, nil
if err := client.write(); err != nil {
return nil, err
}
resp, err := client.read()
if err != nil {
return nil, err
}
return resp, nil
}
// PingServer pings Minecraft server
func (client *Client) PingServer() (time.Duration, error) {
ping := make([]byte, 1)
start := time.Now()
_, err := client.Conn.Write([]byte{0x01, 0x00})
if err != nil {
if _, err := client.Conn.Write([]byte{0x01, 0x00}); err != nil {
return 0, err
}
_, _ = client.Conn.Read(ping[:])
diff := time.Now().Sub(start)
client.Conn.Read(ping[:])
diff := time.Since(start)
return diff, nil
}

15
go.mod
View File

@ -3,6 +3,17 @@ module git.0cd.xyz/michael/mcstatus
go 1.15
require (
github.com/golang/protobuf v1.4.3
google.golang.org/protobuf v1.25.0
git.0cd.xyz/michael/toolbox v0.0.0-20220604033144-2bef86c689f1
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.8.1
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
google.golang.org/protobuf v1.28.0
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1
)

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.14.0
// source: protobuf/response.proto
// protoc-gen-go v1.28.0
// protoc v3.21.1
// source: response.proto
package mcstatuspb
@ -34,7 +34,7 @@ type Response struct {
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[0]
mi := &file_response_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -47,7 +47,7 @@ func (x *Response) String() string {
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[0]
mi := &file_response_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -60,7 +60,7 @@ func (x *Response) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0}
return file_response_proto_rawDescGZIP(), []int{0}
}
func (x *Response) GetVersion() *Response_Version {
@ -103,7 +103,7 @@ type Response_Version struct {
func (x *Response_Version) Reset() {
*x = Response_Version{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[1]
mi := &file_response_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -116,7 +116,7 @@ func (x *Response_Version) String() string {
func (*Response_Version) ProtoMessage() {}
func (x *Response_Version) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[1]
mi := &file_response_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -129,7 +129,7 @@ func (x *Response_Version) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response_Version.ProtoReflect.Descriptor instead.
func (*Response_Version) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0, 0}
return file_response_proto_rawDescGZIP(), []int{0, 0}
}
func (x *Response_Version) GetName() string {
@ -159,7 +159,7 @@ type Response_Players struct {
func (x *Response_Players) Reset() {
*x = Response_Players{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[2]
mi := &file_response_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -172,7 +172,7 @@ func (x *Response_Players) String() string {
func (*Response_Players) ProtoMessage() {}
func (x *Response_Players) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[2]
mi := &file_response_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -185,7 +185,7 @@ func (x *Response_Players) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response_Players.ProtoReflect.Descriptor instead.
func (*Response_Players) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0, 1}
return file_response_proto_rawDescGZIP(), []int{0, 1}
}
func (x *Response_Players) GetMax() int32 {
@ -221,7 +221,7 @@ type Response_Description struct {
func (x *Response_Description) Reset() {
*x = Response_Description{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[3]
mi := &file_response_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -234,7 +234,7 @@ func (x *Response_Description) String() string {
func (*Response_Description) ProtoMessage() {}
func (x *Response_Description) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[3]
mi := &file_response_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -247,7 +247,7 @@ func (x *Response_Description) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response_Description.ProtoReflect.Descriptor instead.
func (*Response_Description) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0, 2}
return file_response_proto_rawDescGZIP(), []int{0, 2}
}
func (x *Response_Description) GetExtra() []*Response_Description_Extra {
@ -276,7 +276,7 @@ type Response_Players_Sample struct {
func (x *Response_Players_Sample) Reset() {
*x = Response_Players_Sample{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[4]
mi := &file_response_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -289,7 +289,7 @@ func (x *Response_Players_Sample) String() string {
func (*Response_Players_Sample) ProtoMessage() {}
func (x *Response_Players_Sample) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[4]
mi := &file_response_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -302,7 +302,7 @@ func (x *Response_Players_Sample) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response_Players_Sample.ProtoReflect.Descriptor instead.
func (*Response_Players_Sample) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0, 1, 0}
return file_response_proto_rawDescGZIP(), []int{0, 1, 0}
}
func (x *Response_Players_Sample) GetName() string {
@ -330,7 +330,7 @@ type Response_Description_Extra struct {
func (x *Response_Description_Extra) Reset() {
*x = Response_Description_Extra{}
if protoimpl.UnsafeEnabled {
mi := &file_protobuf_response_proto_msgTypes[5]
mi := &file_response_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -343,7 +343,7 @@ func (x *Response_Description_Extra) String() string {
func (*Response_Description_Extra) ProtoMessage() {}
func (x *Response_Description_Extra) ProtoReflect() protoreflect.Message {
mi := &file_protobuf_response_proto_msgTypes[5]
mi := &file_response_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -356,7 +356,7 @@ func (x *Response_Description_Extra) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response_Description_Extra.ProtoReflect.Descriptor instead.
func (*Response_Description_Extra) Descriptor() ([]byte, []int) {
return file_protobuf_response_proto_rawDescGZIP(), []int{0, 2, 0}
return file_response_proto_rawDescGZIP(), []int{0, 2, 0}
}
func (x *Response_Description_Extra) GetText() string {
@ -366,69 +366,68 @@ func (x *Response_Description_Extra) GetText() string {
return ""
}
var File_protobuf_response_proto protoreflect.FileDescriptor
var File_response_proto protoreflect.FileDescriptor
var file_protobuf_response_proto_rawDesc = []byte{
0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x6d, 0x63, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xd6, 0x04, 0x0a,
0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x07, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x63, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x63, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x07,
0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x49, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6d,
0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x61, 0x76, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x66, 0x61, 0x76, 0x69, 0x63, 0x6f, 0x6e, 0x1a, 0x39, 0x0a, 0x07,
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x1a, 0xa5, 0x01, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x42, 0x0a,
0x06, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x73, 0x2e, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x06, 0x73, 0x61, 0x6d, 0x70, 0x6c,
0x65, 0x1a, 0x2c, 0x0a, 0x06, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x1a,
0x83, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x43, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d,
0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x52, 0x05, 0x65,
0x78, 0x74, 0x72, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x1a, 0x1b, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72,
0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x74, 0x65, 0x78, 0x74, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x2e, 0x30, 0x63, 0x64,
0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x6d, 0x69, 0x63, 0x68, 0x61, 0x65, 0x6c, 0x2f, 0x6d, 0x63, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
var file_response_proto_rawDesc = []byte{
0x0a, 0x0e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x11, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x22, 0xd6, 0x04, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x3d, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x3d, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x23, 0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x49,
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x61, 0x76,
0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x66, 0x61, 0x76, 0x69,
0x63, 0x6f, 0x6e, 0x1a, 0x39, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x1a, 0xa5,
0x01, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61,
0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x16, 0x0a, 0x06,
0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x6e,
0x6c, 0x69, 0x6e, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x2e, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x52, 0x06, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x1a, 0x2c, 0x0a, 0x06, 0x53, 0x61, 0x6d, 0x70,
0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x1a, 0x83, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45,
0x78, 0x74, 0x72, 0x61, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74,
0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x1a,
0x1b, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x42, 0x29, 0x5a, 0x27,
0x67, 0x69, 0x74, 0x2e, 0x30, 0x63, 0x64, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x6d, 0x69, 0x63, 0x68,
0x61, 0x65, 0x6c, 0x2f, 0x6d, 0x63, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x6d, 0x63, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_protobuf_response_proto_rawDescOnce sync.Once
file_protobuf_response_proto_rawDescData = file_protobuf_response_proto_rawDesc
file_response_proto_rawDescOnce sync.Once
file_response_proto_rawDescData = file_response_proto_rawDesc
)
func file_protobuf_response_proto_rawDescGZIP() []byte {
file_protobuf_response_proto_rawDescOnce.Do(func() {
file_protobuf_response_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_response_proto_rawDescData)
func file_response_proto_rawDescGZIP() []byte {
file_response_proto_rawDescOnce.Do(func() {
file_response_proto_rawDescData = protoimpl.X.CompressGZIP(file_response_proto_rawDescData)
})
return file_protobuf_response_proto_rawDescData
return file_response_proto_rawDescData
}
var file_protobuf_response_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_protobuf_response_proto_goTypes = []interface{}{
var file_response_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_response_proto_goTypes = []interface{}{
(*Response)(nil), // 0: mcstatus.protobuf.Response
(*Response_Version)(nil), // 1: mcstatus.protobuf.Response.Version
(*Response_Players)(nil), // 2: mcstatus.protobuf.Response.Players
@ -436,7 +435,7 @@ var file_protobuf_response_proto_goTypes = []interface{}{
(*Response_Players_Sample)(nil), // 4: mcstatus.protobuf.Response.Players.Sample
(*Response_Description_Extra)(nil), // 5: mcstatus.protobuf.Response.Description.Extra
}
var file_protobuf_response_proto_depIdxs = []int32{
var file_response_proto_depIdxs = []int32{
1, // 0: mcstatus.protobuf.Response.version:type_name -> mcstatus.protobuf.Response.Version
2, // 1: mcstatus.protobuf.Response.players:type_name -> mcstatus.protobuf.Response.Players
3, // 2: mcstatus.protobuf.Response.description:type_name -> mcstatus.protobuf.Response.Description
@ -449,13 +448,13 @@ var file_protobuf_response_proto_depIdxs = []int32{
0, // [0:5] is the sub-list for field type_name
}
func init() { file_protobuf_response_proto_init() }
func file_protobuf_response_proto_init() {
if File_protobuf_response_proto != nil {
func init() { file_response_proto_init() }
func file_response_proto_init() {
if File_response_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_protobuf_response_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
case 0:
return &v.state
@ -467,7 +466,7 @@ func file_protobuf_response_proto_init() {
return nil
}
}
file_protobuf_response_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response_Version); i {
case 0:
return &v.state
@ -479,7 +478,7 @@ func file_protobuf_response_proto_init() {
return nil
}
}
file_protobuf_response_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response_Players); i {
case 0:
return &v.state
@ -491,7 +490,7 @@ func file_protobuf_response_proto_init() {
return nil
}
}
file_protobuf_response_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response_Description); i {
case 0:
return &v.state
@ -503,7 +502,7 @@ func file_protobuf_response_proto_init() {
return nil
}
}
file_protobuf_response_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response_Players_Sample); i {
case 0:
return &v.state
@ -515,7 +514,7 @@ func file_protobuf_response_proto_init() {
return nil
}
}
file_protobuf_response_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_response_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response_Description_Extra); i {
case 0:
return &v.state
@ -532,18 +531,18 @@ func file_protobuf_response_proto_init() {
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_protobuf_response_proto_rawDesc,
RawDescriptor: file_response_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_protobuf_response_proto_goTypes,
DependencyIndexes: file_protobuf_response_proto_depIdxs,
MessageInfos: file_protobuf_response_proto_msgTypes,
GoTypes: file_response_proto_goTypes,
DependencyIndexes: file_response_proto_depIdxs,
MessageInfos: file_response_proto_msgTypes,
}.Build()
File_protobuf_response_proto = out.File
file_protobuf_response_proto_rawDesc = nil
file_protobuf_response_proto_goTypes = nil
file_protobuf_response_proto_depIdxs = nil
File_response_proto = out.File
file_response_proto_rawDesc = nil
file_response_proto_goTypes = nil
file_response_proto_depIdxs = nil
}