portlist: fail earlier, more nicely on iOS

pull/269/head
Brad Fitzpatrick 5 years ago
parent 96b2f20c5b
commit ec0cd60fc3

@ -6,7 +6,11 @@ package portlist
import ( import (
"context" "context"
"errors"
"runtime"
"time" "time"
"tailscale.com/version"
) )
// Poller scans the systems for listening ports periodically and sends // Poller scans the systems for listening ports periodically and sends
@ -28,8 +32,11 @@ type Poller struct {
} }
// NewPoller returns a new portlist Poller. It returns an error // NewPoller returns a new portlist Poller. It returns an error
// if the portlist couldn't be obtained. Subsequent // if the portlist couldn't be obtained.
func NewPoller() (*Poller, error) { func NewPoller() (*Poller, error) {
if runtime.GOOS == "darwin" && version.IsMobile() {
return nil, errors.New("not available on iOS")
}
p := &Poller{ p := &Poller{
c: make(chan List), c: make(chan List),
quitCh: make(chan struct{}), quitCh: make(chan struct{}),

Loading…
Cancel
Save