ソースを参照

portlist: add debug knob to disable portlist collection

For big servers. Per discussion with @crawshaw.

Updates tailscale/corp#2566

Signed-off-by: Brad Fitzpatrick <[email protected]>
Brad Fitzpatrick 4 年 前
コミット
a05086ef86
1 ファイル変更7 行追加0 行削除
  1. 7 0
      portlist/portlist.go

+ 7 - 0
portlist/portlist.go

@@ -6,7 +6,9 @@ package portlist
 
 import (
 	"fmt"
+	"os"
 	"sort"
+	"strconv"
 	"strings"
 )
 
@@ -72,7 +74,12 @@ func (pl List) String() string {
 	return strings.TrimRight(sb.String(), "\n")
 }
 
+var debugDisablePortlist, _ = strconv.ParseBool(os.Getenv("TS_DEBUG_DISABLE_PORTLIST"))
+
 func GetList(prev List) (List, error) {
+	if debugDisablePortlist {
+		return nil, nil
+	}
 	pl, err := listPorts()
 	if err != nil {
 		return nil, fmt.Errorf("listPorts: %s", err)