macos build, linux tun hack
This commit is contained in:
1 parent
9639defdd4
commit
76ab72db2e
18 files changed
+719
-64
No files matched your search
@@ -1,5 +1,7 @@
|
||||
desktop-joiner-windows-*.exe
|
||||
desktop-joiner-linux-*
|
||||
desktop-joiner-darwin
|
||||
desktop-joiner-darwin-*
|
||||
desktop-joiner-bundle
|
||||
desktop-joiner-bundle.exe
|
||||
wintun-*.dll
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
"whitelist-bypass/relay/pion"
|
||||
"whitelist-bypass/relay/tunnel"
|
||||
"whitelist-bypass/relay/wbstream"
|
||||
"whitelist-bypass/relay/wintunnel"
|
||||
"whitelist-bypass/relay/desktoptun"
|
||||
)
|
||||
|
||||
type statusEmitter struct{}
|
||||
@@ -108,12 +108,12 @@ func main() {
|
||||
}
|
||||
common.MaskingEnabled = true
|
||||
|
||||
// One wintunnel.Tunnel covers both platforms. Created up-front so
|
||||
// One desktoptun.Tunnel covers both platforms. Created up-front so
|
||||
// signaling-host bypass routes can be installed before any platform
|
||||
// code touches the network.
|
||||
var tun *wintunnel.Tunnel
|
||||
var tun *desktoptun.Tunnel
|
||||
if !*noTun {
|
||||
cfg := wintunnel.Config{
|
||||
cfg := desktoptun.Config{
|
||||
AdapterName: tunAdapter,
|
||||
TunnelIP: tunIP,
|
||||
TunnelMask: tunMask,
|
||||
@@ -127,9 +127,9 @@ func main() {
|
||||
LogFn: log.Printf,
|
||||
}
|
||||
var err error
|
||||
tun, err = wintunnel.New(cfg)
|
||||
tun, err = desktoptun.New(cfg)
|
||||
if err != nil {
|
||||
log.Fatalf("[wintunnel] init: %v", err)
|
||||
log.Fatalf("[desktoptun] init: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ func main() {
|
||||
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
|
||||
watchStdinQuit(sig)
|
||||
|
||||
tunReady := make(chan struct{})
|
||||
var tunOnce sync.Once
|
||||
@@ -161,7 +162,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
if err := tun.Start(); err != nil {
|
||||
log.Fatalf("[wintunnel] start: %v", err)
|
||||
log.Fatalf("[desktoptun] start: %v", err)
|
||||
}
|
||||
// Now that the tunnel knows the original gateway,
|
||||
// pin /32 bypass routes for the signaling hosts.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//go:build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func watchStdinQuit(sig chan<- os.Signal) {
|
||||
go func() {
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
if strings.TrimSpace(scanner.Text()) == "QUIT" {
|
||||
sig <- syscall.SIGTERM
|
||||
return
|
||||
}
|
||||
}
|
||||
sig <- syscall.SIGTERM
|
||||
}()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !linux
|
||||
|
||||
package main
|
||||
|
||||
import "os"
|
||||
|
||||
func watchStdinQuit(_ chan<- os.Signal) {}
|
||||
Reference in new issue
Block a user