portlist: ignore ports bound to localhost

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-03-17 20:19:39 -07:00
committed by Brad Fitzpatrick
parent c706731dc7
commit f8d67bb591
5 changed files with 63 additions and 33 deletions

View File

@ -31,7 +31,7 @@ func TestParsePort(t *testing.T) {
}
}
var netstat_output = `
const netstatOutput = `
// linux
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
udp 0 0 0.0.0.0:5353 0.0.0.0:*
@ -76,7 +76,7 @@ func TestParsePortsNetstat(t *testing.T) {
Port{"udp", 9353, "iTunes", ""},
}
pl := parsePortsNetstat(netstat_output)
pl := parsePortsNetstat(netstatOutput)
for i := range pl {
if pl[i] != want[i] {
t.Errorf("row#%d\n got: %#v\n\nwant: %#v\n",