otto 5 months ago
parent
commit
77bb3da501
  1. 166
      proxy/v1/proxy.pb.go
  2. 11
      proxy/v1/proxy.proto
  3. 38
      proxy/v1/proxy_grpc.pb.go

166
proxy/v1/proxy.pb.go

@ -133,6 +133,100 @@ func (x *UseProxyResp) GetTcpPort() int32 {
return 0
}
type GetRoomNodeReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id"`
}
func (x *GetRoomNodeReq) Reset() {
*x = GetRoomNodeReq{}
if protoimpl.UnsafeEnabled {
mi := &file_proxy_v1_proxy_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetRoomNodeReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetRoomNodeReq) ProtoMessage() {}
func (x *GetRoomNodeReq) ProtoReflect() protoreflect.Message {
mi := &file_proxy_v1_proxy_proto_msgTypes[2]
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 GetRoomNodeReq.ProtoReflect.Descriptor instead.
func (*GetRoomNodeReq) Descriptor() ([]byte, []int) {
return file_proxy_v1_proxy_proto_rawDescGZIP(), []int{2}
}
func (x *GetRoomNodeReq) GetRoomId() int64 {
if x != nil {
return x.RoomId
}
return 0
}
type GetRoomNodeResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeId int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id"`
}
func (x *GetRoomNodeResp) Reset() {
*x = GetRoomNodeResp{}
if protoimpl.UnsafeEnabled {
mi := &file_proxy_v1_proxy_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetRoomNodeResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetRoomNodeResp) ProtoMessage() {}
func (x *GetRoomNodeResp) ProtoReflect() protoreflect.Message {
mi := &file_proxy_v1_proxy_proto_msgTypes[3]
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 GetRoomNodeResp.ProtoReflect.Descriptor instead.
func (*GetRoomNodeResp) Descriptor() ([]byte, []int) {
return file_proxy_v1_proxy_proto_rawDescGZIP(), []int{3}
}
func (x *GetRoomNodeResp) GetNodeId() int32 {
if x != nil {
return x.NodeId
}
return 0
}
var File_proxy_v1_proxy_proto protoreflect.FileDescriptor
var file_proxy_v1_proxy_proto_rawDesc = []byte{
@ -145,16 +239,26 @@ var file_proxy_v1_proxy_proto_rawDesc = []byte{
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x64, 0x70, 0x5f,
0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x75, 0x64, 0x70, 0x50,
0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x63, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x32, 0x48,
0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x39, 0x0a,
0x08, 0x55, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71,
0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x50,
0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e,
0x67, 0x7a, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x6a, 0x75, 0x6d, 0x61,
0x69, 0x79, 0x78, 0x2e, 0x63, 0x6e, 0x2f, 0x6a, 0x6d, 0x2f, 0x6a, 0x6d, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x29,
0x0a, 0x0e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71,
0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x0f, 0x47, 0x65, 0x74,
0x52, 0x6f, 0x6f, 0x6d, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x07,
0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e,
0x6f, 0x64, 0x65, 0x49, 0x64, 0x32, 0x8c, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70,
0x12, 0x42, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x4e, 0x6f, 0x64, 0x65, 0x12,
0x18, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f,
0x6f, 0x6d, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x4e, 0x6f, 0x64, 0x65,
0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x67, 0x7a, 0x2e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x6a, 0x75, 0x6d, 0x61, 0x69, 0x79, 0x78, 0x2e,
0x63, 0x6e, 0x2f, 0x6a, 0x6d, 0x2f, 0x6a, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72,
0x6f, 0x78, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -169,16 +273,20 @@ func file_proxy_v1_proxy_proto_rawDescGZIP() []byte {
return file_proxy_v1_proxy_proto_rawDescData
}
var file_proxy_v1_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_proxy_v1_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_proxy_v1_proxy_proto_goTypes = []interface{}{
(*UseProxyReq)(nil), // 0: proxy.v1.UseProxyReq
(*UseProxyResp)(nil), // 1: proxy.v1.UseProxyResp
(*UseProxyReq)(nil), // 0: proxy.v1.UseProxyReq
(*UseProxyResp)(nil), // 1: proxy.v1.UseProxyResp
(*GetRoomNodeReq)(nil), // 2: proxy.v1.GetRoomNodeReq
(*GetRoomNodeResp)(nil), // 3: proxy.v1.GetRoomNodeResp
}
var file_proxy_v1_proxy_proto_depIdxs = []int32{
0, // 0: proxy.v1.ProxyServer.UseProxy:input_type -> proxy.v1.UseProxyReq
1, // 1: proxy.v1.ProxyServer.UseProxy:output_type -> proxy.v1.UseProxyResp
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
2, // 1: proxy.v1.ProxyServer.GetRoomNode:input_type -> proxy.v1.GetRoomNodeReq
1, // 2: proxy.v1.ProxyServer.UseProxy:output_type -> proxy.v1.UseProxyResp
3, // 3: proxy.v1.ProxyServer.GetRoomNode:output_type -> proxy.v1.GetRoomNodeResp
2, // [2:4] is the sub-list for method output_type
0, // [0:2] 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
@ -214,6 +322,30 @@ func file_proxy_v1_proxy_proto_init() {
return nil
}
}
file_proxy_v1_proxy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetRoomNodeReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proxy_v1_proxy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetRoomNodeResp); 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{
@ -221,7 +353,7 @@ func file_proxy_v1_proxy_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proxy_v1_proxy_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},

11
proxy/v1/proxy.proto

@ -7,6 +7,9 @@ option go_package = "git.gz.internal.jumaiyx.cn/jm/jmproto/proxy/v1;v1";
service ProxyServer {
//
rpc UseProxy (UseProxyReq) returns (UseProxyResp);
//
rpc GetRoomNode (GetRoomNodeReq) returns (GetRoomNodeResp);
}
message UseProxyReq {
@ -20,4 +23,12 @@ message UseProxyResp {
int32 udp_port = 2;
// TCP端口
int32 tcp_port = 3;
}
message GetRoomNodeReq {
int64 room_id = 1;
}
message GetRoomNodeResp {
int32 node_id = 1;
}

38
proxy/v1/proxy_grpc.pb.go

@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
type ProxyServerClient interface {
// 获取房间代理网络
UseProxy(ctx context.Context, in *UseProxyReq, opts ...grpc.CallOption) (*UseProxyResp, error)
// 获取房间所在的节点
GetRoomNode(ctx context.Context, in *GetRoomNodeReq, opts ...grpc.CallOption) (*GetRoomNodeResp, error)
}
type proxyServerClient struct {
@ -43,12 +45,23 @@ func (c *proxyServerClient) UseProxy(ctx context.Context, in *UseProxyReq, opts
return out, nil
}
func (c *proxyServerClient) GetRoomNode(ctx context.Context, in *GetRoomNodeReq, opts ...grpc.CallOption) (*GetRoomNodeResp, error) {
out := new(GetRoomNodeResp)
err := c.cc.Invoke(ctx, "/proxy.v1.ProxyServer/GetRoomNode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ProxyServerServer is the server API for ProxyServer service.
// All implementations must embed UnimplementedProxyServerServer
// for forward compatibility
type ProxyServerServer interface {
// 获取房间代理网络
UseProxy(context.Context, *UseProxyReq) (*UseProxyResp, error)
// 获取房间所在的节点
GetRoomNode(context.Context, *GetRoomNodeReq) (*GetRoomNodeResp, error)
mustEmbedUnimplementedProxyServerServer()
}
@ -59,6 +72,9 @@ type UnimplementedProxyServerServer struct {
func (UnimplementedProxyServerServer) UseProxy(context.Context, *UseProxyReq) (*UseProxyResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UseProxy not implemented")
}
func (UnimplementedProxyServerServer) GetRoomNode(context.Context, *GetRoomNodeReq) (*GetRoomNodeResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRoomNode not implemented")
}
func (UnimplementedProxyServerServer) mustEmbedUnimplementedProxyServerServer() {}
// UnsafeProxyServerServer may be embedded to opt out of forward compatibility for this service.
@ -90,6 +106,24 @@ func _ProxyServer_UseProxy_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _ProxyServer_GetRoomNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRoomNodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProxyServerServer).GetRoomNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proxy.v1.ProxyServer/GetRoomNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProxyServerServer).GetRoomNode(ctx, req.(*GetRoomNodeReq))
}
return interceptor(ctx, in, info, handler)
}
// ProxyServer_ServiceDesc is the grpc.ServiceDesc for ProxyServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -101,6 +135,10 @@ var ProxyServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "UseProxy",
Handler: _ProxyServer_UseProxy_Handler,
},
{
MethodName: "GetRoomNode",
Handler: _ProxyServer_GetRoomNode_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proxy/v1/proxy.proto",

Loading…
Cancel
Save