diff options
Diffstat (limited to 'embeddable-dll-service/main.go')
-rw-r--r-- | embeddable-dll-service/main.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/embeddable-dll-service/main.go b/embeddable-dll-service/main.go index 27fca4ee..f313ae7f 100644 --- a/embeddable-dll-service/main.go +++ b/embeddable-dll-service/main.go @@ -1,28 +1,27 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package main import ( "C" + "crypto/rand" + "log" + "path/filepath" + "unsafe" "golang.org/x/crypto/curve25519" "golang.org/x/sys/windows" "golang.zx2c4.com/wireguard/windows/conf" "golang.zx2c4.com/wireguard/windows/tunnel" - - "crypto/rand" - "log" - "path/filepath" - "unsafe" ) //export WireGuardTunnelService func WireGuardTunnelService(confFile16 *uint16) bool { - confFile := windows.UTF16ToString((*[(1 << 30) - 1]uint16)(unsafe.Pointer(confFile16))[:]) + confFile := windows.UTF16PtrToString(confFile16) conf.PresetRootDirectory(filepath.Dir(confFile)) tunnel.UseFixedGUIDInsteadOfDeterministic = true err := tunnel.Run(confFile) @@ -33,7 +32,7 @@ func WireGuardTunnelService(confFile16 *uint16) bool { } //export WireGuardGenerateKeypair -func WireGuardGenerateKeypair(publicKey *byte, privateKey *byte) { +func WireGuardGenerateKeypair(publicKey, privateKey *byte) { publicKeyArray := (*[32]byte)(unsafe.Pointer(publicKey)) privateKeyArray := (*[32]byte)(unsafe.Pointer(privateKey)) n, err := rand.Read(privateKeyArray[:]) |