ipn: introduce app connector advertisement preference and flags
Introduce a preference structure to store the setting for app connector
advertisement.
Introduce the associated flags:
tailscale up --advertise-connector{=true,=false}
tailscale set --advertise-connector{=true,=false}
```
% tailscale set --advertise-connector=false
% tailscale debug prefs | jq .AppConnector.Advertise
false
% tailscale set --advertise-connector=true
% tailscale debug prefs | jq .AppConnector.Advertise
true
% tailscale up --advertise-connector=false
% tailscale debug prefs | jq .AppConnector.Advertise
false
% tailscale up --advertise-connector=true
% tailscale debug prefs | jq .AppConnector.Advertise
true
```
Updates tailscale/corp#15437
Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
committed by
James Tucker
parent
09fcbae900
commit
ca4c940a4d
@@ -58,6 +58,7 @@ func TestPrefsEqual(t *testing.T) {
|
||||
"OperatorUser",
|
||||
"ProfileName",
|
||||
"AutoUpdate",
|
||||
"AppConnector",
|
||||
"PostureChecking",
|
||||
"Persist",
|
||||
}
|
||||
@@ -306,6 +307,16 @@ func TestPrefsEqual(t *testing.T) {
|
||||
&Prefs{AutoUpdate: AutoUpdatePrefs{Check: true, Apply: false}},
|
||||
true,
|
||||
},
|
||||
{
|
||||
&Prefs{AppConnector: AppConnectorPrefs{Advertise: true}},
|
||||
&Prefs{AppConnector: AppConnectorPrefs{Advertise: true}},
|
||||
true,
|
||||
},
|
||||
{
|
||||
&Prefs{AppConnector: AppConnectorPrefs{Advertise: true}},
|
||||
&Prefs{AppConnector: AppConnectorPrefs{Advertise: false}},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&Prefs{PostureChecking: true},
|
||||
&Prefs{PostureChecking: true},
|
||||
@@ -516,6 +527,24 @@ func TestPrefsPretty(t *testing.T) {
|
||||
"linux",
|
||||
`Prefs{ra=false mesh=false dns=false want=false routes=[] nf=off update=on Persist=nil}`,
|
||||
},
|
||||
{
|
||||
Prefs{
|
||||
AppConnector: AppConnectorPrefs{
|
||||
Advertise: true,
|
||||
},
|
||||
},
|
||||
"linux",
|
||||
`Prefs{ra=false mesh=false dns=false want=false routes=[] nf=off update=off appconnector=advertise Persist=nil}`,
|
||||
},
|
||||
{
|
||||
Prefs{
|
||||
AppConnector: AppConnectorPrefs{
|
||||
Advertise: false,
|
||||
},
|
||||
},
|
||||
"linux",
|
||||
`Prefs{ra=false mesh=false dns=false want=false routes=[] nf=off update=off Persist=nil}`,
|
||||
},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
got := tt.p.pretty(tt.os)
|
||||
|
||||
Reference in New Issue
Block a user