mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
portlist: add debug knob to disable portlist collection
For big servers. Per discussion with @crawshaw. Updates tailscale/corp#2566 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
4549d3151c
commit
a05086ef86
@ -6,7 +6,9 @@ package portlist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -72,7 +74,12 @@ func (pl List) String() string {
|
|||||||
return strings.TrimRight(sb.String(), "\n")
|
return strings.TrimRight(sb.String(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var debugDisablePortlist, _ = strconv.ParseBool(os.Getenv("TS_DEBUG_DISABLE_PORTLIST"))
|
||||||
|
|
||||||
func GetList(prev List) (List, error) {
|
func GetList(prev List) (List, error) {
|
||||||
|
if debugDisablePortlist {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
pl, err := listPorts()
|
pl, err := listPorts()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("listPorts: %s", err)
|
return nil, fmt.Errorf("listPorts: %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user