remove connect style service/server base code

pull/628/head
alimy 5 months ago
parent 265f91b2d6
commit 822ad3856b

@ -88,9 +88,9 @@ gen-mir:
.PHONY: gen-rpc .PHONY: gen-rpc
gen-rpc: gen-rpc:
@rm -rf auto/rpc auto/connect @rm -rf auto/rpc
@buf generate proto @buf generate proto
@go fmt ./auto/rpc/... ./auto/connect/... @go fmt ./auto/rpc/...
.PHONY: proto-mod .PHONY: proto-mod
proto-mod: proto-mod:
@ -126,7 +126,6 @@ install-protobuf-plugins:
@go install github.com/bufbuild/buf/cmd/buf@latest @go install github.com/bufbuild/buf/cmd/buf@latest
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@latest @go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@latest
@go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@latest @go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@latest
@go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
@go install github.com/fullstorydev/grpcurl/cmd/grpcurl@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/protobuf/cmd/protoc-gen-go@latest
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest @go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

@ -1,173 +0,0 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: core/v1/auth.proto
package corev1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1 "github.com/rocboss/paopao-ce/auto/rpc/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.IsAtLeastVersion1_13_0
const (
// AuthenticateServiceName is the fully-qualified name of the AuthenticateService service.
AuthenticateServiceName = "core.v1.AuthenticateService"
)
// 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 (
// AuthenticateServicePreLoginProcedure is the fully-qualified name of the AuthenticateService's
// preLogin RPC.
AuthenticateServicePreLoginProcedure = "/core.v1.AuthenticateService/preLogin"
// AuthenticateServiceLoginProcedure is the fully-qualified name of the AuthenticateService's login
// RPC.
AuthenticateServiceLoginProcedure = "/core.v1.AuthenticateService/login"
// AuthenticateServiceLogoutProcedure is the fully-qualified name of the AuthenticateService's
// logout RPC.
AuthenticateServiceLogoutProcedure = "/core.v1.AuthenticateService/logout"
)
// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package.
var (
authenticateServiceServiceDescriptor = v1.File_core_v1_auth_proto.Services().ByName("AuthenticateService")
authenticateServicePreLoginMethodDescriptor = authenticateServiceServiceDescriptor.Methods().ByName("preLogin")
authenticateServiceLoginMethodDescriptor = authenticateServiceServiceDescriptor.Methods().ByName("login")
authenticateServiceLogoutMethodDescriptor = authenticateServiceServiceDescriptor.Methods().ByName("logout")
)
// AuthenticateServiceClient is a client for the core.v1.AuthenticateService service.
type AuthenticateServiceClient interface {
PreLogin(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error)
Login(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.LoginReply], error)
Logout(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error)
}
// NewAuthenticateServiceClient constructs a client for the core.v1.AuthenticateService 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 NewAuthenticateServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AuthenticateServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &authenticateServiceClient{
preLogin: connect.NewClient[v1.User, v1.ActionReply](
httpClient,
baseURL+AuthenticateServicePreLoginProcedure,
connect.WithSchema(authenticateServicePreLoginMethodDescriptor),
connect.WithClientOptions(opts...),
),
login: connect.NewClient[v1.User, v1.LoginReply](
httpClient,
baseURL+AuthenticateServiceLoginProcedure,
connect.WithSchema(authenticateServiceLoginMethodDescriptor),
connect.WithClientOptions(opts...),
),
logout: connect.NewClient[v1.User, v1.ActionReply](
httpClient,
baseURL+AuthenticateServiceLogoutProcedure,
connect.WithSchema(authenticateServiceLogoutMethodDescriptor),
connect.WithClientOptions(opts...),
),
}
}
// authenticateServiceClient implements AuthenticateServiceClient.
type authenticateServiceClient struct {
preLogin *connect.Client[v1.User, v1.ActionReply]
login *connect.Client[v1.User, v1.LoginReply]
logout *connect.Client[v1.User, v1.ActionReply]
}
// PreLogin calls core.v1.AuthenticateService.preLogin.
func (c *authenticateServiceClient) PreLogin(ctx context.Context, req *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error) {
return c.preLogin.CallUnary(ctx, req)
}
// Login calls core.v1.AuthenticateService.login.
func (c *authenticateServiceClient) Login(ctx context.Context, req *connect.Request[v1.User]) (*connect.Response[v1.LoginReply], error) {
return c.login.CallUnary(ctx, req)
}
// Logout calls core.v1.AuthenticateService.logout.
func (c *authenticateServiceClient) Logout(ctx context.Context, req *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error) {
return c.logout.CallUnary(ctx, req)
}
// AuthenticateServiceHandler is an implementation of the core.v1.AuthenticateService service.
type AuthenticateServiceHandler interface {
PreLogin(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error)
Login(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.LoginReply], error)
Logout(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error)
}
// NewAuthenticateServiceHandler 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 NewAuthenticateServiceHandler(svc AuthenticateServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
authenticateServicePreLoginHandler := connect.NewUnaryHandler(
AuthenticateServicePreLoginProcedure,
svc.PreLogin,
connect.WithSchema(authenticateServicePreLoginMethodDescriptor),
connect.WithHandlerOptions(opts...),
)
authenticateServiceLoginHandler := connect.NewUnaryHandler(
AuthenticateServiceLoginProcedure,
svc.Login,
connect.WithSchema(authenticateServiceLoginMethodDescriptor),
connect.WithHandlerOptions(opts...),
)
authenticateServiceLogoutHandler := connect.NewUnaryHandler(
AuthenticateServiceLogoutProcedure,
svc.Logout,
connect.WithSchema(authenticateServiceLogoutMethodDescriptor),
connect.WithHandlerOptions(opts...),
)
return "/core.v1.AuthenticateService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case AuthenticateServicePreLoginProcedure:
authenticateServicePreLoginHandler.ServeHTTP(w, r)
case AuthenticateServiceLoginProcedure:
authenticateServiceLoginHandler.ServeHTTP(w, r)
case AuthenticateServiceLogoutProcedure:
authenticateServiceLogoutHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedAuthenticateServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedAuthenticateServiceHandler struct{}
func (UnimplementedAuthenticateServiceHandler) PreLogin(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("core.v1.AuthenticateService.preLogin is not implemented"))
}
func (UnimplementedAuthenticateServiceHandler) Login(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.LoginReply], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("core.v1.AuthenticateService.login is not implemented"))
}
func (UnimplementedAuthenticateServiceHandler) Logout(context.Context, *connect.Request[v1.User]) (*connect.Response[v1.ActionReply], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("core.v1.AuthenticateService.logout is not implemented"))
}

@ -1,112 +0,0 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: greet/v1/greet.proto
package greetv1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1 "github.com/rocboss/paopao-ce/auto/rpc/greet/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.IsAtLeastVersion1_13_0
const (
// GreetServiceName is the fully-qualified name of the GreetService service.
GreetServiceName = "greet.v1.GreetService"
)
// 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 (
// GreetServiceGreetProcedure is the fully-qualified name of the GreetService's Greet RPC.
GreetServiceGreetProcedure = "/greet.v1.GreetService/Greet"
)
// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package.
var (
greetServiceServiceDescriptor = v1.File_greet_v1_greet_proto.Services().ByName("GreetService")
greetServiceGreetMethodDescriptor = greetServiceServiceDescriptor.Methods().ByName("Greet")
)
// GreetServiceClient is a client for the greet.v1.GreetService service.
type GreetServiceClient interface {
Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error)
}
// NewGreetServiceClient constructs a client for the greet.v1.GreetService 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 NewGreetServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GreetServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &greetServiceClient{
greet: connect.NewClient[v1.GreetRequest, v1.GreetResponse](
httpClient,
baseURL+GreetServiceGreetProcedure,
connect.WithSchema(greetServiceGreetMethodDescriptor),
connect.WithClientOptions(opts...),
),
}
}
// greetServiceClient implements GreetServiceClient.
type greetServiceClient struct {
greet *connect.Client[v1.GreetRequest, v1.GreetResponse]
}
// Greet calls greet.v1.GreetService.Greet.
func (c *greetServiceClient) Greet(ctx context.Context, req *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) {
return c.greet.CallUnary(ctx, req)
}
// GreetServiceHandler is an implementation of the greet.v1.GreetService service.
type GreetServiceHandler interface {
Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error)
}
// NewGreetServiceHandler 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 NewGreetServiceHandler(svc GreetServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
greetServiceGreetHandler := connect.NewUnaryHandler(
GreetServiceGreetProcedure,
svc.Greet,
connect.WithSchema(greetServiceGreetMethodDescriptor),
connect.WithHandlerOptions(opts...),
)
return "/greet.v1.GreetService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case GreetServiceGreetProcedure:
greetServiceGreetHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedGreetServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedGreetServiceHandler struct{}
func (UnimplementedGreetServiceHandler) Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("greet.v1.GreetService.Greet is not implemented"))
}

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.32.0 // protoc-gen-go v1.36.6
// protoc (unknown) // protoc (unknown)
// source: core/v1/auth.proto // source: core/v1/auth.proto
@ -11,6 +11,7 @@ import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
unsafe "unsafe"
) )
const ( const (
@ -21,20 +22,17 @@ const (
) )
type User struct { type User struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache PhoneNum string `protobuf:"bytes,1,opt,name=phone_num,json=phoneNum,proto3" json:"phone_num,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
PhoneNum string `protobuf:"bytes,1,opt,name=phone_num,json=phoneNum,proto3" json:"phone_num,omitempty"`
} }
func (x *User) Reset() { func (x *User) Reset() {
*x = User{} *x = User{}
if protoimpl.UnsafeEnabled { mi := &file_core_v1_auth_proto_msgTypes[0]
mi := &file_core_v1_auth_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *User) String() string { func (x *User) String() string {
@ -45,7 +43,7 @@ func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message { func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_core_v1_auth_proto_msgTypes[0] mi := &file_core_v1_auth_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -68,21 +66,18 @@ func (x *User) GetPhoneNum() string {
} }
type UserVerify struct { type UserVerify struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache PhoneNum string `protobuf:"bytes,1,opt,name=phone_num,json=phoneNum,proto3" json:"phone_num,omitempty"`
unknownFields protoimpl.UnknownFields VerificationCode string `protobuf:"bytes,2,opt,name=verification_code,json=verificationCode,proto3" json:"verification_code,omitempty"`
unknownFields protoimpl.UnknownFields
PhoneNum string `protobuf:"bytes,1,opt,name=phone_num,json=phoneNum,proto3" json:"phone_num,omitempty"` sizeCache protoimpl.SizeCache
VerificationCode string `protobuf:"bytes,2,opt,name=verification_code,json=verificationCode,proto3" json:"verification_code,omitempty"`
} }
func (x *UserVerify) Reset() { func (x *UserVerify) Reset() {
*x = UserVerify{} *x = UserVerify{}
if protoimpl.UnsafeEnabled { mi := &file_core_v1_auth_proto_msgTypes[1]
mi := &file_core_v1_auth_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *UserVerify) String() string { func (x *UserVerify) String() string {
@ -93,7 +88,7 @@ func (*UserVerify) ProtoMessage() {}
func (x *UserVerify) ProtoReflect() protoreflect.Message { func (x *UserVerify) ProtoReflect() protoreflect.Message {
mi := &file_core_v1_auth_proto_msgTypes[1] mi := &file_core_v1_auth_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -123,21 +118,18 @@ func (x *UserVerify) GetVerificationCode() string {
} }
type LoginReply struct { type LoginReply struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
} }
func (x *LoginReply) Reset() { func (x *LoginReply) Reset() {
*x = LoginReply{} *x = LoginReply{}
if protoimpl.UnsafeEnabled { mi := &file_core_v1_auth_proto_msgTypes[2]
mi := &file_core_v1_auth_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *LoginReply) String() string { func (x *LoginReply) String() string {
@ -148,7 +140,7 @@ func (*LoginReply) ProtoMessage() {}
func (x *LoginReply) ProtoReflect() protoreflect.Message { func (x *LoginReply) ProtoReflect() protoreflect.Message {
mi := &file_core_v1_auth_proto_msgTypes[2] mi := &file_core_v1_auth_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -178,20 +170,17 @@ func (x *LoginReply) GetToken() string {
} }
type ActionReply struct { type ActionReply struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
} }
func (x *ActionReply) Reset() { func (x *ActionReply) Reset() {
*x = ActionReply{} *x = ActionReply{}
if protoimpl.UnsafeEnabled { mi := &file_core_v1_auth_proto_msgTypes[3]
mi := &file_core_v1_auth_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *ActionReply) String() string { func (x *ActionReply) String() string {
@ -202,7 +191,7 @@ func (*ActionReply) ProtoMessage() {}
func (x *ActionReply) ProtoReflect() protoreflect.Message { func (x *ActionReply) ProtoReflect() protoreflect.Message {
mi := &file_core_v1_auth_proto_msgTypes[3] mi := &file_core_v1_auth_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -226,60 +215,43 @@ func (x *ActionReply) GetStatusCode() int32 {
var File_core_v1_auth_proto protoreflect.FileDescriptor var File_core_v1_auth_proto protoreflect.FileDescriptor
var file_core_v1_auth_proto_rawDesc = []byte{ const file_core_v1_auth_proto_rawDesc = "" +
0x0a, 0x12, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, "\n" +
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x22, 0x23, 0x0a, "\x12core/v1/auth.proto\x12\acore.v1\"#\n" +
0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, "\x04User\x12\x1b\n" +
0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, "\tphone_num\x18\x01 \x01(\tR\bphoneNum\"V\n" +
0x75, 0x6d, 0x22, 0x56, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, "\n" +
0x12, 0x1b, 0x0a, 0x09, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, "UserVerify\x12\x1b\n" +
0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x2b, 0x0a, "\tphone_num\x18\x01 \x01(\tR\bphoneNum\x12+\n" +
0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, "\x11verification_code\x18\x02 \x01(\tR\x10verificationCode\"C\n" +
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, "\n" +
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x43, 0x0a, 0x0a, 0x4c, 0x6f, "LoginReply\x12\x1f\n" +
0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, "\vstatus_code\x18\x01 \x01(\x05R\n" +
0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, "statusCode\x12\x14\n" +
0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, "\x05token\x18\x02 \x01(\tR\x05token\".\n" +
0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, "\vActionReply\x12\x1f\n" +
0x2e, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1f, "\vstatus_code\x18\x01 \x01(\x05R\n" +
0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, "statusCode2\xa2\x01\n" +
0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x32, "\x13AuthenticateService\x12/\n" +
0xa2, 0x01, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, "\bpreLogin\x12\r.core.v1.User\x1a\x14.core.v1.ActionReply\x12+\n" +
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4c, 0x6f, "\x05login\x12\r.core.v1.User\x1a\x13.core.v1.LoginReply\x12-\n" +
0x67, 0x69, 0x6e, 0x12, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, "\x06logout\x12\r.core.v1.User\x1a\x14.core.v1.ActionReplyB\x8b\x01\n" +
0x65, 0x72, 0x1a, 0x14, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, "\vcom.core.v1B\tAuthProtoP\x01Z4github.com/rocboss/paopao-ce/auto/rpc/core/v1;corev1\xa2\x02\x03CXX\xaa\x02\aCore.V1\xca\x02\aCore\\V1\xe2\x02\x13Core\\V1\\GPBMetadata\xea\x02\bCore::V1b\x06proto3"
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, 0x8b, 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, 0x34, 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, 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 ( var (
file_core_v1_auth_proto_rawDescOnce sync.Once file_core_v1_auth_proto_rawDescOnce sync.Once
file_core_v1_auth_proto_rawDescData = file_core_v1_auth_proto_rawDesc file_core_v1_auth_proto_rawDescData []byte
) )
func file_core_v1_auth_proto_rawDescGZIP() []byte { func file_core_v1_auth_proto_rawDescGZIP() []byte {
file_core_v1_auth_proto_rawDescOnce.Do(func() { file_core_v1_auth_proto_rawDescOnce.Do(func() {
file_core_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_core_v1_auth_proto_rawDescData) file_core_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_core_v1_auth_proto_rawDesc), len(file_core_v1_auth_proto_rawDesc)))
}) })
return file_core_v1_auth_proto_rawDescData return file_core_v1_auth_proto_rawDescData
} }
var file_core_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_core_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_core_v1_auth_proto_goTypes = []interface{}{ var file_core_v1_auth_proto_goTypes = []any{
(*User)(nil), // 0: core.v1.User (*User)(nil), // 0: core.v1.User
(*UserVerify)(nil), // 1: core.v1.UserVerify (*UserVerify)(nil), // 1: core.v1.UserVerify
(*LoginReply)(nil), // 2: core.v1.LoginReply (*LoginReply)(nil), // 2: core.v1.LoginReply
@ -304,61 +276,11 @@ func file_core_v1_auth_proto_init() {
if File_core_v1_auth_proto != nil { if File_core_v1_auth_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled {
file_core_v1_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_core_v1_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserVerify); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_core_v1_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_core_v1_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActionReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_core_v1_auth_proto_rawDesc, RawDescriptor: unsafe.Slice(unsafe.StringData(file_core_v1_auth_proto_rawDesc), len(file_core_v1_auth_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 4, NumMessages: 4,
NumExtensions: 0, NumExtensions: 0,
@ -369,7 +291,6 @@ func file_core_v1_auth_proto_init() {
MessageInfos: file_core_v1_auth_proto_msgTypes, MessageInfos: file_core_v1_auth_proto_msgTypes,
}.Build() }.Build()
File_core_v1_auth_proto = out.File 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_goTypes = nil
file_core_v1_auth_proto_depIdxs = nil file_core_v1_auth_proto_depIdxs = nil
} }

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.3.0 // - protoc-gen-go-grpc v1.5.1
// - protoc (unknown) // - protoc (unknown)
// source: core/v1/auth.proto // source: core/v1/auth.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const ( const (
AuthenticateService_PreLogin_FullMethodName = "/core.v1.AuthenticateService/preLogin" AuthenticateService_PreLogin_FullMethodName = "/core.v1.AuthenticateService/preLogin"
@ -42,8 +42,9 @@ func NewAuthenticateServiceClient(cc grpc.ClientConnInterface) AuthenticateServi
} }
func (c *authenticateServiceClient) PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) { func (c *authenticateServiceClient) PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ActionReply) out := new(ActionReply)
err := c.cc.Invoke(ctx, AuthenticateService_PreLogin_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, AuthenticateService_PreLogin_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -51,8 +52,9 @@ func (c *authenticateServiceClient) PreLogin(ctx context.Context, in *User, opts
} }
func (c *authenticateServiceClient) Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error) { func (c *authenticateServiceClient) Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginReply) out := new(LoginReply)
err := c.cc.Invoke(ctx, AuthenticateService_Login_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, AuthenticateService_Login_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -60,8 +62,9 @@ func (c *authenticateServiceClient) Login(ctx context.Context, in *User, opts ..
} }
func (c *authenticateServiceClient) Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) { func (c *authenticateServiceClient) Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ActionReply) out := new(ActionReply)
err := c.cc.Invoke(ctx, AuthenticateService_Logout_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, AuthenticateService_Logout_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -70,7 +73,7 @@ func (c *authenticateServiceClient) Logout(ctx context.Context, in *User, opts .
// AuthenticateServiceServer is the server API for AuthenticateService service. // AuthenticateServiceServer is the server API for AuthenticateService service.
// All implementations must embed UnimplementedAuthenticateServiceServer // All implementations must embed UnimplementedAuthenticateServiceServer
// for forward compatibility // for forward compatibility.
type AuthenticateServiceServer interface { type AuthenticateServiceServer interface {
PreLogin(context.Context, *User) (*ActionReply, error) PreLogin(context.Context, *User) (*ActionReply, error)
Login(context.Context, *User) (*LoginReply, error) Login(context.Context, *User) (*LoginReply, error)
@ -78,9 +81,12 @@ type AuthenticateServiceServer interface {
mustEmbedUnimplementedAuthenticateServiceServer() mustEmbedUnimplementedAuthenticateServiceServer()
} }
// UnimplementedAuthenticateServiceServer must be embedded to have forward compatible implementations. // UnimplementedAuthenticateServiceServer must be embedded to have
type UnimplementedAuthenticateServiceServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuthenticateServiceServer struct{}
func (UnimplementedAuthenticateServiceServer) PreLogin(context.Context, *User) (*ActionReply, error) { func (UnimplementedAuthenticateServiceServer) PreLogin(context.Context, *User) (*ActionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented") return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented")
@ -92,6 +98,7 @@ func (UnimplementedAuthenticateServiceServer) Logout(context.Context, *User) (*A
return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented")
} }
func (UnimplementedAuthenticateServiceServer) mustEmbedUnimplementedAuthenticateServiceServer() {} func (UnimplementedAuthenticateServiceServer) mustEmbedUnimplementedAuthenticateServiceServer() {}
func (UnimplementedAuthenticateServiceServer) testEmbeddedByValue() {}
// UnsafeAuthenticateServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeAuthenticateServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthenticateServiceServer will // Use of this interface is not recommended, as added methods to AuthenticateServiceServer will
@ -101,6 +108,13 @@ type UnsafeAuthenticateServiceServer interface {
} }
func RegisterAuthenticateServiceServer(s grpc.ServiceRegistrar, srv AuthenticateServiceServer) { func RegisterAuthenticateServiceServer(s grpc.ServiceRegistrar, srv AuthenticateServiceServer) {
// If the following call pancis, it indicates UnimplementedAuthenticateServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AuthenticateService_ServiceDesc, srv) s.RegisterService(&AuthenticateService_ServiceDesc, srv)
} }

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.32.0 // protoc-gen-go v1.36.6
// protoc (unknown) // protoc (unknown)
// source: greet/v1/greet.proto // source: greet/v1/greet.proto
@ -11,6 +11,7 @@ import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
unsafe "unsafe"
) )
const ( const (
@ -21,20 +22,17 @@ const (
) )
type GreetRequest struct { type GreetRequest struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
} }
func (x *GreetRequest) Reset() { func (x *GreetRequest) Reset() {
*x = GreetRequest{} *x = GreetRequest{}
if protoimpl.UnsafeEnabled { mi := &file_greet_v1_greet_proto_msgTypes[0]
mi := &file_greet_v1_greet_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *GreetRequest) String() string { func (x *GreetRequest) String() string {
@ -45,7 +43,7 @@ func (*GreetRequest) ProtoMessage() {}
func (x *GreetRequest) ProtoReflect() protoreflect.Message { func (x *GreetRequest) ProtoReflect() protoreflect.Message {
mi := &file_greet_v1_greet_proto_msgTypes[0] mi := &file_greet_v1_greet_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -68,20 +66,17 @@ func (x *GreetRequest) GetName() string {
} }
type GreetResponse struct { type GreetResponse struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
} }
func (x *GreetResponse) Reset() { func (x *GreetResponse) Reset() {
*x = GreetResponse{} *x = GreetResponse{}
if protoimpl.UnsafeEnabled { mi := &file_greet_v1_greet_proto_msgTypes[1]
mi := &file_greet_v1_greet_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *GreetResponse) String() string { func (x *GreetResponse) String() string {
@ -92,7 +87,7 @@ func (*GreetResponse) ProtoMessage() {}
func (x *GreetResponse) ProtoReflect() protoreflect.Message { func (x *GreetResponse) ProtoReflect() protoreflect.Message {
mi := &file_greet_v1_greet_proto_msgTypes[1] mi := &file_greet_v1_greet_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -116,45 +111,32 @@ func (x *GreetResponse) GetGreeting() string {
var File_greet_v1_greet_proto protoreflect.FileDescriptor var File_greet_v1_greet_proto protoreflect.FileDescriptor
var file_greet_v1_greet_proto_rawDesc = []byte{ const file_greet_v1_greet_proto_rawDesc = "" +
0x0a, 0x14, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x65, 0x65, 0x74, "\n" +
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x76, 0x31, "\x14greet/v1/greet.proto\x12\bgreet.v1\"\"\n" +
0x22, 0x22, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, "\fGreetRequest\x12\x12\n" +
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, "\x04name\x18\x01 \x01(\tR\x04name\"+\n" +
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x73, "\rGreetResponse\x12\x1a\n" +
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, "\bgreeting\x18\x01 \x01(\tR\bgreeting2J\n" +
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, "\fGreetService\x12:\n" +
0x67, 0x32, 0x4a, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, "\x05Greet\x12\x16.greet.v1.GreetRequest\x1a\x17.greet.v1.GreetResponse\"\x00B\x93\x01\n" +
0x65, 0x12, 0x3a, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x72, 0x65, "\fcom.greet.v1B\n" +
0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, "GreetProtoP\x01Z6github.com/rocboss/paopao-ce/auto/rpc/greet/v1;greetv1\xa2\x02\x03GXX\xaa\x02\bGreet.V1\xca\x02\bGreet\\V1\xe2\x02\x14Greet\\V1\\GPBMetadata\xea\x02\tGreet::V1b\x06proto3"
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 ( var (
file_greet_v1_greet_proto_rawDescOnce sync.Once file_greet_v1_greet_proto_rawDescOnce sync.Once
file_greet_v1_greet_proto_rawDescData = file_greet_v1_greet_proto_rawDesc file_greet_v1_greet_proto_rawDescData []byte
) )
func file_greet_v1_greet_proto_rawDescGZIP() []byte { func file_greet_v1_greet_proto_rawDescGZIP() []byte {
file_greet_v1_greet_proto_rawDescOnce.Do(func() { file_greet_v1_greet_proto_rawDescOnce.Do(func() {
file_greet_v1_greet_proto_rawDescData = protoimpl.X.CompressGZIP(file_greet_v1_greet_proto_rawDescData) file_greet_v1_greet_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_greet_v1_greet_proto_rawDesc), len(file_greet_v1_greet_proto_rawDesc)))
}) })
return 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_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_greet_v1_greet_proto_goTypes = []interface{}{ var file_greet_v1_greet_proto_goTypes = []any{
(*GreetRequest)(nil), // 0: greet.v1.GreetRequest (*GreetRequest)(nil), // 0: greet.v1.GreetRequest
(*GreetResponse)(nil), // 1: greet.v1.GreetResponse (*GreetResponse)(nil), // 1: greet.v1.GreetResponse
} }
@ -173,37 +155,11 @@ func file_greet_v1_greet_proto_init() {
if File_greet_v1_greet_proto != nil { if File_greet_v1_greet_proto != nil {
return 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{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_greet_v1_greet_proto_rawDesc, RawDescriptor: unsafe.Slice(unsafe.StringData(file_greet_v1_greet_proto_rawDesc), len(file_greet_v1_greet_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 2, NumMessages: 2,
NumExtensions: 0, NumExtensions: 0,
@ -214,7 +170,6 @@ func file_greet_v1_greet_proto_init() {
MessageInfos: file_greet_v1_greet_proto_msgTypes, MessageInfos: file_greet_v1_greet_proto_msgTypes,
}.Build() }.Build()
File_greet_v1_greet_proto = out.File 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_goTypes = nil
file_greet_v1_greet_proto_depIdxs = nil file_greet_v1_greet_proto_depIdxs = nil
} }

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.3.0 // - protoc-gen-go-grpc v1.5.1
// - protoc (unknown) // - protoc (unknown)
// source: greet/v1/greet.proto // source: greet/v1/greet.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const ( const (
GreetService_Greet_FullMethodName = "/greet.v1.GreetService/Greet" GreetService_Greet_FullMethodName = "/greet.v1.GreetService/Greet"
@ -38,8 +38,9 @@ func NewGreetServiceClient(cc grpc.ClientConnInterface) GreetServiceClient {
} }
func (c *greetServiceClient) Greet(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (*GreetResponse, error) { func (c *greetServiceClient) Greet(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (*GreetResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GreetResponse) out := new(GreetResponse)
err := c.cc.Invoke(ctx, GreetService_Greet_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, GreetService_Greet_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -48,20 +49,24 @@ func (c *greetServiceClient) Greet(ctx context.Context, in *GreetRequest, opts .
// GreetServiceServer is the server API for GreetService service. // GreetServiceServer is the server API for GreetService service.
// All implementations must embed UnimplementedGreetServiceServer // All implementations must embed UnimplementedGreetServiceServer
// for forward compatibility // for forward compatibility.
type GreetServiceServer interface { type GreetServiceServer interface {
Greet(context.Context, *GreetRequest) (*GreetResponse, error) Greet(context.Context, *GreetRequest) (*GreetResponse, error)
mustEmbedUnimplementedGreetServiceServer() mustEmbedUnimplementedGreetServiceServer()
} }
// UnimplementedGreetServiceServer must be embedded to have forward compatible implementations. // UnimplementedGreetServiceServer must be embedded to have
type UnimplementedGreetServiceServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedGreetServiceServer struct{}
func (UnimplementedGreetServiceServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error) { func (UnimplementedGreetServiceServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented") return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented")
} }
func (UnimplementedGreetServiceServer) mustEmbedUnimplementedGreetServiceServer() {} func (UnimplementedGreetServiceServer) mustEmbedUnimplementedGreetServiceServer() {}
func (UnimplementedGreetServiceServer) testEmbeddedByValue() {}
// UnsafeGreetServiceServer may be embedded to opt out of forward compatibility for this service. // 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 // Use of this interface is not recommended, as added methods to GreetServiceServer will
@ -71,6 +76,13 @@ type UnsafeGreetServiceServer interface {
} }
func RegisterGreetServiceServer(s grpc.ServiceRegistrar, srv GreetServiceServer) { func RegisterGreetServiceServer(s grpc.ServiceRegistrar, srv GreetServiceServer) {
// If the following call pancis, it indicates UnimplementedGreetServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&GreetService_ServiceDesc, srv) s.RegisterService(&GreetService_ServiceDesc, srv)
} }

@ -14,6 +14,3 @@ plugins:
opt: opt:
- paths=source_relative - paths=source_relative
- require_unimplemented_servers=true - require_unimplemented_servers=true
- plugin: connect-go
out: auto/connect
opt: paths=source_relative

@ -3,7 +3,6 @@ module github.com/rocboss/paopao-ce
go 1.23.0 go 1.23.0
require ( require (
connectrpc.com/connect v1.18.1
github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/semver/v3 v3.2.1
github.com/RoaringBitmap/roaring v1.9.4 github.com/RoaringBitmap/roaring v1.9.4
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868

@ -1,5 +1,3 @@
connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw=
connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=

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

@ -1,17 +0,0 @@
// 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.AuthenticateServiceHandler = (*authenticateSrv)(nil)
)
type authenticateSrv struct {
api.UnimplementedAuthenticateServiceHandler
}

@ -1,16 +0,0 @@
// 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"
"connectrpc.com/connect"
api "github.com/rocboss/paopao-ce/auto/connect/core/v1/corev1connect"
)
func RegisterAuthenticateHandler(h func(string, http.Handler), opts ...connect.HandlerOption) {
h(api.NewAuthenticateServiceHandler(&authenticateSrv{}, opts...))
}

@ -1,67 +0,0 @@
// 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"
"connectrpc.com/connect"
hx "github.com/rocboss/paopao-ce/pkg/http"
)
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 connectMux
}
type connectMux interface {
http.Handler
Handle(string, http.Handler)
}
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) (s *connectServer) {
s = &connectServer{
baseServer: newBaseServe(),
server: &http.Server{
Addr: addr,
},
mux: &http.ServeMux{},
}
// TODO: custom value from config
var useConnectMux bool
if useConnectMux {
s.mux = hx.NewConnectMux()
}
return
}

@ -1,32 +0,0 @@
// 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"
"connectrpc.com/connect"
)
type baseConnectService struct {
baseService
server *connectServer
}
func (s *baseConnectService) registerServer(srv Service, h func(func(string, http.Handler), ...connect.HandlerOption), opts ...connect.HandlerOption) {
h(s.server.register, append(opts, 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,9 +15,8 @@ import (
) )
var ( var (
httpServers = newServerPool[*httpServer]() httpServers = newServerPool[*httpServer]()
grpcServers = newServerPool[*grpcServer]() grpcServers = newServerPool[*grpcServer]()
connectServers = newServerPool[*connectServer]()
) )
const ( const (
@ -117,7 +116,6 @@ func checkServices() (int, int) {
var ss []Service var ss []Service
ss = append(ss, httpServers.allServices()...) ss = append(ss, httpServers.allServices()...)
ss = append(ss, grpcServers.allServices()...) ss = append(ss, grpcServers.allServices()...)
ss = append(ss, connectServers.allServices()...)
return len(ss), maxSidSize(ss) return len(ss), maxSidSize(ss)
} }
@ -176,7 +174,6 @@ func Start(wg *conc.WaitGroup) {
// start servers // start servers
httpServers.startServer(wg, maxSidSize) httpServers.startServer(wg, maxSidSize)
grpcServers.startServer(wg, maxSidSize) grpcServers.startServer(wg, maxSidSize)
connectServers.startServer(wg, maxSidSize)
} }
// Stop stop all servers // Stop stop all servers
@ -188,5 +185,4 @@ func Stop() {
// stop servers // stop servers
httpServers.stopServer(maxSidSize) httpServers.stopServer(maxSidSize)
grpcServers.stopServer(maxSidSize) grpcServers.stopServer(maxSidSize)
connectServers.stopServer(maxSidSize)
} }

@ -1,51 +0,0 @@
// 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,
},
}
}
Loading…
Cancel
Save