mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
ipn/ipnlocal,tailcfg: add AppConnector service to HostInfo when configured
Updates tailscale/corp#15437 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:

committed by
James Tucker

parent
6ad54fed00
commit
228a82f178
@@ -3166,6 +3166,12 @@ func (b *LocalBackend) peerAPIServicesLocked() (ret []tailcfg.Service) {
|
||||
Port: 1, // version
|
||||
})
|
||||
}
|
||||
if b.appConnector != nil {
|
||||
ret = append(ret, tailcfg.Service{
|
||||
Proto: tailcfg.AppConnector,
|
||||
Port: 1, // version
|
||||
})
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@@ -1157,6 +1157,28 @@ func TestOfferingAppConnector(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppConnectorHostinfoService(t *testing.T) {
|
||||
hasAppConnectorService := func(s []tailcfg.Service) bool {
|
||||
for _, s := range s {
|
||||
if s.Proto == tailcfg.AppConnector && s.Port == 1 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
b := newTestBackend(t)
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if hasAppConnectorService(b.peerAPIServicesLocked()) {
|
||||
t.Fatal("unexpected app connector service")
|
||||
}
|
||||
b.appConnector = appc.NewEmbeddedAppConnector(t.Logf, nil)
|
||||
if !hasAppConnectorService(b.peerAPIServicesLocked()) {
|
||||
t.Fatal("expected app connector service")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRouteAdvertiser(t *testing.T) {
|
||||
b := newTestBackend(t)
|
||||
testPrefix := netip.MustParsePrefix("192.0.0.8/32")
|
||||
|
@@ -1003,7 +1003,7 @@ func dnsQueryForName(name, typStr string) []byte {
|
||||
b := dnsmessage.NewBuilder(nil, dnsmessage.Header{
|
||||
OpCode: 0, // query
|
||||
RecursionDesired: true,
|
||||
ID: 0,
|
||||
ID: 1, // arbitrary, but 0 is rejected by some servers
|
||||
})
|
||||
if !strings.HasSuffix(name, ".") {
|
||||
name += "."
|
||||
|
Reference in New Issue
Block a user