mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
ipn/ipnlocal: exclude tvOS devices from taildrop file targets (#10002)
This commit is contained in:
parent
f66dc8dc0a
commit
387a98fe28
@ -4605,6 +4605,9 @@ func (b *LocalBackend) FileTargets() ([]*apitype.FileTarget, error) {
|
|||||||
if !b.peerIsTaildropTargetLocked(p) {
|
if !b.peerIsTaildropTargetLocked(p) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if p.Hostinfo().OS() == "tvOS" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
peerAPI := peerAPIBase(b.netMap, p)
|
peerAPI := peerAPIBase(b.netMap, p)
|
||||||
if peerAPI == "" {
|
if peerAPI == "" {
|
||||||
continue
|
continue
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
"tailscale.com/types/ptr"
|
"tailscale.com/types/ptr"
|
||||||
"tailscale.com/util/dnsname"
|
"tailscale.com/util/dnsname"
|
||||||
|
"tailscale.com/util/mak"
|
||||||
"tailscale.com/util/set"
|
"tailscale.com/util/set"
|
||||||
"tailscale.com/wgengine"
|
"tailscale.com/wgengine"
|
||||||
"tailscale.com/wgengine/filter"
|
"tailscale.com/wgengine/filter"
|
||||||
@ -468,6 +469,24 @@ func TestFileTargets(t *testing.T) {
|
|||||||
if len(got) != 0 {
|
if len(got) != 0 {
|
||||||
t.Fatalf("unexpected %d peers", len(got))
|
t.Fatalf("unexpected %d peers", len(got))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var peerMap map[tailcfg.NodeID]tailcfg.NodeView
|
||||||
|
mak.NonNil(&peerMap)
|
||||||
|
var nodeID tailcfg.NodeID
|
||||||
|
nodeID = 1234
|
||||||
|
peer := &tailcfg.Node{
|
||||||
|
ID: 1234,
|
||||||
|
Hostinfo: (&tailcfg.Hostinfo{OS: "tvOS"}).View(),
|
||||||
|
}
|
||||||
|
peerMap[nodeID] = peer.View()
|
||||||
|
b.peers = peerMap
|
||||||
|
got, err = b.FileTargets()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(got) != 0 {
|
||||||
|
t.Fatalf("unexpected %d peers", len(got))
|
||||||
|
}
|
||||||
// (other cases handled by TestPeerAPIBase above)
|
// (other cases handled by TestPeerAPIBase above)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user