2020-02-05 22:16:58 +00:00
|
|
|
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package portlist
|
|
|
|
|
2020-03-14 03:53:58 +00:00
|
|
|
import "time"
|
|
|
|
|
2020-02-05 22:16:58 +00:00
|
|
|
// Forking on Windows is insanely expensive, so don't do it too often.
|
2020-03-14 03:53:58 +00:00
|
|
|
const pollInterval = 5 * time.Second
|
2020-02-05 22:16:58 +00:00
|
|
|
|
|
|
|
func listPorts() (List, error) {
|
|
|
|
return listPortsNetstat("-na")
|
|
|
|
}
|
|
|
|
|
|
|
|
func addProcesses(pl []Port) ([]Port, error) {
|
|
|
|
return listPortsNetstat("-nab")
|
|
|
|
}
|