• 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

0.0
/lncfg/pprof.go
1
package lncfg
2

3
import (
4
        "net"
5
        "strconv"
6
)
7

8
// Pprof holds the configuration options for LND's built-in pprof server.
9
//
10
//nolint:ll
11
type Pprof struct {
12
        CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`
13

14
        Profile string `long:"profile" description:"Enable HTTP profiling on either a port or host:port"`
15

16
        BlockingProfile int `long:"blockingprofile" description:"Used to enable a blocking profile to be served on the profiling port. This takes a value from 0 to 1, with 1 including every blocking event, and 0 including no events."`
17

18
        MutexProfile int `long:"mutexprofile" description:"Used to Enable a mutex profile to be served on the profiling port. This takes a value from 0 to 1, with 1 including every mutex event, and 0 including no events."`
19
}
20

21
// Validate checks the values configured for the profiler.
UNCOV
22
func (p *Pprof) Validate() error {
×
UNCOV
23
        if p.BlockingProfile > 0 {
×
24
                log.Warn("Blocking profile enabled only useful for " +
×
25
                        "debugging because of significant performance impact")
×
26
        }
×
27

UNCOV
28
        if p.MutexProfile > 0 {
×
29
                log.Warn("Mutex profile enabled only useful for " +
×
30
                        "debugging because of significant performance impact")
×
31
        }
×
32

UNCOV
33
        if p.CPUProfile != "" {
×
34
                log.Warn("CPU profile enabled only useful for " +
×
35
                        "debugging because of significant performance impact")
×
36
        }
×
37

UNCOV
38
        if p.Profile != "" {
×
39
                str := "%v: The profile port must be between 1024 and 65535"
×
40

×
41
                // Try to parse Profile as a host:port.
×
42
                _, hostPort, err := net.SplitHostPort(p.Profile)
×
43
                if err == nil {
×
44
                        // Determine if the port is valid.
×
45
                        profilePort, err := strconv.Atoi(hostPort)
×
46

×
47
                        if err != nil || profilePort < 1024 ||
×
48
                                profilePort > 65535 {
×
49

×
50
                                return &UsageError{Err: mkErr(str, hostPort)}
×
51
                        }
×
52
                } else {
×
53
                        // Try to parse Profile as a port.
×
54
                        profilePort, err := strconv.Atoi(p.Profile)
×
55
                        if err != nil || profilePort < 1024 ||
×
56
                                profilePort > 65535 {
×
57

×
58
                                return &UsageError{Err: mkErr(str, p.Profile)}
×
59
                        }
×
60

61
                        // Since the user just set a port, we will serve
62
                        // debugging information over localhost.
63
                        p.Profile = net.JoinHostPort("127.0.0.1", p.Profile)
×
64
                }
65
        }
66

UNCOV
67
        return nil
×
68
}
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