Merge branch 'dev' into x/gorm

pull/351/head
Michael Li 1 year ago
commit a1662e326b
No known key found for this signature in database

@ -70,19 +70,28 @@ windows-x64:
@CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_WINDOWS_AMD64)/$(TARGET_BIN).exe
.PHONY: generate
generate: gen-mir gen-grpc
generate: gen-mir gen-rpc
.PHONY: gen-mir
gen-mir:
@go generate mirc/gen.go
@go fmt ./auto/api/...
.PHONY: gen-rpc
gen-rpc: gen-grpc gen-connect
.PHONY: gen-grpc
gen-grpc:
@rm -rf auto/rpc
@buf generate proto
@buf generate --template buf.grpc.gen.yaml proto/grpc
@go fmt ./auto/rpc/...
.PHONY: gen-connect
gen-connect:
@rm -rf auto/connect
@buf generate --template buf.connect.gen.yaml proto/connect
@go fmt ./auto/connect/...
.PHONY: proto-mod
proto-mod:
@cd proto/ && buf mod update
@ -110,9 +119,11 @@ pre-commit: fmt
.PHONY: install-protobuf-plugins
install-protobuf-plugins:
@go install github.com/bufbuild/buf/cmd/buf@v1.22.0
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@v1.22.0
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@v1.22.0
@go install github.com/bufbuild/buf/cmd/buf@v1.25.0
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@v1.25.0
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@v1.25.0
@go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest
@go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

@ -2,9 +2,9 @@
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: v1/auth.proto
// source: core/v1/auth.proto
package v1
package corev1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -31,7 +31,7 @@ type User struct {
func (x *User) Reset() {
*x = User{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_auth_proto_msgTypes[0]
mi := &file_core_v1_auth_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -44,7 +44,7 @@ func (x *User) String() string {
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_v1_auth_proto_msgTypes[0]
mi := &file_core_v1_auth_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -57,7 +57,7 @@ func (x *User) ProtoReflect() protoreflect.Message {
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_v1_auth_proto_rawDescGZIP(), []int{0}
return file_core_v1_auth_proto_rawDescGZIP(), []int{0}
}
func (x *User) GetPhoneNum() string {
@ -79,7 +79,7 @@ type UserVerify struct {
func (x *UserVerify) Reset() {
*x = UserVerify{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_auth_proto_msgTypes[1]
mi := &file_core_v1_auth_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -92,7 +92,7 @@ func (x *UserVerify) String() string {
func (*UserVerify) ProtoMessage() {}
func (x *UserVerify) ProtoReflect() protoreflect.Message {
mi := &file_v1_auth_proto_msgTypes[1]
mi := &file_core_v1_auth_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -105,7 +105,7 @@ func (x *UserVerify) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserVerify.ProtoReflect.Descriptor instead.
func (*UserVerify) Descriptor() ([]byte, []int) {
return file_v1_auth_proto_rawDescGZIP(), []int{1}
return file_core_v1_auth_proto_rawDescGZIP(), []int{1}
}
func (x *UserVerify) GetPhoneNum() string {
@ -134,7 +134,7 @@ type LoginReply struct {
func (x *LoginReply) Reset() {
*x = LoginReply{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_auth_proto_msgTypes[2]
mi := &file_core_v1_auth_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -147,7 +147,7 @@ func (x *LoginReply) String() string {
func (*LoginReply) ProtoMessage() {}
func (x *LoginReply) ProtoReflect() protoreflect.Message {
mi := &file_v1_auth_proto_msgTypes[2]
mi := &file_core_v1_auth_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -160,7 +160,7 @@ func (x *LoginReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.
func (*LoginReply) Descriptor() ([]byte, []int) {
return file_v1_auth_proto_rawDescGZIP(), []int{2}
return file_core_v1_auth_proto_rawDescGZIP(), []int{2}
}
func (x *LoginReply) GetStatuCode() int32 {
@ -188,7 +188,7 @@ type ActionReply struct {
func (x *ActionReply) Reset() {
*x = ActionReply{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_auth_proto_msgTypes[3]
mi := &file_core_v1_auth_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -201,7 +201,7 @@ func (x *ActionReply) String() string {
func (*ActionReply) ProtoMessage() {}
func (x *ActionReply) ProtoReflect() protoreflect.Message {
mi := &file_v1_auth_proto_msgTypes[3]
mi := &file_core_v1_auth_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -214,7 +214,7 @@ func (x *ActionReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use ActionReply.ProtoReflect.Descriptor instead.
func (*ActionReply) Descriptor() ([]byte, []int) {
return file_v1_auth_proto_rawDescGZIP(), []int{3}
return file_core_v1_auth_proto_rawDescGZIP(), []int{3}
}
func (x *ActionReply) GetStatusCode() int32 {
@ -224,70 +224,73 @@ func (x *ActionReply) GetStatusCode() int32 {
return 0
}
var File_v1_auth_proto protoreflect.FileDescriptor
var file_v1_auth_proto_rawDesc = []byte{
0x0a, 0x0d, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a,
0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x22, 0x54, 0x0a, 0x0a, 0x55, 0x73, 0x65,
0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65,
0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65,
0x4e, 0x75, 0x6d, 0x12, 0x2a, 0x0a, 0x10, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x56,
0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22,
0x40, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a,
0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,
0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65,
0x6e, 0x22, 0x2d, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65,
0x32, 0x89, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x65, 0x12, 0x29, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0a, 0x2e,
0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68,
0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x05,
0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0a, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65,
0x72, 0x1a, 0x10, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x0a, 0x2e,
0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68,
0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x6f, 0x0a, 0x08,
0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x42, 0x09, 0x41, 0x75, 0x74, 0x68, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x72, 0x6f, 0x63, 0x62, 0x6f, 0x73, 0x73, 0x2f, 0x70, 0x61, 0x6f, 0x70, 0x61, 0x6f,
0x2d, 0x63, 0x65, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x41, 0x75, 0x74, 0x68, 0xca, 0x02, 0x04, 0x41,
0x75, 0x74, 0x68, 0xe2, 0x02, 0x10, 0x41, 0x75, 0x74, 0x68, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x41, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
var File_core_v1_auth_proto protoreflect.FileDescriptor
var file_core_v1_auth_proto_rawDesc = []byte{
0x0a, 0x12, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x22, 0x22, 0x0a,
0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75,
0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75,
0x6d, 0x22, 0x54, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12,
0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x2a, 0x0a, 0x10, 0x56,
0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x40, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43,
0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x2d, 0x0a, 0x0b, 0x41, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x9b, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74,
0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x72, 0x65,
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e,
0x55, 0x73, 0x65, 0x72, 0x1a, 0x14, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x6c, 0x6f,
0x67, 0x69, 0x6e, 0x12, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
0x65, 0x72, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2d, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x6f, 0x75,
0x74, 0x12, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
0x1a, 0x14, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x8f, 0x01, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x41, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x50, 0x01, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x72, 0x6f, 0x63, 0x62, 0x6f, 0x73, 0x73, 0x2f, 0x70, 0x61, 0x6f, 0x70, 0x61, 0x6f, 0x2d, 0x63,
0x65, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2f, 0x63,
0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03,
0x43, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x07,
0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56,
0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08,
0x43, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_v1_auth_proto_rawDescOnce sync.Once
file_v1_auth_proto_rawDescData = file_v1_auth_proto_rawDesc
file_core_v1_auth_proto_rawDescOnce sync.Once
file_core_v1_auth_proto_rawDescData = file_core_v1_auth_proto_rawDesc
)
func file_v1_auth_proto_rawDescGZIP() []byte {
file_v1_auth_proto_rawDescOnce.Do(func() {
file_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_auth_proto_rawDescData)
func file_core_v1_auth_proto_rawDescGZIP() []byte {
file_core_v1_auth_proto_rawDescOnce.Do(func() {
file_core_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_core_v1_auth_proto_rawDescData)
})
return file_v1_auth_proto_rawDescData
return file_core_v1_auth_proto_rawDescData
}
var file_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_v1_auth_proto_goTypes = []interface{}{
(*User)(nil), // 0: auth.User
(*UserVerify)(nil), // 1: auth.UserVerify
(*LoginReply)(nil), // 2: auth.LoginReply
(*ActionReply)(nil), // 3: auth.ActionReply
var file_core_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_core_v1_auth_proto_goTypes = []interface{}{
(*User)(nil), // 0: core.v1.User
(*UserVerify)(nil), // 1: core.v1.UserVerify
(*LoginReply)(nil), // 2: core.v1.LoginReply
(*ActionReply)(nil), // 3: core.v1.ActionReply
}
var file_v1_auth_proto_depIdxs = []int32{
0, // 0: auth.Authenticate.preLogin:input_type -> auth.User
0, // 1: auth.Authenticate.login:input_type -> auth.User
0, // 2: auth.Authenticate.logout:input_type -> auth.User
3, // 3: auth.Authenticate.preLogin:output_type -> auth.ActionReply
2, // 4: auth.Authenticate.login:output_type -> auth.LoginReply
3, // 5: auth.Authenticate.logout:output_type -> auth.ActionReply
var file_core_v1_auth_proto_depIdxs = []int32{
0, // 0: core.v1.Authenticate.preLogin:input_type -> core.v1.User
0, // 1: core.v1.Authenticate.login:input_type -> core.v1.User
0, // 2: core.v1.Authenticate.logout:input_type -> core.v1.User
3, // 3: core.v1.Authenticate.preLogin:output_type -> core.v1.ActionReply
2, // 4: core.v1.Authenticate.login:output_type -> core.v1.LoginReply
3, // 5: core.v1.Authenticate.logout:output_type -> core.v1.ActionReply
3, // [3:6] is the sub-list for method output_type
0, // [0:3] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
@ -295,13 +298,13 @@ var file_v1_auth_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for field type_name
}
func init() { file_v1_auth_proto_init() }
func file_v1_auth_proto_init() {
if File_v1_auth_proto != nil {
func init() { file_core_v1_auth_proto_init() }
func file_core_v1_auth_proto_init() {
if File_core_v1_auth_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_v1_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_core_v1_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i {
case 0:
return &v.state
@ -313,7 +316,7 @@ func file_v1_auth_proto_init() {
return nil
}
}
file_v1_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_core_v1_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserVerify); i {
case 0:
return &v.state
@ -325,7 +328,7 @@ func file_v1_auth_proto_init() {
return nil
}
}
file_v1_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_core_v1_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginReply); i {
case 0:
return &v.state
@ -337,7 +340,7 @@ func file_v1_auth_proto_init() {
return nil
}
}
file_v1_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_core_v1_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActionReply); i {
case 0:
return &v.state
@ -354,18 +357,18 @@ func file_v1_auth_proto_init() {
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v1_auth_proto_rawDesc,
RawDescriptor: file_core_v1_auth_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v1_auth_proto_goTypes,
DependencyIndexes: file_v1_auth_proto_depIdxs,
MessageInfos: file_v1_auth_proto_msgTypes,
GoTypes: file_core_v1_auth_proto_goTypes,
DependencyIndexes: file_core_v1_auth_proto_depIdxs,
MessageInfos: file_core_v1_auth_proto_msgTypes,
}.Build()
File_v1_auth_proto = out.File
file_v1_auth_proto_rawDesc = nil
file_v1_auth_proto_goTypes = nil
file_v1_auth_proto_depIdxs = nil
File_core_v1_auth_proto = out.File
file_core_v1_auth_proto_rawDesc = nil
file_core_v1_auth_proto_goTypes = nil
file_core_v1_auth_proto_depIdxs = nil
}

@ -0,0 +1,156 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: core/v1/auth.proto
package corev1connect
import (
context "context"
errors "errors"
connect_go "github.com/bufbuild/connect-go"
v1 "github.com/rocboss/paopao-ce/auto/connect/core/v1"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect_go.IsAtLeastVersion0_1_0
const (
// AuthenticateName is the fully-qualified name of the Authenticate service.
AuthenticateName = "core.v1.Authenticate"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// AuthenticatePreLoginProcedure is the fully-qualified name of the Authenticate's preLogin RPC.
AuthenticatePreLoginProcedure = "/core.v1.Authenticate/preLogin"
// AuthenticateLoginProcedure is the fully-qualified name of the Authenticate's login RPC.
AuthenticateLoginProcedure = "/core.v1.Authenticate/login"
// AuthenticateLogoutProcedure is the fully-qualified name of the Authenticate's logout RPC.
AuthenticateLogoutProcedure = "/core.v1.Authenticate/logout"
)
// AuthenticateClient is a client for the core.v1.Authenticate service.
type AuthenticateClient interface {
PreLogin(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error)
Login(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.LoginReply], error)
Logout(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error)
}
// NewAuthenticateClient constructs a client for the core.v1.Authenticate service. By default, it
// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
// connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewAuthenticateClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuthenticateClient {
baseURL = strings.TrimRight(baseURL, "/")
return &authenticateClient{
preLogin: connect_go.NewClient[v1.User, v1.ActionReply](
httpClient,
baseURL+AuthenticatePreLoginProcedure,
opts...,
),
login: connect_go.NewClient[v1.User, v1.LoginReply](
httpClient,
baseURL+AuthenticateLoginProcedure,
opts...,
),
logout: connect_go.NewClient[v1.User, v1.ActionReply](
httpClient,
baseURL+AuthenticateLogoutProcedure,
opts...,
),
}
}
// authenticateClient implements AuthenticateClient.
type authenticateClient struct {
preLogin *connect_go.Client[v1.User, v1.ActionReply]
login *connect_go.Client[v1.User, v1.LoginReply]
logout *connect_go.Client[v1.User, v1.ActionReply]
}
// PreLogin calls core.v1.Authenticate.preLogin.
func (c *authenticateClient) PreLogin(ctx context.Context, req *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error) {
return c.preLogin.CallUnary(ctx, req)
}
// Login calls core.v1.Authenticate.login.
func (c *authenticateClient) Login(ctx context.Context, req *connect_go.Request[v1.User]) (*connect_go.Response[v1.LoginReply], error) {
return c.login.CallUnary(ctx, req)
}
// Logout calls core.v1.Authenticate.logout.
func (c *authenticateClient) Logout(ctx context.Context, req *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error) {
return c.logout.CallUnary(ctx, req)
}
// AuthenticateHandler is an implementation of the core.v1.Authenticate service.
type AuthenticateHandler interface {
PreLogin(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error)
Login(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.LoginReply], error)
Logout(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error)
}
// NewAuthenticateHandler builds an HTTP handler from the service implementation. It returns the
// path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewAuthenticateHandler(svc AuthenticateHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
authenticatePreLoginHandler := connect_go.NewUnaryHandler(
AuthenticatePreLoginProcedure,
svc.PreLogin,
opts...,
)
authenticateLoginHandler := connect_go.NewUnaryHandler(
AuthenticateLoginProcedure,
svc.Login,
opts...,
)
authenticateLogoutHandler := connect_go.NewUnaryHandler(
AuthenticateLogoutProcedure,
svc.Logout,
opts...,
)
return "/core.v1.Authenticate/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case AuthenticatePreLoginProcedure:
authenticatePreLoginHandler.ServeHTTP(w, r)
case AuthenticateLoginProcedure:
authenticateLoginHandler.ServeHTTP(w, r)
case AuthenticateLogoutProcedure:
authenticateLogoutHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedAuthenticateHandler returns CodeUnimplemented from all methods.
type UnimplementedAuthenticateHandler struct{}
func (UnimplementedAuthenticateHandler) PreLogin(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("core.v1.Authenticate.preLogin is not implemented"))
}
func (UnimplementedAuthenticateHandler) Login(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.LoginReply], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("core.v1.Authenticate.login is not implemented"))
}
func (UnimplementedAuthenticateHandler) Logout(context.Context, *connect_go.Request[v1.User]) (*connect_go.Response[v1.ActionReply], error) {
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("core.v1.Authenticate.logout is not implemented"))
}

@ -0,0 +1,220 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: greet/v1/greet.proto
package greetv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GreetRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (x *GreetRequest) Reset() {
*x = GreetRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_greet_v1_greet_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GreetRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GreetRequest) ProtoMessage() {}
func (x *GreetRequest) ProtoReflect() protoreflect.Message {
mi := &file_greet_v1_greet_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.
func (*GreetRequest) Descriptor() ([]byte, []int) {
return file_greet_v1_greet_proto_rawDescGZIP(), []int{0}
}
func (x *GreetRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type GreetResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
}
func (x *GreetResponse) Reset() {
*x = GreetResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_greet_v1_greet_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GreetResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GreetResponse) ProtoMessage() {}
func (x *GreetResponse) ProtoReflect() protoreflect.Message {
mi := &file_greet_v1_greet_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.
func (*GreetResponse) Descriptor() ([]byte, []int) {
return file_greet_v1_greet_proto_rawDescGZIP(), []int{1}
}
func (x *GreetResponse) GetGreeting() string {
if x != nil {
return x.Greeting
}
return ""
}
var File_greet_v1_greet_proto protoreflect.FileDescriptor
var file_greet_v1_greet_proto_rawDesc = []byte{
0x0a, 0x14, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x65, 0x65, 0x74,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x76, 0x31,
0x22, 0x22, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e,
0x67, 0x32, 0x4a, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x3a, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x72, 0x65,
0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72,
0x65, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x93, 0x01,
0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a,
0x47, 0x72, 0x65, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x63, 0x62, 0x6f, 0x73, 0x73,
0x2f, 0x70, 0x61, 0x6f, 0x70, 0x61, 0x6f, 0x2d, 0x63, 0x65, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x2f,
0x72, 0x70, 0x63, 0x2f, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x65,
0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x47, 0x72, 0x65,
0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, 0x47, 0x72, 0x65, 0x65, 0x74, 0x5c, 0x56, 0x31,
0xe2, 0x02, 0x14, 0x47, 0x72, 0x65, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x47, 0x72, 0x65, 0x65, 0x74, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_greet_v1_greet_proto_rawDescOnce sync.Once
file_greet_v1_greet_proto_rawDescData = file_greet_v1_greet_proto_rawDesc
)
func file_greet_v1_greet_proto_rawDescGZIP() []byte {
file_greet_v1_greet_proto_rawDescOnce.Do(func() {
file_greet_v1_greet_proto_rawDescData = protoimpl.X.CompressGZIP(file_greet_v1_greet_proto_rawDescData)
})
return file_greet_v1_greet_proto_rawDescData
}
var file_greet_v1_greet_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_greet_v1_greet_proto_goTypes = []interface{}{
(*GreetRequest)(nil), // 0: greet.v1.GreetRequest
(*GreetResponse)(nil), // 1: greet.v1.GreetResponse
}
var file_greet_v1_greet_proto_depIdxs = []int32{
0, // 0: greet.v1.GreetService.Greet:input_type -> greet.v1.GreetRequest
1, // 1: greet.v1.GreetService.Greet:output_type -> greet.v1.GreetResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_greet_v1_greet_proto_init() }
func file_greet_v1_greet_proto_init() {
if File_greet_v1_greet_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_greet_v1_greet_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GreetRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_greet_v1_greet_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GreetResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_greet_v1_greet_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_greet_v1_greet_proto_goTypes,
DependencyIndexes: file_greet_v1_greet_proto_depIdxs,
MessageInfos: file_greet_v1_greet_proto_msgTypes,
}.Build()
File_greet_v1_greet_proto = out.File
file_greet_v1_greet_proto_rawDesc = nil
file_greet_v1_greet_proto_goTypes = nil
file_greet_v1_greet_proto_depIdxs = nil
}

@ -0,0 +1,109 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: greet/v1/greet.proto
package greetv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
GreetService_Greet_FullMethodName = "/greet.v1.GreetService/Greet"
)
// GreetServiceClient is the client API for GreetService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type GreetServiceClient interface {
Greet(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (*GreetResponse, error)
}
type greetServiceClient struct {
cc grpc.ClientConnInterface
}
func NewGreetServiceClient(cc grpc.ClientConnInterface) GreetServiceClient {
return &greetServiceClient{cc}
}
func (c *greetServiceClient) Greet(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (*GreetResponse, error) {
out := new(GreetResponse)
err := c.cc.Invoke(ctx, GreetService_Greet_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// GreetServiceServer is the server API for GreetService service.
// All implementations must embed UnimplementedGreetServiceServer
// for forward compatibility
type GreetServiceServer interface {
Greet(context.Context, *GreetRequest) (*GreetResponse, error)
mustEmbedUnimplementedGreetServiceServer()
}
// UnimplementedGreetServiceServer must be embedded to have forward compatible implementations.
type UnimplementedGreetServiceServer struct {
}
func (UnimplementedGreetServiceServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented")
}
func (UnimplementedGreetServiceServer) mustEmbedUnimplementedGreetServiceServer() {}
// UnsafeGreetServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GreetServiceServer will
// result in compilation errors.
type UnsafeGreetServiceServer interface {
mustEmbedUnimplementedGreetServiceServer()
}
func RegisterGreetServiceServer(s grpc.ServiceRegistrar, srv GreetServiceServer) {
s.RegisterService(&GreetService_ServiceDesc, srv)
}
func _GreetService_Greet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GreetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GreetServiceServer).Greet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: GreetService_Greet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GreetServiceServer).Greet(ctx, req.(*GreetRequest))
}
return interceptor(ctx, in, info, handler)
}
// GreetService_ServiceDesc is the grpc.ServiceDesc for GreetService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var GreetService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "greet.v1.GreetService",
HandlerType: (*GreetServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Greet",
Handler: _GreetService_Greet_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "greet/v1/greet.proto",
}

@ -1,183 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: v1/auth.proto
package v1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Authenticate_PreLogin_FullMethodName = "/auth.Authenticate/preLogin"
Authenticate_Login_FullMethodName = "/auth.Authenticate/login"
Authenticate_Logout_FullMethodName = "/auth.Authenticate/logout"
)
// AuthenticateClient is the client API for Authenticate service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthenticateClient interface {
PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error)
Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error)
Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error)
}
type authenticateClient struct {
cc grpc.ClientConnInterface
}
func NewAuthenticateClient(cc grpc.ClientConnInterface) AuthenticateClient {
return &authenticateClient{cc}
}
func (c *authenticateClient) PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) {
out := new(ActionReply)
err := c.cc.Invoke(ctx, Authenticate_PreLogin_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authenticateClient) Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error) {
out := new(LoginReply)
err := c.cc.Invoke(ctx, Authenticate_Login_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authenticateClient) Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) {
out := new(ActionReply)
err := c.cc.Invoke(ctx, Authenticate_Logout_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthenticateServer is the server API for Authenticate service.
// All implementations must embed UnimplementedAuthenticateServer
// for forward compatibility
type AuthenticateServer interface {
PreLogin(context.Context, *User) (*ActionReply, error)
Login(context.Context, *User) (*LoginReply, error)
Logout(context.Context, *User) (*ActionReply, error)
mustEmbedUnimplementedAuthenticateServer()
}
// UnimplementedAuthenticateServer must be embedded to have forward compatible implementations.
type UnimplementedAuthenticateServer struct {
}
func (UnimplementedAuthenticateServer) PreLogin(context.Context, *User) (*ActionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented")
}
func (UnimplementedAuthenticateServer) Login(context.Context, *User) (*LoginReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedAuthenticateServer) Logout(context.Context, *User) (*ActionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented")
}
func (UnimplementedAuthenticateServer) mustEmbedUnimplementedAuthenticateServer() {}
// UnsafeAuthenticateServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthenticateServer will
// result in compilation errors.
type UnsafeAuthenticateServer interface {
mustEmbedUnimplementedAuthenticateServer()
}
func RegisterAuthenticateServer(s grpc.ServiceRegistrar, srv AuthenticateServer) {
s.RegisterService(&Authenticate_ServiceDesc, srv)
}
func _Authenticate_PreLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(User)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthenticateServer).PreLogin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Authenticate_PreLogin_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthenticateServer).PreLogin(ctx, req.(*User))
}
return interceptor(ctx, in, info, handler)
}
func _Authenticate_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(User)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthenticateServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Authenticate_Login_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthenticateServer).Login(ctx, req.(*User))
}
return interceptor(ctx, in, info, handler)
}
func _Authenticate_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(User)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthenticateServer).Logout(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Authenticate_Logout_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthenticateServer).Logout(ctx, req.(*User))
}
return interceptor(ctx, in, info, handler)
}
// Authenticate_ServiceDesc is the grpc.ServiceDesc for Authenticate service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Authenticate_ServiceDesc = grpc.ServiceDesc{
ServiceName: "auth.Authenticate",
HandlerType: (*AuthenticateServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "preLogin",
Handler: _Authenticate_PreLogin_Handler,
},
{
MethodName: "login",
Handler: _Authenticate_Login_Handler,
},
{
MethodName: "logout",
Handler: _Authenticate_Logout_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/auth.proto",
}

@ -0,0 +1,15 @@
version: v1
managed:
enabled: true
go_package_prefix:
default: github.com/rocboss/paopao-ce/auto/connect
except:
- buf.build/googleapis/googleapis
plugins:
- plugin: go
out: auto/connect
opt: paths=source_relative
- plugin: connect-go
out: auto/connect
opt:
- paths=source_relative

@ -1,3 +1,4 @@
version: v1
directories:
- proto
- proto/connect
- proto/grpc

@ -9,6 +9,7 @@ require (
github.com/alimy/mir/v4 v4.0.0-rc.1
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/allegro/bigcache/v3 v3.1.0
github.com/bufbuild/connect-go v1.9.0
github.com/bytedance/sonic v1.9.2
github.com/cockroachdb/errors v1.10.0
github.com/disintegration/imaging v1.6.2

@ -186,6 +186,8 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
github.com/bufbuild/connect-go v1.9.0 h1:JIgAeNuFpo+SUPfU19Yt5TcWlznsN5Bv10/gI/6Pjoc=
github.com/bufbuild/connect-go v1.9.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=

@ -1,21 +0,0 @@
// Copyright 2022 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package mobile
import (
api "github.com/rocboss/paopao-ce/auto/rpc/v1"
)
var (
_ api.AuthenticateServer = (*authenticateServant)(nil)
)
type authenticateServant struct {
api.UnimplementedAuthenticateServer
}
func newAuthenticateServer() *authenticateServant {
return &authenticateServant{}
}

@ -0,0 +1,21 @@
// Copyright 2022 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package mobile
import (
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
)
var (
_ api.GreetServiceServer = (*greetServiceSrv)(nil)
)
type greetServiceSrv struct {
api.UnimplementedGreetServiceServer
}
func newGreetServiceServer() *greetServiceSrv {
return &greetServiceSrv{}
}

@ -5,10 +5,10 @@
package mobile
import (
api "github.com/rocboss/paopao-ce/auto/rpc/v1"
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
"google.golang.org/grpc"
)
func RegisterServants(s *grpc.Server) {
api.RegisterAuthenticateServer(s, newAuthenticateServer())
api.RegisterGreetServiceServer(s, newGreetServiceServer())
}

@ -5,7 +5,10 @@
package servants
import (
"net/http"
"github.com/alimy/cfg"
"github.com/bufbuild/connect-go"
"github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/servants/admin"
"github.com/rocboss/paopao-ce/internal/servants/bot"
@ -14,6 +17,7 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/mobile"
"github.com/rocboss/paopao-ce/internal/servants/space"
"github.com/rocboss/paopao-ce/internal/servants/statick"
"github.com/rocboss/paopao-ce/internal/servants/triplet"
"github.com/rocboss/paopao-ce/internal/servants/web"
"google.golang.org/grpc"
)
@ -63,3 +67,8 @@ func RegisterFrontendWebServants(e *gin.Engine) {
func RegisterMobileServants(s *grpc.Server) {
mobile.RegisterServants(s)
}
// RegisterTripletServants register all the servants to Connect
func RegisterTripletServants(h func(string, http.Handler), opts ...connect.HandlerOption) {
triplet.RegisterAuthenticateHandler(h, opts...)
}

@ -0,0 +1,17 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package triplet
import (
api "github.com/rocboss/paopao-ce/auto/connect/core/v1/corev1connect"
)
var (
_ api.AuthenticateHandler = (*authenticateHandler)(nil)
)
type authenticateHandler struct {
api.UnimplementedAuthenticateHandler
}

@ -0,0 +1,16 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package triplet
import (
"net/http"
"github.com/bufbuild/connect-go"
api "github.com/rocboss/paopao-ce/auto/connect/core/v1/corev1connect"
)
func RegisterAuthenticateHandler(h func(string, http.Handler), opts ...connect.HandlerOption) {
h(api.NewAuthenticateHandler(&authenticateHandler{}, opts...))
}

@ -0,0 +1,55 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package service
import (
"context"
"net/http"
"github.com/bufbuild/connect-go"
)
var (
_ server = (*connectServer)(nil)
)
// connectServer wraper for connect
type connectServer struct {
*baseServer
isTLS bool
certFile string
keyFile string
handlerOpts []connect.HandlerOption
server *http.Server
mux *http.ServeMux
}
func (s *connectServer) start() error {
s.server.Handler = s.mux
if s.isTLS {
return s.server.ListenAndServeTLS(s.certFile, s.keyFile)
} else {
return s.server.ListenAndServe()
}
}
func (s *connectServer) stop() error {
return s.server.Shutdown(context.Background())
}
func (s *connectServer) register(path string, handler http.Handler) {
s.mux.Handle(path, handler)
}
func defaultConnectServer(addr string) *connectServer {
return &connectServer{
baseServer: newBaseServe(),
server: &http.Server{
Addr: addr,
},
mux: &http.ServeMux{},
}
}

@ -0,0 +1,32 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package service
import (
"net/http"
"github.com/bufbuild/connect-go"
)
type baseConnectService struct {
baseService
server *connectServer
}
func (s *baseConnectService) registerServer(srv Service, h func(func(string, http.Handler), ...connect.HandlerOption)) {
h(s.server.register, s.server.handlerOpts...)
s.server.addService(srv)
}
func (s *baseConnectService) OnStart() error {
// do nothing default
return nil
}
func (s *baseConnectService) OnStop() error {
// do nothing default
return nil
}

@ -15,8 +15,9 @@ import (
)
var (
httpServers = newServerPool[*httpServer]()
grpcServers = newServerPool[*grpcServer]()
httpServers = newServerPool[*httpServer]()
grpcServers = newServerPool[*grpcServer]()
connectServers = newServerPool[*connectServer]()
)
const (
@ -116,6 +117,7 @@ func checkServices() (int, int) {
var ss []Service
ss = append(ss, httpServers.allServices()...)
ss = append(ss, grpcServers.allServices()...)
ss = append(ss, connectServers.allServices()...)
return len(ss), maxSidSize(ss)
}
@ -174,6 +176,7 @@ func Start(wg *conc.WaitGroup) {
// start servers
httpServers.startServer(wg, maxSidSize)
grpcServers.startServer(wg, maxSidSize)
connectServers.startServer(wg, maxSidSize)
}
// Stop stop all servers
@ -185,4 +188,5 @@ func Stop() {
// stop servers
httpServers.stopServer(maxSidSize)
grpcServers.stopServer(maxSidSize)
connectServers.stopServer(maxSidSize)
}

@ -0,0 +1,51 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package service
import (
"fmt"
"github.com/Masterminds/semver/v3"
"github.com/fatih/color"
"github.com/rocboss/paopao-ce/internal/servants"
)
var (
_ Service = (*tripletService)(nil)
)
// tripletService just a demo service for Connect
type tripletService struct {
*baseConnectService
}
func (s *tripletService) Name() string {
return "TripletService"
}
func (s *tripletService) Version() *semver.Version {
return semver.MustParse("v0.1.0")
}
func (s *tripletService) OnInit() error {
s.registerServer(s, servants.RegisterTripletServants)
return nil
}
func (s *tripletService) String() string {
return fmt.Sprintf("listen on %s\n", color.GreenString("http://localhost:8080"))
}
func newTripletService() Service {
server := connectServers.from(":8080", func() *connectServer {
// TODO: do something for conenct server initialize
return defaultConnectServer(":8080")
})
return &tripletService{
baseConnectService: &baseConnectService{
server: server,
},
}
}

@ -1,7 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: c0ec788bbbb747fca594a1e2347edd4e

@ -1,10 +1,9 @@
version: v1
lint:
use:
- DEFAULT
breaking:
use:
- FILE
lint:
use:
- DEFAULT
deps:
- buf.build/googleapis/googleapis

@ -1,8 +1,8 @@
syntax = "proto3";
package auth;
package core.v1;
option go_package = "github.com/rocboss/paopao-ce/auto/rpc/v1";
option go_package = "github.com/rocboss/paopao-ce/auto/connect/core/v1;corev1";
message User {
string phoneNum = 1;

@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT

@ -0,0 +1,17 @@
syntax = "proto3";
package greet.v1;
option go_package = "github.com/rocboss/paopao-ce/auto/rpc/greet/v1;greetv1";
message GreetRequest {
string name = 1;
}
message GreetResponse {
string greeting = 1;
}
service GreetService {
rpc Greet(GreetRequest) returns (GreetResponse) {}
}
Loading…
Cancel
Save