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

committed by
James Tucker

parent
1f4a38ed49
commit
0b6636295e
@@ -1544,6 +1544,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
||||
hostinfo.FrontendLogID = opts.FrontendLogID
|
||||
hostinfo.Userspace.Set(b.sys.IsNetstack())
|
||||
hostinfo.UserspaceRouter.Set(b.sys.IsNetstackRouter())
|
||||
hostinfo.AppConnector.Set(b.appConnector != nil)
|
||||
b.logf.JSON(1, "Hostinfo", hostinfo)
|
||||
|
||||
// TODO(apenwarr): avoid the need to reinit controlclient.
|
||||
@@ -3270,6 +3271,11 @@ func (b *LocalBackend) blockEngineUpdates(block bool) {
|
||||
// b.mu must be held.
|
||||
func (b *LocalBackend) reconfigAppConnectorLocked(nm *netmap.NetworkMap, prefs ipn.PrefsView) {
|
||||
const appConnectorCapName = "tailscale.com/app-connectors"
|
||||
defer func() {
|
||||
if b.hostinfo != nil {
|
||||
b.hostinfo.AppConnector.Set(b.appConnector != nil)
|
||||
}
|
||||
}()
|
||||
|
||||
if !prefs.AppConnector().Advertise {
|
||||
var old *appc.AppConnector
|
||||
|
@@ -1263,6 +1263,9 @@ func TestReconfigureAppConnector(t *testing.T) {
|
||||
if !foundAppConnectorService {
|
||||
t.Fatalf("expected app connector service")
|
||||
}
|
||||
if v, _ := b.hostinfo.AppConnector.Get(); !v {
|
||||
t.Fatalf("expected app connector service")
|
||||
}
|
||||
|
||||
// disable the connector in order to assert that the service is removed
|
||||
b.EditPrefs(&ipn.MaskedPrefs{
|
||||
@@ -1288,6 +1291,9 @@ func TestReconfigureAppConnector(t *testing.T) {
|
||||
if foundAppConnectorService {
|
||||
t.Fatalf("expected no app connector service")
|
||||
}
|
||||
if v, _ := b.hostinfo.AppConnector.Get(); v {
|
||||
t.Fatalf("expected no app connector service")
|
||||
}
|
||||
}
|
||||
|
||||
func hasAppConnectorService(b *LocalBackend) bool {
|
||||
|
Reference in New Issue
Block a user