diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-08-10 13:15:25 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-08-10 13:15:34 +0200 |
commit | 8b713ec01c4f9b0e8597eb0987f5e00856825f68 (patch) | |
tree | 1649096922286fe4415fe5d725360e7111bcb392 | |
parent | tunnel: execute *down commands for wgnt (diff) | |
download | wireguard-windows-8b713ec01c4f9b0e8597eb0987f5e00856825f68.tar.xz wireguard-windows-8b713ec01c4f9b0e8597eb0987f5e00856825f68.zip |
embeddable-dll-service: allow falling back to wireguard-go
Requested-by: Dmitry Smirnov <dmitry.smirnov@netprotect.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | embeddable-dll-service/main.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/embeddable-dll-service/main.go b/embeddable-dll-service/main.go index ee2f0ce1..b2e02fa4 100644 --- a/embeddable-dll-service/main.go +++ b/embeddable-dll-service/main.go @@ -20,12 +20,24 @@ import ( "unsafe" ) +func init() { + tunnel.ForceImplementation = 1 + tunnel.UseFixedGUIDInsteadOfDeterministic = true +} + +//export WireGuardForceLegacyImplementation +func WireGuardForceLegacyImplementation(useOldCode bool) { + if useOldCode { + tunnel.ForceImplementation = 2 + } else { + tunnel.ForceImplementation = 1 + } +} + //export WireGuardTunnelService func WireGuardTunnelService(confFile16 *uint16) bool { confFile := windows.UTF16PtrToString(confFile16) conf.PresetRootDirectory(filepath.Dir(confFile)) - tunnel.UseFixedGUIDInsteadOfDeterministic = true - tunnel.ForceImplementation = 1 err := tunnel.Run(confFile) if err != nil { log.Printf("Service run error: %v", err) |