Browse Source

all: fix some js/wasm compilation issues

Change-Id: I05a3a4835e225a1e413ec3540a7c7e4a2d477084
Signed-off-by: Brad Fitzpatrick <[email protected]>
Brad Fitzpatrick 4 years ago
parent
commit
9310713bfb

+ 9 - 0
paths/paths_js.go

@@ -0,0 +1,9 @@
+// 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 paths
+
+func ensureStateDirPerms(dirPath string) error {
+	return nil
+}

+ 2 - 2
paths/paths_unix.go

@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !windows
-// +build !windows
+//go:build !windows && !js
+// +build !windows,!js
 
 package paths
 

+ 17 - 0
portlist/portlist_js.go

@@ -0,0 +1,17 @@
+// 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 portlist
+
+import "time"
+
+const pollInterval = 365 * 24 * time.Hour
+
+func listPorts() (List, error) {
+	return nil, nil
+}
+
+func addProcesses(pl []Port) ([]Port, error) {
+	return pl, nil
+}

+ 2 - 2
portlist/portlist_other.go

@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !linux && !windows && !darwin
-// +build !linux,!windows,!darwin
+//go:build !linux && !windows && !darwin && !js
+// +build !linux,!windows,!darwin,!js
 
 package portlist
 

+ 3 - 0
types/logger/rusage_windows.go → types/logger/rusage_stub.go

@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build windows || js
+// +build windows js
+
 package logger
 
 func rusageMaxRSS() float64 {

+ 2 - 2
types/logger/rusage_nowindows.go → types/logger/rusage_syscall.go

@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !windows
-// +build !windows
+//go:build !windows && !js
+// +build !windows,!js
 
 package logger
 

+ 2 - 2
wgengine/router/router_default.go

@@ -16,8 +16,8 @@ import (
 	"tailscale.com/wgengine/monitor"
 )
 
-func newUserspaceRouter(logf logger.Logf, tunname string, tunDev tun.Device, linkMon *monitor.Mon) Router {
-	panic(fmt.Sprintf("unsupported OS %q", runtime.GOOS))
+func newUserspaceRouter(logf logger.Logf, tunDev tun.Device, linkMon *monitor.Mon) (Router, error) {
+	return nil, fmt.Errorf("unsupported OS %q", runtime.GOOS)
 }
 
 func cleanup(logf logger.Logf, interfaceName string) {