ipn/{ipnlocal,localapi}: add API to toggle use of exit node
This is primarily for GUIs, so they don't need to remember the most recently used exit node themselves. This adds some CLI commands, but they're disabled and behind the WIP envknob, as we need to consider naming (on/off is ambiguous with running an exit node, etc) as well as automatic exit node selection in the future. For now the CLI commands are effectively developer debug things to test the LocalAPI. Updates tailscale/corp#18724 Change-Id: I9a32b00e3ffbf5b29bfdcad996a4296b5e37be7e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
3f4c5daa15
commit
a5e1f7d703
@ -41,6 +41,7 @@ func TestPrefsEqual(t *testing.T) {
|
||||
"AllowSingleHosts",
|
||||
"ExitNodeID",
|
||||
"ExitNodeIP",
|
||||
"InternalExitNodePrior",
|
||||
"ExitNodeAllowLANAccess",
|
||||
"CorpDNS",
|
||||
"RunSSH",
|
||||
@ -614,6 +615,19 @@ func TestLoadPrefsFileWithZeroInIt(t *testing.T) {
|
||||
t.Fatalf("unexpected prefs=%#v, err=%v", p, err)
|
||||
}
|
||||
|
||||
func TestMaskedPrefsSetsInternal(t *testing.T) {
|
||||
for _, f := range fieldsOf(reflect.TypeFor[MaskedPrefs]()) {
|
||||
if !strings.HasSuffix(f, "Set") || !strings.HasPrefix(f, "Internal") {
|
||||
continue
|
||||
}
|
||||
mp := new(MaskedPrefs)
|
||||
reflect.ValueOf(mp).Elem().FieldByName(f).SetBool(true)
|
||||
if !mp.SetsInternal() {
|
||||
t.Errorf("MaskedPrefs.%sSet=true but SetsInternal=false", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaskedPrefsFields(t *testing.T) {
|
||||
have := map[string]bool{}
|
||||
for _, f := range fieldsOf(reflect.TypeFor[Prefs]()) {
|
||||
|
Reference in New Issue
Block a user