ipn/ipnlocal: delete profile on logout

Updates #713

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-11-12 17:39:29 +05:00
committed by Maisem Ali
parent 0544d6ed04
commit 26d1fc867e
4 changed files with 50 additions and 29 deletions
+5
View File
@@ -268,6 +268,11 @@ var errProfileNotFound = errors.New("profile not found")
// useful for deleting the last profile. In other cases, it is
// recommended to call SwitchProfile() first.
func (pm *profileManager) DeleteProfile(id ipn.ProfileID) error {
if id == "" && pm.isNewProfile {
// Deleting the in-memory only new profile, just create a new one.
pm.NewProfile()
return nil
}
kp, ok := pm.knownProfiles[id]
if !ok {
return errProfileNotFound