Documentation ¶
Overview ¶
Package security is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterRestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterRestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RestServiceClient) error
- func RegisterRestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterRestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RestServiceServer) error
- func RegisterRestServiceServer(s grpc.ServiceRegistrar, srv RestServiceServer)
- type RestServiceClient
- type RestServiceServer
- type StringMessage
- type UnimplementedRestServiceServer
- type UnsafeRestServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_security_rest_service_proto protoreflect.FileDescriptor
var RestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "security.RestService", HandlerType: (*RestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _RestService_Get_Handler, }, { MethodName: "Post", Handler: _RestService_Post_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "security/rest_service.proto", }
RestService_ServiceDesc is the grpc.ServiceDesc for RestService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRestServiceHandler ¶
func RegisterRestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterRestServiceHandler registers the http handlers for service RestService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterRestServiceHandlerClient ¶
func RegisterRestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RestServiceClient) error
RegisterRestServiceHandlerClient registers the http handlers for service RestService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RestServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RestServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "RestServiceClient" to call the correct interceptors.
func RegisterRestServiceHandlerFromEndpoint ¶
func RegisterRestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterRestServiceHandlerFromEndpoint is same as RegisterRestServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRestServiceHandlerServer ¶
func RegisterRestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RestServiceServer) error
RegisterRestServiceHandlerServer registers the http handlers for service RestService to "mux". UnaryRPC :call RestServiceServer 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 RegisterRestServiceHandlerFromEndpoint instead.
func RegisterRestServiceServer ¶
func RegisterRestServiceServer(s grpc.ServiceRegistrar, srv RestServiceServer)
Types ¶
type RestServiceClient ¶
type RestServiceClient interface { // định nghĩa hàm RPC Get trong service Get(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error) // định nghĩa hàm RPC Post trong service Post(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error) }
RestServiceClient is the client API for RestService 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 NewRestServiceClient ¶
func NewRestServiceClient(cc grpc.ClientConnInterface) RestServiceClient
type RestServiceServer ¶
type RestServiceServer interface { // định nghĩa hàm RPC Get trong service Get(context.Context, *StringMessage) (*StringMessage, error) // định nghĩa hàm RPC Post trong service Post(context.Context, *StringMessage) (*StringMessage, error) }
RestServiceServer is the server API for RestService service. All implementations should embed UnimplementedRestServiceServer for forward compatibility
type StringMessage ¶
type StringMessage struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*StringMessage) Descriptor
deprecated
func (*StringMessage) Descriptor() ([]byte, []int)
Deprecated: Use StringMessage.ProtoReflect.Descriptor instead.
func (*StringMessage) GetValue ¶
func (x *StringMessage) GetValue() string
func (*StringMessage) ProtoMessage ¶
func (*StringMessage) ProtoMessage()
func (*StringMessage) ProtoReflect ¶
func (x *StringMessage) ProtoReflect() protoreflect.Message
func (*StringMessage) Reset ¶
func (x *StringMessage) Reset()
func (*StringMessage) String ¶
func (x *StringMessage) String() string
type UnimplementedRestServiceServer ¶
type UnimplementedRestServiceServer struct { }
UnimplementedRestServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedRestServiceServer) Get ¶
func (UnimplementedRestServiceServer) Get(context.Context, *StringMessage) (*StringMessage, error)
func (UnimplementedRestServiceServer) Post ¶
func (UnimplementedRestServiceServer) Post(context.Context, *StringMessage) (*StringMessage, error)
type UnsafeRestServiceServer ¶
type UnsafeRestServiceServer interface {
// contains filtered or unexported methods
}
UnsafeRestServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RestServiceServer will result in compilation errors.