Documentation ¶
Overview ¶
Package verrpc is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func DisableLog()
- func RegisterVersionerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterVersionerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VersionerClient) error
- func RegisterVersionerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterVersionerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VersionerServer) error
- func RegisterVersionerJSONCallbacks(...)
- func RegisterVersionerServer(s grpc.ServiceRegistrar, srv VersionerServer)
- func UseLogger(logger btclog.Logger)
- type Server
- type ServerShell
- func (r *ServerShell) CreateSubServer(_ lnrpc.SubServerConfigDispatcher) (lnrpc.SubServer, lnrpc.MacaroonPerms, error)
- func (r *ServerShell) RegisterWithRestServer(ctx context.Context, mux *runtime.ServeMux, dest string, ...) error
- func (r *ServerShell) RegisterWithRootServer(grpcServer *grpc.Server) error
- type UnimplementedVersionerServer
- type UnsafeVersionerServer
- type Version
- func (*Version) Descriptor() ([]byte, []int)deprecated
- func (x *Version) GetAppMajor() uint32
- func (x *Version) GetAppMinor() uint32
- func (x *Version) GetAppPatch() uint32
- func (x *Version) GetAppPreRelease() string
- func (x *Version) GetBuildTags() []string
- func (x *Version) GetCommit() string
- func (x *Version) GetCommitHash() string
- func (x *Version) GetGoVersion() string
- func (x *Version) GetVersion() string
- func (*Version) ProtoMessage()
- func (x *Version) ProtoReflect() protoreflect.Message
- func (x *Version) Reset()
- func (x *Version) String() string
- type VersionRequest
- type VersionerClient
- type VersionerServer
Constants ¶
const Subsystem = "VRPC"
Subsystem defines the logging code for this subsystem.
Variables ¶
var File_verrpc_verrpc_proto protoreflect.FileDescriptor
var Versioner_ServiceDesc = grpc.ServiceDesc{ ServiceName: "verrpc.Versioner", HandlerType: (*VersionerServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetVersion", Handler: _Versioner_GetVersion_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "verrpc/verrpc.proto", }
Versioner_ServiceDesc is the grpc.ServiceDesc for Versioner service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func RegisterVersionerHandler ¶
func RegisterVersionerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterVersionerHandler registers the http handlers for service Versioner to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterVersionerHandlerClient ¶
func RegisterVersionerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VersionerClient) error
RegisterVersionerHandlerClient registers the http handlers for service Versioner to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VersionerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VersionerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "VersionerClient" to call the correct interceptors.
func RegisterVersionerHandlerFromEndpoint ¶
func RegisterVersionerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterVersionerHandlerFromEndpoint is same as RegisterVersionerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterVersionerHandlerServer ¶
func RegisterVersionerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VersionerServer) error
RegisterVersionerHandlerServer registers the http handlers for service Versioner to "mux". UnaryRPC :call VersionerServer 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 RegisterVersionerHandlerFromEndpoint instead.
func RegisterVersionerServer ¶
func RegisterVersionerServer(s grpc.ServiceRegistrar, srv VersionerServer)
Types ¶
type Server ¶
type Server struct { // Required by the grpc-gateway/v2 library for forward compatibility. UnimplementedVersionerServer }
Server is an rpc server that supports querying for information about the running binary.
func (*Server) GetVersion ¶
GetVersion returns information about the compiled binary.
func (*Server) Name ¶
Name returns a unique string representation of the sub-server. This can be used to identify the sub-server and also de-duplicate them.
NOTE: This is part of the lnrpc.SubServer interface.
type ServerShell ¶
type ServerShell struct {
VersionerServer
}
ServerShell is a shell struct holding a reference to the actual sub-server. It is used to register the gRPC sub-server with the root server before we have the necessary dependencies to populate the actual sub-server.
func (*ServerShell) CreateSubServer ¶
func (r *ServerShell) CreateSubServer(_ lnrpc.SubServerConfigDispatcher) ( lnrpc.SubServer, lnrpc.MacaroonPerms, error)
CreateSubServer populates the subserver's dependencies using the passed SubServerConfigDispatcher. This method should fully initialize the sub-server instance, making it ready for action. It returns the macaroon permissions that the sub-server wishes to pass on to the root server for all methods routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
func (*ServerShell) RegisterWithRestServer ¶
func (r *ServerShell) RegisterWithRestServer(ctx context.Context, mux *runtime.ServeMux, dest string, opts []grpc.DialOption) error
RegisterWithRestServer will be called by the root REST mux to direct a sub RPC server to register itself with the main REST mux server. Until this is called, each sub-server won't be able to have requests routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
func (*ServerShell) RegisterWithRootServer ¶
func (r *ServerShell) RegisterWithRootServer(grpcServer *grpc.Server) error
RegisterWithRootServer will be called by the root gRPC server to direct a sub RPC server to register itself with the main gRPC root server. Until this is called, each sub-server won't be able to have requests routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
type UnimplementedVersionerServer ¶
type UnimplementedVersionerServer struct { }
UnimplementedVersionerServer must be embedded to have forward compatible implementations.
func (UnimplementedVersionerServer) GetVersion ¶
func (UnimplementedVersionerServer) GetVersion(context.Context, *VersionRequest) (*Version, error)
type UnsafeVersionerServer ¶
type UnsafeVersionerServer interface {
// contains filtered or unexported methods
}
UnsafeVersionerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to VersionerServer will result in compilation errors.
type Version ¶
type Version struct { // A verbose description of the daemon's commit. Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` // The SHA1 commit hash that the daemon is compiled with. CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` // The semantic version. Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` // The major application version. AppMajor uint32 `protobuf:"varint,4,opt,name=app_major,json=appMajor,proto3" json:"app_major,omitempty"` // The minor application version. AppMinor uint32 `protobuf:"varint,5,opt,name=app_minor,json=appMinor,proto3" json:"app_minor,omitempty"` // The application patch number. AppPatch uint32 `protobuf:"varint,6,opt,name=app_patch,json=appPatch,proto3" json:"app_patch,omitempty"` // The application pre-release modifier, possibly empty. AppPreRelease string `protobuf:"bytes,7,opt,name=app_pre_release,json=appPreRelease,proto3" json:"app_pre_release,omitempty"` // The list of build tags that were supplied during compilation. BuildTags []string `protobuf:"bytes,8,rep,name=build_tags,json=buildTags,proto3" json:"build_tags,omitempty"` // The version of go that compiled the executable. GoVersion string `protobuf:"bytes,9,opt,name=go_version,json=goVersion,proto3" json:"go_version,omitempty"` // contains filtered or unexported fields }
func (*Version) Descriptor
deprecated
func (*Version) GetAppMajor ¶
func (*Version) GetAppMinor ¶
func (*Version) GetAppPatch ¶
func (*Version) GetAppPreRelease ¶
func (*Version) GetBuildTags ¶
func (*Version) GetCommitHash ¶
func (*Version) GetGoVersion ¶
func (*Version) GetVersion ¶
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) ProtoReflect ¶
func (x *Version) ProtoReflect() protoreflect.Message
type VersionRequest ¶
type VersionRequest struct {
// contains filtered or unexported fields
}
func (*VersionRequest) Descriptor
deprecated
func (*VersionRequest) Descriptor() ([]byte, []int)
Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead.
func (*VersionRequest) ProtoMessage ¶
func (*VersionRequest) ProtoMessage()
func (*VersionRequest) ProtoReflect ¶
func (x *VersionRequest) ProtoReflect() protoreflect.Message
func (*VersionRequest) Reset ¶
func (x *VersionRequest) Reset()
func (*VersionRequest) String ¶
func (x *VersionRequest) String() string
type VersionerClient ¶
type VersionerClient interface { // lncli: `version` // GetVersion returns the current version and build information of the running // daemon. GetVersion(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*Version, error) }
VersionerClient is the client API for Versioner 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 NewVersionerClient ¶
func NewVersionerClient(cc grpc.ClientConnInterface) VersionerClient
type VersionerServer ¶
type VersionerServer interface { // lncli: `version` // GetVersion returns the current version and build information of the running // daemon. GetVersion(context.Context, *VersionRequest) (*Version, error) // contains filtered or unexported methods }
VersionerServer is the server API for Versioner service. All implementations must embed UnimplementedVersionerServer for forward compatibility