Documentation ¶
Overview ¶
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
- func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
- func RegisterAccountServiceServer(s grpc.ServiceRegistrar, srv AccountServiceServer)
- func RegisterConfigServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigServiceClient) error
- func RegisterConfigServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error
- func RegisterConfigServiceServer(s grpc.ServiceRegistrar, srv ConfigServiceServer)
- type AccountServiceClient
- type AccountServiceServer
- type ConfigRequest
- func (*ConfigRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigRequest) GetDeviceType() string
- func (x *ConfigRequest) GetRegion() string
- func (*ConfigRequest) ProtoMessage()
- func (x *ConfigRequest) ProtoReflect() protoreflect.Message
- func (x *ConfigRequest) Reset()
- func (x *ConfigRequest) String() string
- type ConfigResponse
- type ConfigServiceClient
- type ConfigServiceServer
- type Endpoint
- type ForgetRequest
- type ForgetResponse
- type RefreshRequest
- type RefreshResponse
- type RegisterRequest
- type RegisterResponse
- type ServerInfo
- func (*ServerInfo) Descriptor() ([]byte, []int)deprecated
- func (x *ServerInfo) GetEndpoints() []*Endpoint
- func (x *ServerInfo) GetType() uint32
- func (*ServerInfo) ProtoMessage()
- func (x *ServerInfo) ProtoReflect() protoreflect.Message
- func (x *ServerInfo) Reset()
- func (x *ServerInfo) String() string
- type UnimplementedAccountServiceServer
- func (UnimplementedAccountServiceServer) Forget(context.Context, *ForgetRequest) (*ForgetResponse, error)
- func (UnimplementedAccountServiceServer) Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error)
- func (UnimplementedAccountServiceServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
- type UnimplementedConfigServiceServer
- type UnsafeAccountServiceServer
- type UnsafeConfigServiceServer
Constants ¶
const ( AccountService_Register_FullMethodName = "/icuc.api.AccountService/Register" AccountService_Refresh_FullMethodName = "/icuc.api.AccountService/Refresh" AccountService_Forget_FullMethodName = "/icuc.api.AccountService/Forget" )
const (
ConfigService_Get_FullMethodName = "/icuc.api.ConfigService/Get"
)
Variables ¶
var AccountService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "icuc.api.AccountService", HandlerType: (*AccountServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Register", Handler: _AccountService_Register_Handler, }, { MethodName: "Refresh", Handler: _AccountService_Refresh_Handler, }, { MethodName: "Forget", Handler: _AccountService_Forget_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/account.proto", }
AccountService_ServiceDesc is the grpc.ServiceDesc for AccountService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var ConfigService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "icuc.api.ConfigService", HandlerType: (*ConfigServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _ConfigService_Get_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/config_service.proto", }
ConfigService_ServiceDesc is the grpc.ServiceDesc for ConfigService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_account_proto protoreflect.FileDescriptor
var File_api_config_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAccountServiceHandler ¶
func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterAccountServiceHandler registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAccountServiceHandlerClient ¶
func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
RegisterAccountServiceHandlerClient registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AccountServiceClient" to call the correct interceptors.
func RegisterAccountServiceHandlerFromEndpoint ¶
func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAccountServiceHandlerFromEndpoint is same as RegisterAccountServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAccountServiceHandlerServer ¶
func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
RegisterAccountServiceHandlerServer registers the http handlers for service AccountService to "mux". UnaryRPC :call AccountServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAccountServiceHandlerFromEndpoint instead.
func RegisterAccountServiceServer ¶
func RegisterAccountServiceServer(s grpc.ServiceRegistrar, srv AccountServiceServer)
func RegisterConfigServiceHandler ¶
func RegisterConfigServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterConfigServiceHandler registers the http handlers for service ConfigService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterConfigServiceHandlerClient ¶
func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigServiceClient) error
RegisterConfigServiceHandlerClient registers the http handlers for service ConfigService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ConfigServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ConfigServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ConfigServiceClient" to call the correct interceptors.
func RegisterConfigServiceHandlerFromEndpoint ¶
func RegisterConfigServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterConfigServiceHandlerFromEndpoint is same as RegisterConfigServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterConfigServiceHandlerServer ¶
func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error
RegisterConfigServiceHandlerServer registers the http handlers for service ConfigService to "mux". UnaryRPC :call ConfigServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterConfigServiceHandlerFromEndpoint instead.
func RegisterConfigServiceServer ¶
func RegisterConfigServiceServer(s grpc.ServiceRegistrar, srv ConfigServiceServer)
Types ¶
type AccountServiceClient ¶
type AccountServiceClient interface { // 注册 Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) // 刷新token Refresh(ctx context.Context, in *RefreshRequest, opts ...grpc.CallOption) (*RefreshResponse, error) // 忘记密码 Forget(ctx context.Context, in *ForgetRequest, opts ...grpc.CallOption) (*ForgetResponse, error) }
AccountServiceClient is the client API for AccountService 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.
func NewAccountServiceClient ¶
func NewAccountServiceClient(cc grpc.ClientConnInterface) AccountServiceClient
type AccountServiceServer ¶
type AccountServiceServer interface { // 注册 Register(context.Context, *RegisterRequest) (*RegisterResponse, error) // 刷新token Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error) // 忘记密码 Forget(context.Context, *ForgetRequest) (*ForgetResponse, error) // contains filtered or unexported methods }
AccountServiceServer is the server API for AccountService service. All implementations must embed UnimplementedAccountServiceServer for forward compatibility
type ConfigRequest ¶
type ConfigRequest struct { Region string `protobuf:"bytes,1,opt,name=Region,proto3" json:"Region,omitempty"` // 请求来自的区域 DeviceType string `protobuf:"bytes,2,opt,name=DeviceType,proto3" json:"DeviceType,omitempty"` // 请求设备类型,1web网页设备,2移动端设备,3pc端设备 // contains filtered or unexported fields }
func (*ConfigRequest) Descriptor
deprecated
func (*ConfigRequest) Descriptor() ([]byte, []int)
Deprecated: Use ConfigRequest.ProtoReflect.Descriptor instead.
func (*ConfigRequest) GetDeviceType ¶
func (x *ConfigRequest) GetDeviceType() string
func (*ConfigRequest) GetRegion ¶
func (x *ConfigRequest) GetRegion() string
func (*ConfigRequest) ProtoMessage ¶
func (*ConfigRequest) ProtoMessage()
func (*ConfigRequest) ProtoReflect ¶
func (x *ConfigRequest) ProtoReflect() protoreflect.Message
func (*ConfigRequest) Reset ¶
func (x *ConfigRequest) Reset()
func (*ConfigRequest) String ¶
func (x *ConfigRequest) String() string
type ConfigResponse ¶
type ConfigResponse struct { ServerInfoList []*ServerInfo `protobuf:"bytes,1,rep,name=ServerInfoList,proto3" json:"ServerInfoList,omitempty"` // contains filtered or unexported fields }
func (*ConfigResponse) Descriptor
deprecated
func (*ConfigResponse) Descriptor() ([]byte, []int)
Deprecated: Use ConfigResponse.ProtoReflect.Descriptor instead.
func (*ConfigResponse) GetServerInfoList ¶
func (x *ConfigResponse) GetServerInfoList() []*ServerInfo
func (*ConfigResponse) ProtoMessage ¶
func (*ConfigResponse) ProtoMessage()
func (*ConfigResponse) ProtoReflect ¶
func (x *ConfigResponse) ProtoReflect() protoreflect.Message
func (*ConfigResponse) Reset ¶
func (x *ConfigResponse) Reset()
func (*ConfigResponse) String ¶
func (x *ConfigResponse) String() string
type ConfigServiceClient ¶
type ConfigServiceClient interface { // 拉取配置 Get(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) }
ConfigServiceClient is the client API for ConfigService 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.
func NewConfigServiceClient ¶
func NewConfigServiceClient(cc grpc.ClientConnInterface) ConfigServiceClient
type ConfigServiceServer ¶
type ConfigServiceServer interface { // 拉取配置 Get(context.Context, *ConfigRequest) (*ConfigResponse, error) // contains filtered or unexported methods }
ConfigServiceServer is the server API for ConfigService service. All implementations must embed UnimplementedConfigServiceServer for forward compatibility
type Endpoint ¶
type Endpoint struct { Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` // 带端口的地址,域名/ip +端口 Weight uint32 `protobuf:"varint,2,opt,name=Weight,proto3" json:"Weight,omitempty"` // 权重,取值[0,100] // contains filtered or unexported fields }
func (*Endpoint) Descriptor
deprecated
func (*Endpoint) GetAddress ¶
func (*Endpoint) ProtoMessage ¶
func (*Endpoint) ProtoMessage()
func (*Endpoint) ProtoReflect ¶
func (x *Endpoint) ProtoReflect() protoreflect.Message
type ForgetRequest ¶
type ForgetRequest struct {
// contains filtered or unexported fields
}
func (*ForgetRequest) Descriptor
deprecated
func (*ForgetRequest) Descriptor() ([]byte, []int)
Deprecated: Use ForgetRequest.ProtoReflect.Descriptor instead.
func (*ForgetRequest) ProtoMessage ¶
func (*ForgetRequest) ProtoMessage()
func (*ForgetRequest) ProtoReflect ¶
func (x *ForgetRequest) ProtoReflect() protoreflect.Message
func (*ForgetRequest) Reset ¶
func (x *ForgetRequest) Reset()
func (*ForgetRequest) String ¶
func (x *ForgetRequest) String() string
type ForgetResponse ¶
type ForgetResponse struct {
// contains filtered or unexported fields
}
func (*ForgetResponse) Descriptor
deprecated
func (*ForgetResponse) Descriptor() ([]byte, []int)
Deprecated: Use ForgetResponse.ProtoReflect.Descriptor instead.
func (*ForgetResponse) ProtoMessage ¶
func (*ForgetResponse) ProtoMessage()
func (*ForgetResponse) ProtoReflect ¶
func (x *ForgetResponse) ProtoReflect() protoreflect.Message
func (*ForgetResponse) Reset ¶
func (x *ForgetResponse) Reset()
func (*ForgetResponse) String ¶
func (x *ForgetResponse) String() string
type RefreshRequest ¶
type RefreshRequest struct {
// contains filtered or unexported fields
}
func (*RefreshRequest) Descriptor
deprecated
func (*RefreshRequest) Descriptor() ([]byte, []int)
Deprecated: Use RefreshRequest.ProtoReflect.Descriptor instead.
func (*RefreshRequest) ProtoMessage ¶
func (*RefreshRequest) ProtoMessage()
func (*RefreshRequest) ProtoReflect ¶
func (x *RefreshRequest) ProtoReflect() protoreflect.Message
func (*RefreshRequest) Reset ¶
func (x *RefreshRequest) Reset()
func (*RefreshRequest) String ¶
func (x *RefreshRequest) String() string
type RefreshResponse ¶
type RefreshResponse struct {
// contains filtered or unexported fields
}
func (*RefreshResponse) Descriptor
deprecated
func (*RefreshResponse) Descriptor() ([]byte, []int)
Deprecated: Use RefreshResponse.ProtoReflect.Descriptor instead.
func (*RefreshResponse) ProtoMessage ¶
func (*RefreshResponse) ProtoMessage()
func (*RefreshResponse) ProtoReflect ¶
func (x *RefreshResponse) ProtoReflect() protoreflect.Message
func (*RefreshResponse) Reset ¶
func (x *RefreshResponse) Reset()
func (*RefreshResponse) String ¶
func (x *RefreshResponse) String() string
type RegisterRequest ¶
type RegisterRequest struct {
// contains filtered or unexported fields
}
func (*RegisterRequest) Descriptor
deprecated
func (*RegisterRequest) Descriptor() ([]byte, []int)
Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.
func (*RegisterRequest) ProtoMessage ¶
func (*RegisterRequest) ProtoMessage()
func (*RegisterRequest) ProtoReflect ¶
func (x *RegisterRequest) ProtoReflect() protoreflect.Message
func (*RegisterRequest) Reset ¶
func (x *RegisterRequest) Reset()
func (*RegisterRequest) String ¶
func (x *RegisterRequest) String() string
type RegisterResponse ¶
type RegisterResponse struct {
// contains filtered or unexported fields
}
func (*RegisterResponse) Descriptor
deprecated
func (*RegisterResponse) Descriptor() ([]byte, []int)
Deprecated: Use RegisterResponse.ProtoReflect.Descriptor instead.
func (*RegisterResponse) ProtoMessage ¶
func (*RegisterResponse) ProtoMessage()
func (*RegisterResponse) ProtoReflect ¶
func (x *RegisterResponse) ProtoReflect() protoreflect.Message
func (*RegisterResponse) Reset ¶
func (x *RegisterResponse) Reset()
func (*RegisterResponse) String ¶
func (x *RegisterResponse) String() string
type ServerInfo ¶
type ServerInfo struct { Type uint32 `protobuf:"varint,1,opt,name=Type,proto3" json:"Type,omitempty"` // 服务器类型。1 API地址;2 IM长链接地址;3 CC信令地址;4 CC媒体地址 Endpoints []*Endpoint `protobuf:"bytes,2,rep,name=Endpoints,proto3" json:"Endpoints,omitempty"` // 服务器地址,多点灾备 // contains filtered or unexported fields }
func (*ServerInfo) Descriptor
deprecated
func (*ServerInfo) Descriptor() ([]byte, []int)
Deprecated: Use ServerInfo.ProtoReflect.Descriptor instead.
func (*ServerInfo) GetEndpoints ¶
func (x *ServerInfo) GetEndpoints() []*Endpoint
func (*ServerInfo) GetType ¶
func (x *ServerInfo) GetType() uint32
func (*ServerInfo) ProtoMessage ¶
func (*ServerInfo) ProtoMessage()
func (*ServerInfo) ProtoReflect ¶
func (x *ServerInfo) ProtoReflect() protoreflect.Message
func (*ServerInfo) Reset ¶
func (x *ServerInfo) Reset()
func (*ServerInfo) String ¶
func (x *ServerInfo) String() string
type UnimplementedAccountServiceServer ¶
type UnimplementedAccountServiceServer struct { }
UnimplementedAccountServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedAccountServiceServer) Forget ¶
func (UnimplementedAccountServiceServer) Forget(context.Context, *ForgetRequest) (*ForgetResponse, error)
func (UnimplementedAccountServiceServer) Refresh ¶
func (UnimplementedAccountServiceServer) Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error)
func (UnimplementedAccountServiceServer) Register ¶
func (UnimplementedAccountServiceServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
type UnimplementedConfigServiceServer ¶
type UnimplementedConfigServiceServer struct { }
UnimplementedConfigServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedConfigServiceServer) Get ¶
func (UnimplementedConfigServiceServer) Get(context.Context, *ConfigRequest) (*ConfigResponse, error)
type UnsafeAccountServiceServer ¶
type UnsafeAccountServiceServer interface {
// contains filtered or unexported methods
}
UnsafeAccountServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AccountServiceServer will result in compilation errors.
type UnsafeConfigServiceServer ¶
type UnsafeConfigServiceServer interface {
// contains filtered or unexported methods
}
UnsafeConfigServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ConfigServiceServer will result in compilation errors.