From e0747b535446405147a6f86f8294837e4401a924 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Sun, 19 Mar 2023 17:41:04 +0200 Subject: [PATCH] litrpc+rpcserver: add firewall service comments and cli directives --- litrpc/firewall.proto | 17 +++++++++++++++++ litrpc/firewall_grpc.pb.go | 28 ++++++++++++++++++++++++++++ session_rpcserver.go | 13 ++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/litrpc/firewall.proto b/litrpc/firewall.proto index 8c5b18e8..6631755a 100644 --- a/litrpc/firewall.proto +++ b/litrpc/firewall.proto @@ -5,7 +5,24 @@ package litrpc; option go_package = "github.com/lightninglabs/lightning-terminal/litrpc"; service Firewall { + /* litcli: `actions` + ListActions will return a list of actions that have been performed on the + node. The actions that will be persisted depends on the value of the + `--firewall.request-logger.level` config option. The default value of the + option is the "interceptor" mode which will persist only the actions (with + all request parameters) made with macaroons with caveats that force them + to be checked by an rpc middleware interceptor. If the "all" mode is used + then all actions will be persisted but only full request parameters will + only be stored if the actions are interceptor actions, otherwise only the + URI and timestamp of the actions will be stored. The "full" mode will + persist all request data for all actions. + */ rpc ListActions (ListActionsRequest) returns (ListActionsResponse); + + /* litcli: `privacy` + PrivacyMapConversion can be used map real values to their pseudo + counterpart and vice versa. + */ rpc PrivacyMapConversion (PrivacyMapConversionRequest) returns (PrivacyMapConversionResponse); } diff --git a/litrpc/firewall_grpc.pb.go b/litrpc/firewall_grpc.pb.go index 78c05e5b..cb3498e8 100644 --- a/litrpc/firewall_grpc.pb.go +++ b/litrpc/firewall_grpc.pb.go @@ -18,7 +18,21 @@ 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 FirewallClient interface { + // litcli: `actions` + // ListActions will return a list of actions that have been performed on the + // node. The actions that will be persisted depends on the value of the + // `--firewall.request-logger.level` config option. The default value of the + // option is the "interceptor" mode which will persist only the actions (with + // all request parameters) made with macaroons with caveats that force them + // to be checked by an rpc middleware interceptor. If the "all" mode is used + // then all actions will be persisted but only full request parameters will + // only be stored if the actions are interceptor actions, otherwise only the + // URI and timestamp of the actions will be stored. The "full" mode will + // persist all request data for all actions. ListActions(ctx context.Context, in *ListActionsRequest, opts ...grpc.CallOption) (*ListActionsResponse, error) + // litcli: `privacy` + // PrivacyMapConversion can be used map real values to their pseudo + // counterpart and vice versa. PrivacyMapConversion(ctx context.Context, in *PrivacyMapConversionRequest, opts ...grpc.CallOption) (*PrivacyMapConversionResponse, error) } @@ -52,7 +66,21 @@ func (c *firewallClient) PrivacyMapConversion(ctx context.Context, in *PrivacyMa // All implementations must embed UnimplementedFirewallServer // for forward compatibility type FirewallServer interface { + // litcli: `actions` + // ListActions will return a list of actions that have been performed on the + // node. The actions that will be persisted depends on the value of the + // `--firewall.request-logger.level` config option. The default value of the + // option is the "interceptor" mode which will persist only the actions (with + // all request parameters) made with macaroons with caveats that force them + // to be checked by an rpc middleware interceptor. If the "all" mode is used + // then all actions will be persisted but only full request parameters will + // only be stored if the actions are interceptor actions, otherwise only the + // URI and timestamp of the actions will be stored. The "full" mode will + // persist all request data for all actions. ListActions(context.Context, *ListActionsRequest) (*ListActionsResponse, error) + // litcli: `privacy` + // PrivacyMapConversion can be used map real values to their pseudo + // counterpart and vice versa. PrivacyMapConversion(context.Context, *PrivacyMapConversionRequest) (*PrivacyMapConversionResponse, error) mustEmbedUnimplementedFirewallServer() } diff --git a/session_rpcserver.go b/session_rpcserver.go index 740cbddf..29e0ef54 100644 --- a/session_rpcserver.go +++ b/session_rpcserver.go @@ -581,6 +581,8 @@ func (s *sessionRpcServer) RevokeSession(ctx context.Context, return &litrpc.RevokeSessionResponse{}, nil } +// PrivacyMapConversion can be used map real values to their pseudo counterpart +// and vice versa. func (s *sessionRpcServer) PrivacyMapConversion(_ context.Context, req *litrpc.PrivacyMapConversionRequest) ( *litrpc.PrivacyMapConversionResponse, error) { @@ -611,7 +613,16 @@ func (s *sessionRpcServer) PrivacyMapConversion(_ context.Context, }, nil } -// ListActions lists all actions attempted on the Litd server. +// ListActions will return a list of actions that have been performed on the +// node. The actions that will be persisted depends on the value of the +// `--firewall.request-logger.level` config option. The default value of the +// option is the "interceptor" mode which will persist only the actions (with +// all request parameters) made with macaroons with caveats that force them to +// be checked by an rpc middleware interceptor. If the "all" mode is used then +// all actions will be persisted but only full request parameters will only be +// stored if the actions are interceptor actions, otherwise only the URI and +// timestamp of the actions will be stored. The "full" mode will persist all +// request data for all actions. func (s *sessionRpcServer) ListActions(_ context.Context, req *litrpc.ListActionsRequest) (*litrpc.ListActionsResponse, error) {