mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 10:11:18 +01:00 
			
		
		
		
	Whenever running on a platform that has a TPM (and tailscaled can access it), default to encrypting the state. The user can still explicitly set this flag to disable encryption. Updates https://github.com/tailscale/corp/issues/32909 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
		
			
				
	
	
		
			32 lines
		
	
	
		
			540 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			540 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright (c) Tailscale Inc & AUTHORS
 | 
						|
// SPDX-License-Identifier: BSD-3-Clause
 | 
						|
 | 
						|
package main
 | 
						|
 | 
						|
import "strconv"
 | 
						|
 | 
						|
// boolFlag is a flag.Value that tracks whether it was ever set.
 | 
						|
type boolFlag struct {
 | 
						|
	set bool
 | 
						|
	v   bool
 | 
						|
}
 | 
						|
 | 
						|
func (b *boolFlag) String() string {
 | 
						|
	if b == nil || !b.set {
 | 
						|
		return "unset"
 | 
						|
	}
 | 
						|
	return strconv.FormatBool(b.v)
 | 
						|
}
 | 
						|
 | 
						|
func (b *boolFlag) Set(s string) error {
 | 
						|
	v, err := strconv.ParseBool(s)
 | 
						|
	if err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
	b.v = v
 | 
						|
	b.set = true
 | 
						|
	return nil
 | 
						|
}
 | 
						|
 | 
						|
func (b *boolFlag) IsBoolFlag() bool { return true }
 |