proto

package
v0.0.0-...-b9041c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

Functions

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 ConfigServiceClient

type ConfigServiceClient interface {
	// 获取配置
	GetConfig(ctx context.Context, in *GetCfgReq, opts ...grpc.CallOption) (*GetCfgRsp, error)
	// 设置配置
	SetConfig(ctx context.Context, in *SetCfgReq, opts ...grpc.CallOption) (*SetCfgRsp, 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.

type ConfigServiceServer

type ConfigServiceServer interface {
	// 获取配置
	GetConfig(context.Context, *GetCfgReq) (*GetCfgRsp, error)
	// 设置配置
	SetConfig(context.Context, *SetCfgReq) (*SetCfgRsp, error)
	// contains filtered or unexported methods
}

ConfigServiceServer is the server API for ConfigService service. All implementations must embed UnimplementedConfigServiceServer for forward compatibility

type GetCfgReq

type GetCfgReq struct {

	// 请求的配置文件代码
	Code string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"`
	// contains filtered or unexported fields
}

func (*GetCfgReq) Descriptor deprecated

func (*GetCfgReq) Descriptor() ([]byte, []int)

Deprecated: Use GetCfgReq.ProtoReflect.Descriptor instead.

func (*GetCfgReq) GetCode

func (x *GetCfgReq) GetCode() string

func (*GetCfgReq) ProtoMessage

func (*GetCfgReq) ProtoMessage()

func (*GetCfgReq) ProtoReflect

func (x *GetCfgReq) ProtoReflect() protoreflect.Message

func (*GetCfgReq) Reset

func (x *GetCfgReq) Reset()

func (*GetCfgReq) String

func (x *GetCfgReq) String() string

type GetCfgRsp

type GetCfgRsp struct {
	Code string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"`
	// 请求的配置文件值
	Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*GetCfgRsp) Descriptor deprecated

func (*GetCfgRsp) Descriptor() ([]byte, []int)

Deprecated: Use GetCfgRsp.ProtoReflect.Descriptor instead.

func (*GetCfgRsp) GetCode

func (x *GetCfgRsp) GetCode() string

func (*GetCfgRsp) GetValue

func (x *GetCfgRsp) GetValue() string

func (*GetCfgRsp) ProtoMessage

func (*GetCfgRsp) ProtoMessage()

func (*GetCfgRsp) ProtoReflect

func (x *GetCfgRsp) ProtoReflect() protoreflect.Message

func (*GetCfgRsp) Reset

func (x *GetCfgRsp) Reset()

func (*GetCfgRsp) String

func (x *GetCfgRsp) String() string

type SetCfgReq

type SetCfgReq struct {
	Code  string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*SetCfgReq) Descriptor deprecated

func (*SetCfgReq) Descriptor() ([]byte, []int)

Deprecated: Use SetCfgReq.ProtoReflect.Descriptor instead.

func (*SetCfgReq) GetCode

func (x *SetCfgReq) GetCode() string

func (*SetCfgReq) GetValue

func (x *SetCfgReq) GetValue() string

func (*SetCfgReq) ProtoMessage

func (*SetCfgReq) ProtoMessage()

func (*SetCfgReq) ProtoReflect

func (x *SetCfgReq) ProtoReflect() protoreflect.Message

func (*SetCfgReq) Reset

func (x *SetCfgReq) Reset()

func (*SetCfgReq) String

func (x *SetCfgReq) String() string

type SetCfgRsp

type SetCfgRsp struct {
	// contains filtered or unexported fields
}

func (*SetCfgRsp) Descriptor deprecated

func (*SetCfgRsp) Descriptor() ([]byte, []int)

Deprecated: Use SetCfgRsp.ProtoReflect.Descriptor instead.

func (*SetCfgRsp) ProtoMessage

func (*SetCfgRsp) ProtoMessage()

func (*SetCfgRsp) ProtoReflect

func (x *SetCfgRsp) ProtoReflect() protoreflect.Message

func (*SetCfgRsp) Reset

func (x *SetCfgRsp) Reset()

func (*SetCfgRsp) String

func (x *SetCfgRsp) String() string

type UnimplementedConfigServiceServer

type UnimplementedConfigServiceServer struct {
}

UnimplementedConfigServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedConfigServiceServer) GetConfig

func (UnimplementedConfigServiceServer) SetConfig

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL