mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 06:57:31 +00:00
portlist: add macOS osImpl, finish migration to new style
Previously: *036f70b7b4
for linux *35bee36549
for windows This does macOS. And removes all the compat code for the old style. (e.g. iOS, js are no longer mentioned; all platforms without implementations just default to not doing anything) One possible regression is that platforms without explicit implementations previously tried to do the "netstat -na" style to get open ports (but not process names). Maybe that worked on FreeBSD and OpenBSD previously, but nobody ever really tested it. And it was kinda useless without associated process names. So better off removing those for now until they get a good implementation. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
da8def8e13
commit
21ef7e5c35
@@ -14,11 +14,13 @@ import (
|
||||
"tailscale.com/net/netstat"
|
||||
)
|
||||
|
||||
// Forking on Windows is insanely expensive, so don't do it too often.
|
||||
const pollInterval = 5 * time.Second
|
||||
|
||||
func init() {
|
||||
newOSImpl = newWindowsImpl
|
||||
// The portlist poller used to fork on Windows, which is insanely expensive,
|
||||
// so historically we only did this every 5 seconds on Windows. Maybe we
|
||||
// could reduce it down to 1 seconds like Linux, but nobody's benchmarked as
|
||||
// of 2022-11-04.
|
||||
pollInterval = 5 * time.Second
|
||||
}
|
||||
|
||||
type famPort struct {
|
||||
@@ -116,11 +118,3 @@ func procNameOfPid(pid int) string {
|
||||
name = strings.TrimSuffix(name, ".EXE")
|
||||
return name
|
||||
}
|
||||
|
||||
func appendListeningPorts([]Port) ([]Port, error) {
|
||||
panic("unused on windows; needed to compile for now")
|
||||
}
|
||||
|
||||
func addProcesses([]Port) ([]Port, error) {
|
||||
panic("unused on windows; needed to compile for now")
|
||||
}
|
||||
|
Reference in New Issue
Block a user