lnrpc: add neutrinorpc doc tags to enable lncli api doc generation

This commit is contained in:
Keagan McClelland 2023-11-14 17:18:27 -08:00
parent bba09e320c
commit 305e27d7a1
3 changed files with 42 additions and 12 deletions

View file

@ -4,34 +4,52 @@ package neutrinorpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc";
/*
* Comments in this file will be directly parsed into the API
* Documentation as descriptions of the associated method, message, or field.
* These descriptions should go right above the definition of the object, and
* can be in either block or // comment format.
*
* An RPC method can be matched to an lncli command by placing a line in the
* beginning of the description in exactly the following format:
* lncli: `methodname`
*
* Failure to specify the exact name of the command will cause documentation
* generation to fail.
*
* More information on how exactly the gRPC documentation is generated from
* this proto file can be found here:
* https://github.com/lightninglabs/lightning-api
*/
// NeutrinoKit is a service that can be used to get information about the
// current state of the neutrino instance, fetch blocks and add/remove peers.
service NeutrinoKit {
/*
/* lncli: `neutrino status`
Status returns the status of the light client neutrino instance,
along with height and hash of the best block, and a list of connected
peers.
*/
rpc Status (StatusRequest) returns (StatusResponse);
/*
/* lncli: `neutrino addpeer`
AddPeer adds a new peer that has already been connected to the server.
*/
rpc AddPeer (AddPeerRequest) returns (AddPeerResponse);
/*
/* lncli: `neutrino disconnectpeer`
DisconnectPeer disconnects a peer by target address. Both outbound and
inbound nodes will be searched for the target node. An error message will
be returned if the peer was not found.
*/
rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse);
/*
/* lncli: `neutrino isbanned`
IsBanned returns true if the peer is banned, otherwise false.
*/
rpc IsBanned (IsBannedRequest) returns (IsBannedResponse);
/*
/* lncli: `neutrino getblockheader`
GetBlockHeader returns a block header with a particular block hash.
*/
rpc GetBlockHeader (GetBlockHeaderRequest) returns (GetBlockHeaderResponse);
@ -41,7 +59,7 @@ service NeutrinoKit {
*/
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse);
/*
/* lncli: `neutrino getcfilter`
GetCFilter returns a compact filter from a block.
*/
rpc GetCFilter (GetCFilterRequest) returns (GetCFilterResponse);

View file

@ -18,7 +18,7 @@
"paths": {
"/v2/neutrino/addpeer": {
"post": {
"summary": "AddPeer adds a new peer that has already been connected to the server.",
"summary": "lncli: `neutrino addpeer`\nAddPeer adds a new peer that has already been connected to the server.",
"operationId": "NeutrinoKit_AddPeer",
"responses": {
"200": {
@ -116,7 +116,7 @@
},
"/v2/neutrino/blockheader/{hash}": {
"get": {
"summary": "GetBlockHeader returns a block header with a particular block hash.",
"summary": "lncli: `neutrino getblockheader`\nGetBlockHeader returns a block header with a particular block hash.",
"operationId": "NeutrinoKit_GetBlockHeader",
"responses": {
"200": {
@ -148,7 +148,7 @@
},
"/v2/neutrino/cfilter/{hash}": {
"get": {
"summary": "GetCFilter returns a compact filter from a block.",
"summary": "lncli: `neutrino getcfilter`\nGetCFilter returns a compact filter from a block.",
"operationId": "NeutrinoKit_GetCFilter",
"responses": {
"200": {
@ -180,7 +180,7 @@
},
"/v2/neutrino/disconnect": {
"post": {
"summary": "DisconnectPeer disconnects a peer by target address. Both outbound and\ninbound nodes will be searched for the target node. An error message will\nbe returned if the peer was not found.",
"summary": "lncli: `neutrino disconnectpeer`\nDisconnectPeer disconnects a peer by target address. Both outbound and\ninbound nodes will be searched for the target node. An error message will\nbe returned if the peer was not found.",
"operationId": "NeutrinoKit_DisconnectPeer",
"responses": {
"200": {
@ -213,7 +213,7 @@
},
"/v2/neutrino/isbanned": {
"get": {
"summary": "IsBanned returns true if the peer is banned, otherwise false.",
"summary": "lncli: `neutrino isbanned`\nIsBanned returns true if the peer is banned, otherwise false.",
"operationId": "NeutrinoKit_IsBanned",
"responses": {
"200": {
@ -245,7 +245,7 @@
},
"/v2/neutrino/status": {
"get": {
"summary": "Status returns the status of the light client neutrino instance,\nalong with height and hash of the best block, and a list of connected\npeers.",
"summary": "lncli: `neutrino status`\nStatus returns the status of the light client neutrino instance,\nalong with height and hash of the best block, and a list of connected\npeers.",
"operationId": "NeutrinoKit_Status",
"responses": {
"200": {

View file

@ -18,22 +18,28 @@ const _ = grpc.SupportPackageIsVersion7
//
// 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 NeutrinoKitClient interface {
// lncli: `neutrino status`
// Status returns the status of the light client neutrino instance,
// along with height and hash of the best block, and a list of connected
// peers.
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
// lncli: `neutrino addpeer`
// AddPeer adds a new peer that has already been connected to the server.
AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerResponse, error)
// lncli: `neutrino disconnectpeer`
// DisconnectPeer disconnects a peer by target address. Both outbound and
// inbound nodes will be searched for the target node. An error message will
// be returned if the peer was not found.
DisconnectPeer(ctx context.Context, in *DisconnectPeerRequest, opts ...grpc.CallOption) (*DisconnectPeerResponse, error)
// lncli: `neutrino isbanned`
// IsBanned returns true if the peer is banned, otherwise false.
IsBanned(ctx context.Context, in *IsBannedRequest, opts ...grpc.CallOption) (*IsBannedResponse, error)
// lncli: `neutrino getblockheader`
// GetBlockHeader returns a block header with a particular block hash.
GetBlockHeader(ctx context.Context, in *GetBlockHeaderRequest, opts ...grpc.CallOption) (*GetBlockHeaderResponse, error)
// GetBlock returns a block with a particular block hash.
GetBlock(ctx context.Context, in *GetBlockRequest, opts ...grpc.CallOption) (*GetBlockResponse, error)
// lncli: `neutrino getcfilter`
// GetCFilter returns a compact filter from a block.
GetCFilter(ctx context.Context, in *GetCFilterRequest, opts ...grpc.CallOption) (*GetCFilterResponse, error)
// Deprecated: Do not use.
@ -128,22 +134,28 @@ func (c *neutrinoKitClient) GetBlockHash(ctx context.Context, in *GetBlockHashRe
// All implementations must embed UnimplementedNeutrinoKitServer
// for forward compatibility
type NeutrinoKitServer interface {
// lncli: `neutrino status`
// Status returns the status of the light client neutrino instance,
// along with height and hash of the best block, and a list of connected
// peers.
Status(context.Context, *StatusRequest) (*StatusResponse, error)
// lncli: `neutrino addpeer`
// AddPeer adds a new peer that has already been connected to the server.
AddPeer(context.Context, *AddPeerRequest) (*AddPeerResponse, error)
// lncli: `neutrino disconnectpeer`
// DisconnectPeer disconnects a peer by target address. Both outbound and
// inbound nodes will be searched for the target node. An error message will
// be returned if the peer was not found.
DisconnectPeer(context.Context, *DisconnectPeerRequest) (*DisconnectPeerResponse, error)
// lncli: `neutrino isbanned`
// IsBanned returns true if the peer is banned, otherwise false.
IsBanned(context.Context, *IsBannedRequest) (*IsBannedResponse, error)
// lncli: `neutrino getblockheader`
// GetBlockHeader returns a block header with a particular block hash.
GetBlockHeader(context.Context, *GetBlockHeaderRequest) (*GetBlockHeaderResponse, error)
// GetBlock returns a block with a particular block hash.
GetBlock(context.Context, *GetBlockRequest) (*GetBlockResponse, error)
// lncli: `neutrino getcfilter`
// GetCFilter returns a compact filter from a block.
GetCFilter(context.Context, *GetCFilterRequest) (*GetCFilterResponse, error)
// Deprecated: Do not use.