Skip to content

Commit

Permalink
Disable port list
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 26, 2024
1 parent 4a0b9ea commit 485ce62
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions portlist/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 485ce62

Please sign in to comment.