2021-06-22 22:29:01 +00:00
|
|
|
// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Package controlknobs contains client options configurable from control which can be turned on
|
|
|
|
// or off. The ability to turn options on and off is for incrementally adding features in.
|
|
|
|
package controlknobs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strconv"
|
|
|
|
|
2021-07-16 05:34:50 +00:00
|
|
|
"tailscale.com/syncs"
|
2021-06-22 22:29:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// disableUPnP indicates whether to attempt UPnP mapping.
|
2021-07-16 05:34:50 +00:00
|
|
|
var disableUPnP syncs.AtomicBool
|
2021-06-22 22:29:01 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
v, _ := strconv.ParseBool(os.Getenv("TS_DISABLE_UPNP"))
|
2021-07-16 05:34:50 +00:00
|
|
|
SetDisableUPnP(v)
|
2021-06-22 22:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableUPnP reports the last reported value from control
|
|
|
|
// whether UPnP portmapping should be disabled.
|
2021-07-16 05:34:50 +00:00
|
|
|
func DisableUPnP() bool {
|
|
|
|
return disableUPnP.Get()
|
2021-06-22 22:29:01 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 05:34:50 +00:00
|
|
|
// SetDisableUPnP sets whether control says that UPnP should be
|
|
|
|
// disabled.
|
|
|
|
func SetDisableUPnP(v bool) {
|
|
|
|
disableUPnP.Set(v)
|
2021-06-22 22:29:01 +00:00
|
|
|
}
|