• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13236757158

10 Feb 2025 08:39AM UTC coverage: 57.649% (-1.2%) from 58.815%
13236757158

Pull #9493

github

ziggie1984
lncli: for some cmds we don't replace the data of the response.

For some cmds it is not very practical to replace the json output
because we might pipe it into other commands. For example when
creating the route we want to pipe it into sendtoRoute.
Pull Request #9493: For some lncli cmds we should not replace the content with other data

0 of 9 new or added lines in 2 files covered. (0.0%)

19535 existing lines in 252 files now uncovered.

103517 of 179563 relevant lines covered (57.65%)

24878.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.45
/lncfg/rpcmiddleware.go
1
package lncfg
2

3
import (
4
        "fmt"
5
        "time"
6
)
7

8
const (
9
        // defaultRPCMiddlewareTimeout is the time after which a request sent to
10
        // a gRPC interception middleware times out. This value is chosen very
11
        // low since in a worst case scenario that time is added to a request's
12
        // full duration twice (request and response interception) if a
13
        // middleware is very slow.
14
        defaultRPCMiddlewareTimeout = 2 * time.Second
15
)
16

17
// RPCMiddleware holds the configuration for RPC interception middleware.
18
//
19
//nolint:ll
20
type RPCMiddleware struct {
21
        Enable           bool          `long:"enable" description:"Enable the RPC middleware interceptor functionality."`
22
        InterceptTimeout time.Duration `long:"intercepttimeout" description:"Time after which a RPC middleware intercept request will time out and return an error if it hasn't yet received a response."`
23
        Mandatory        []string      `long:"addmandatory" description:"Add the named middleware to the list of mandatory middlewares. All RPC requests are blocked/denied if any of the mandatory middlewares is not registered. Can be specified multiple times."`
24
}
25

26
// Validate checks the values configured for the RPC middleware.
UNCOV
27
func (r *RPCMiddleware) Validate() error {
×
UNCOV
28
        if r.InterceptTimeout < 0 {
×
29
                return fmt.Errorf("RPC middleware intercept timeout cannot " +
×
30
                        "be negative")
×
31
        }
×
32

UNCOV
33
        return nil
×
34
}
35

36
// DefaultRPCMiddleware returns the default values for the RPC interception
37
// middleware configuration.
38
func DefaultRPCMiddleware() *RPCMiddleware {
1✔
39
        return &RPCMiddleware{
1✔
40
                InterceptTimeout: defaultRPCMiddlewareTimeout,
1✔
41
        }
1✔
42
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc