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"; 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 // 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. // current state of the neutrino instance, fetch blocks and add/remove peers.
service NeutrinoKit { service NeutrinoKit {
/* /* lncli: `neutrino status`
Status returns the status of the light client neutrino instance, Status returns the status of the light client neutrino instance,
along with height and hash of the best block, and a list of connected along with height and hash of the best block, and a list of connected
peers. peers.
*/ */
rpc Status (StatusRequest) returns (StatusResponse); rpc Status (StatusRequest) returns (StatusResponse);
/* /* lncli: `neutrino addpeer`
AddPeer adds a new peer that has already been connected to the server. AddPeer adds a new peer that has already been connected to the server.
*/ */
rpc AddPeer (AddPeerRequest) returns (AddPeerResponse); rpc AddPeer (AddPeerRequest) returns (AddPeerResponse);
/* /* lncli: `neutrino disconnectpeer`
DisconnectPeer disconnects a peer by target address. Both outbound and DisconnectPeer disconnects a peer by target address. Both outbound and
inbound nodes will be searched for the target node. An error message will inbound nodes will be searched for the target node. An error message will
be returned if the peer was not found. be returned if the peer was not found.
*/ */
rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse); rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse);
/* /* lncli: `neutrino isbanned`
IsBanned returns true if the peer is banned, otherwise false. IsBanned returns true if the peer is banned, otherwise false.
*/ */
rpc IsBanned (IsBannedRequest) returns (IsBannedResponse); rpc IsBanned (IsBannedRequest) returns (IsBannedResponse);
/* /* lncli: `neutrino getblockheader`
GetBlockHeader returns a block header with a particular block hash. GetBlockHeader returns a block header with a particular block hash.
*/ */
rpc GetBlockHeader (GetBlockHeaderRequest) returns (GetBlockHeaderResponse); rpc GetBlockHeader (GetBlockHeaderRequest) returns (GetBlockHeaderResponse);
@ -41,7 +59,7 @@ service NeutrinoKit {
*/ */
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse); rpc GetBlock (GetBlockRequest) returns (GetBlockResponse);
/* /* lncli: `neutrino getcfilter`
GetCFilter returns a compact filter from a block. GetCFilter returns a compact filter from a block.
*/ */
rpc GetCFilter (GetCFilterRequest) returns (GetCFilterResponse); rpc GetCFilter (GetCFilterRequest) returns (GetCFilterResponse);

View File

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