cmd/tailscaled,*: add start of configuration file support

Updates #1412

Co-authored-by: Maisem Ali <maisem@tailscale.com>
Change-Id: I38d559c1784d09fc804f521986c9b4b548718f7d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-10-11 13:55:57 -07:00
committed by Brad Fitzpatrick
parent 71271e41d6
commit 18bd98d35b
16 changed files with 323 additions and 1 deletions

View File

@@ -5,6 +5,8 @@
// preferences.
package preftype
import "fmt"
// NetfilterMode is the firewall management mode to use when
// programming the Linux network stack.
type NetfilterMode int
@@ -17,6 +19,19 @@ const (
NetfilterOn NetfilterMode = 2 // manage tailscale chains and call them from main chains
)
func ParseNetfilterMode(s string) (NetfilterMode, error) {
switch s {
case "off":
return NetfilterOff, nil
case "nodivert":
return NetfilterNoDivert, nil
case "on":
return NetfilterOn, nil
default:
return NetfilterOff, fmt.Errorf("unknown netfilter mode %q", s)
}
}
func (m NetfilterMode) String() string {
switch m {
case NetfilterOff: