ipn, ipn/policy: filter portlist to a short list of "interesting" ports
Adds new package ipn/policy to be shared between node client & control server. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
c6aa5b639f
commit
8ca796d144
+5
-17
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/tailscale/wireguard-go/wgcfg"
|
||||
"tailscale.com/control/controlclient"
|
||||
"tailscale.com/ipn/ipnstate"
|
||||
"tailscale.com/ipn/policy"
|
||||
"tailscale.com/portlist"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/empty"
|
||||
@@ -377,27 +378,14 @@ func (b *LocalBackend) runPoller() {
|
||||
}
|
||||
sl := []tailcfg.Service{}
|
||||
for _, p := range ports {
|
||||
var proto tailcfg.ServiceProto
|
||||
if p.Proto == "tcp" {
|
||||
proto = tailcfg.TCP
|
||||
} else if p.Proto == "udp" {
|
||||
proto = tailcfg.UDP
|
||||
}
|
||||
if p.Port == 53 || p.Port == 68 ||
|
||||
p.Port == 5353 || p.Port == 5355 {
|
||||
// uninteresting system services
|
||||
continue
|
||||
}
|
||||
if p.Proto == "udp" && strings.EqualFold(p.Process, "tailscaled") {
|
||||
// Skip our own.
|
||||
continue
|
||||
}
|
||||
s := tailcfg.Service{
|
||||
Proto: proto,
|
||||
Proto: tailcfg.ServiceProto(p.Proto),
|
||||
Port: p.Port,
|
||||
Description: p.Process,
|
||||
}
|
||||
sl = append(sl, s)
|
||||
if policy.IsInterestingService(s, version.OS()) {
|
||||
sl = append(sl, s)
|
||||
}
|
||||
}
|
||||
|
||||
b.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user