changes to protobuf buffers

Signed-off-by: Michael <michael.lindman@gmail.com>
This commit is contained in:
Michael 2021-01-08 15:54:54 +00:00
parent 71cddf0aca
commit 049ab265d3
4 changed files with 123 additions and 108 deletions

View File

@ -7,7 +7,7 @@ import (
"strconv" "strconv"
"time" "time"
"git.0cd.xyz/michael/mcstatus/client/pb" "git.0cd.xyz/michael/mcstatus/mcstatuspb"
"github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/jsonpb"
) )
@ -37,12 +37,18 @@ func (client *Client) write() error {
if err := client.Conn.SetWriteDeadline(time.Now().Add(10 * time.Second)); err != nil { if err := client.Conn.SetWriteDeadline(time.Now().Add(10 * time.Second)); err != nil {
return err return err
} }
client.Conn.Write(handshake(client.Addr, client.Port, client.Version)) _, err := client.Conn.Write(handshake(client.Addr, client.Port, client.Version))
if err != nil {
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
return err
}
return err
}
return nil return nil
} }
func (client *Client) read() (*pb.Response, error) { func (client *Client) read() (*mcstatuspb.Response, error) {
var response pb.Response var response mcstatuspb.Response
buf := make([]byte, 1024) buf := make([]byte, 1024)
n, err := client.Conn.Read(buf) n, err := client.Conn.Read(buf)
if err != nil { if err != nil {

View File

@ -3,11 +3,11 @@ package client
import ( import (
"time" "time"
"git.0cd.xyz/michael/mcstatus/client/pb" "git.0cd.xyz/michael/mcstatus/mcstatuspb"
) )
// GetStatus gets minecraft server status // GetStatus gets minecraft server status
func (client *Client) GetStatus() (*pb.Response, error) { func (client *Client) GetStatus() (*mcstatuspb.Response, error) {
for { for {
if err := client.write(); err != nil { if err := client.write(); err != nil {
return nil, err return nil, err
@ -21,11 +21,14 @@ func (client *Client) GetStatus() (*pb.Response, error) {
} }
// PingServer pings Minecraft server // PingServer pings Minecraft server
func (client *Client) PingServer() time.Duration { func (client *Client) PingServer() (time.Duration, error) {
ping := make([]byte, 1) ping := make([]byte, 1)
start := time.Now() start := time.Now()
client.Conn.Write([]byte{0x01, 0x00}) _, err := client.Conn.Write([]byte{0x01, 0x00})
if err != nil {
return 0, err
}
_, _ = client.Conn.Read(ping[:]) _, _ = client.Conn.Read(ping[:])
diff := time.Now().Sub(start) diff := time.Now().Sub(start)
return diff return diff, nil
} }

View File

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

View File

@ -1,8 +1,8 @@
syntax="proto3"; syntax="proto3";
package pb; package mcstatus.protobuf;
option go_package = "git.0cd.xyz/michael/mcstatus/pb"; option go_package = "git.0cd.xyz/michael/mcstatus/mcstatuspb";
message Response { message Response {
message Version { message Version {