Implement STDIOTunnel (#70)

This commit is contained in:
François Guerraz 2023-06-14 02:17:32 +00:00 committed by GitHub
parent edf63253df
commit aa207764b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import (
"log"
"os"
"os/exec"
"syscall"
"github.com/akamensky/argparse"
"github.com/octeep/wireproxy"
@ -116,6 +117,10 @@ func main() {
return
}
// Wireguard doesn't allow configuring which FD to use for logging
// https://github.com/WireGuard/wireguard-go/blob/master/device/logger.go#L39
// so redirect STDOUT to STDERR, we don't want to print anything to STDOUT anyways
os.Stdout = os.NewFile(uintptr(syscall.Stderr), "/dev/stderr")
logLevel := device.LogLevelVerbose
if *silent {
logLevel = device.LogLevelSilent