From 485ce6252cf345bf4cd339646be4d857159fe5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 22 Nov 2024 22:55:24 +0800 Subject: [PATCH] Disable port list --- portlist/poller.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/portlist/poller.go b/portlist/poller.go index 2ed02fd76ee6c..82ed34a72a559 100644 --- a/portlist/poller.go +++ b/portlist/poller.go @@ -9,18 +9,14 @@ package portlist import ( "errors" "fmt" - "runtime" "slices" "sync" "time" - - "github.com/sagernet/tailscale/envknob" ) var ( - newOSImpl func(includeLocalhost bool) osImpl // if non-nil, constructs a new osImpl. - pollInterval = 5 * time.Second // default; changed by some OS-specific init funcs - debugDisablePortlist = envknob.RegisterBool("TS_DEBUG_DISABLE_PORTLIST") + newOSImpl func(includeLocalhost bool) osImpl // if non-nil, constructs a new osImpl. + pollInterval = 5 * time.Second // default; changed by some OS-specific init funcs ) // PollInterval is the recommended OS-specific interval @@ -76,14 +72,7 @@ func (p *Poller) setPrev(pl List) { // init initializes the Poller by ensuring it has an underlying // OS implementation and is not turned off by envknob. func (p *Poller) init() { - switch { - case debugDisablePortlist(): - p.initErr = errors.New("portlist disabled by envknob") - case newOSImpl == nil: - p.initErr = errors.New("portlist poller not implemented on " + runtime.GOOS) - default: - p.os = newOSImpl(p.IncludeLocalhost) - } + p.initErr = errors.New("portlist disabled by sing-box") } // Close closes the Poller.