diff --git a/Makefile b/Makefile index 9b156cc0..7031edda 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -PROTO_DIR=./client/pb -PROTO_IMPORT_PATH=./client +PROTO_DIR=client/pb +PROTO_OUTPUT_PATH=client +PROTO_IMPORT_PATH=client -PROTO_FILES = \ +PROTO_FILES := \ $(PROTO_DIR)/*.proto \ $(PROTO_DIR)/channel/*.proto \ $(PROTO_DIR)/cmd0x3f6/*.proto \ @@ -26,6 +27,20 @@ PROTO_FILES = \ $(PROTO_DIR)/structmsg/*.proto \ $(PROTO_DIR)/web/*.proto -proto: - protoc --golite_out=. --golite_opt=paths=source_relative -I=$(PROTO_IMPORT_PATH) $(PROTO_FILES) +PROTOC_GEN_GOLITE_VERSION := \ + $(shell grep "github.com/RomiChan/protobuf" go.mod | awk -F v '{print "v"$$2}') +.PHONY: protoc-gen-golite-version clean install-protoc-plugin proto +.DEFAULT_GOAL := proto + +protoc-gen-golite-version: + @echo "Use protoc-gen-golite version: $(PROTOC_GEN_GOLITE_VERSION)" + +clean: + find . -name "*.pb.go" | xargs rm -f + +install-protoc-plugin: protoc-gen-golite-version + go install github.com/RomiChan/protobuf/cmd/protoc-gen-golite@$(PROTOC_GEN_GOLITE_VERSION) + +proto: install-protoc-plugin + protoc --golite_out=$(PROTO_IMPORT_PATH) --golite_opt=paths=source_relative -I=$(PROTO_IMPORT_PATH) $(PROTO_FILES) diff --git a/client/pb/msg/msg.pb.go b/client/pb/msg/msg.pb.go index 3334bc1e..88e71fdf 100644 --- a/client/pb/msg/msg.pb.go +++ b/client/pb/msg/msg.pb.go @@ -16,18 +16,18 @@ const ( ) type GetMessageRequest struct { - SyncFlag proto.Option[int32] `protobuf:"varint,1,opt"` - SyncCookie []byte `protobuf:"bytes,2,opt"` - RambleFlag proto.Option[int32] `protobuf:"varint,3,opt"` - LatestRambleNumber proto.Option[int32] `protobuf:"varint,4,opt"` - OtherRambleNumber proto.Option[int32] `protobuf:"varint,5,opt"` - OnlineSyncFlag proto.Option[int32] `protobuf:"varint,6,opt"` - ContextFlag proto.Option[int32] `protobuf:"varint,7,opt"` - WhisperSessionId proto.Option[int32] `protobuf:"varint,8,opt"` - MsgReqType proto.Option[int32] `protobuf:"varint,9,opt"` - PubaccountCookie []byte `protobuf:"bytes,10,opt"` - MsgCtrlBuf []byte `protobuf:"bytes,11,opt"` - ServerBuf []byte `protobuf:"bytes,12,opt"` + SyncFlag proto.Option[SyncFlag] `protobuf:"varint,1,opt"` + SyncCookie []byte `protobuf:"bytes,2,opt"` + RambleFlag proto.Option[int32] `protobuf:"varint,3,opt"` + LatestRambleNumber proto.Option[int32] `protobuf:"varint,4,opt"` + OtherRambleNumber proto.Option[int32] `protobuf:"varint,5,opt"` + OnlineSyncFlag proto.Option[int32] `protobuf:"varint,6,opt"` + ContextFlag proto.Option[int32] `protobuf:"varint,7,opt"` + WhisperSessionId proto.Option[int32] `protobuf:"varint,8,opt"` + MsgReqType proto.Option[int32] `protobuf:"varint,9,opt"` + PubaccountCookie []byte `protobuf:"bytes,10,opt"` + MsgCtrlBuf []byte `protobuf:"bytes,11,opt"` + ServerBuf []byte `protobuf:"bytes,12,opt"` } type SendMessageRequest struct { diff --git a/client/pb/oidb/oidb0xd79.pb.go b/client/pb/oidb/oidb0xD79.pb.go similarity index 95% rename from client/pb/oidb/oidb0xd79.pb.go rename to client/pb/oidb/oidb0xD79.pb.go index 2a175ff3..73318f46 100644 --- a/client/pb/oidb/oidb0xd79.pb.go +++ b/client/pb/oidb/oidb0xD79.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-golite. DO NOT EDIT. -// source: pb/oidb/oidb0xD79.proto +// source: pb/oidb/oidb0xd79.proto package oidb diff --git a/go.mod b/go.mod index 8acdcb88..ae1a268f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Mrs4s/MiraiGo go 1.18 require ( - github.com/RomiChan/protobuf v0.1.1-0.20220523101132-5546fc25db37 + github.com/RomiChan/protobuf v0.1.1-0.20220524030518-4f349493f9da github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c github.com/fumiama/imgsz v0.0.2 github.com/pierrec/lz4/v4 v4.1.11 diff --git a/go.sum b/go.sum index 2976d6f8..cee5d5ca 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/RomiChan/protobuf v0.1.1-0.20220523101132-5546fc25db37 h1:MtLqymjslqAWUYMHqamYI9KKXq+am9JOyLIcSDWE3Ak= -github.com/RomiChan/protobuf v0.1.1-0.20220523101132-5546fc25db37/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA= +github.com/RomiChan/protobuf v0.1.1-0.20220524030518-4f349493f9da h1:T+Sc+QtOfpIRnfnOXaToyLvxmUmFwF2iaqxpJddI4Cc= +github.com/RomiChan/protobuf v0.1.1-0.20220524030518-4f349493f9da/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA= github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q= github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=