mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 19:51:41 +00:00
cmd/tailscale/cli: plumb TUN mode into tailscale web template
UI works remains, but data is there now. Updates #4015 Change-Id: Ib91e94718b655ad60a63596e59468f3b3b102306 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
8a1201ac42
commit
61dfbc0a6e
@ -58,6 +58,7 @@ type tmplData struct {
|
|||||||
AdvertiseExitNode bool
|
AdvertiseExitNode bool
|
||||||
AdvertiseRoutes string
|
AdvertiseRoutes string
|
||||||
LicensesURL string
|
LicensesURL string
|
||||||
|
TUNMode bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var webCmd = &ffcli.Command{
|
var webCmd = &ffcli.Command{
|
||||||
@ -338,7 +339,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
st, err := localClient.Status(ctx)
|
st, err := localClient.StatusWithoutPeers(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -408,6 +409,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Status: st.BackendState,
|
Status: st.BackendState,
|
||||||
DeviceName: deviceName,
|
DeviceName: deviceName,
|
||||||
LicensesURL: licensesURL(),
|
LicensesURL: licensesURL(),
|
||||||
|
TUNMode: st.TUN,
|
||||||
}
|
}
|
||||||
exitNodeRouteV4 := netip.MustParsePrefix("0.0.0.0/0")
|
exitNodeRouteV4 := netip.MustParsePrefix("0.0.0.0/0")
|
||||||
exitNodeRouteV6 := netip.MustParsePrefix("::/0")
|
exitNodeRouteV6 := netip.MustParsePrefix("::/0")
|
||||||
|
@ -579,6 +579,7 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func
|
|||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
sb.MutateStatus(func(s *ipnstate.Status) {
|
sb.MutateStatus(func(s *ipnstate.Status) {
|
||||||
s.Version = version.Long
|
s.Version = version.Long
|
||||||
|
s.TUN = !wgengine.IsNetstack(b.e)
|
||||||
s.BackendState = b.state.String()
|
s.BackendState = b.state.String()
|
||||||
s.AuthURL = b.authURLSticky
|
s.AuthURL = b.authURLSticky
|
||||||
if err := health.OverallError(); err != nil {
|
if err := health.OverallError(); err != nil {
|
||||||
|
@ -31,6 +31,10 @@ type Status struct {
|
|||||||
// Version is the daemon's long version (see version.Long).
|
// Version is the daemon's long version (see version.Long).
|
||||||
Version string
|
Version string
|
||||||
|
|
||||||
|
// TUN is whether /dev/net/tun (or equivalent kernel interface) is being
|
||||||
|
// used. If false, it's running in userspace mode.
|
||||||
|
TUN bool
|
||||||
|
|
||||||
// BackendState is an ipn.State string value:
|
// BackendState is an ipn.State string value:
|
||||||
// "NoState", "NeedsLogin", "NeedsMachineAuth", "Stopped",
|
// "NoState", "NeedsLogin", "NeedsMachineAuth", "Stopped",
|
||||||
// "Starting", "Running".
|
// "Starting", "Running".
|
||||||
|
Loading…
x
Reference in New Issue
Block a user