diff --git a/COPYING b/COPYING index eaf986caf..916eef782 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. +Copyright (C) 2018-2022 WireGuard LLC. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/Makefile b/Makefile index f5c1ede42..2724e319c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GOFLAGS := -tags load_wgnt_from_rsrc -ldflags="-H windowsgui -s -w" -v -trimpath +GOFLAGS := -tags load_wgnt_from_rsrc -ldflags="-H windowsgui -s -w" -trimpath -buildinfo=false -buildvcs=false -v export GOOS := windows export PATH := $(CURDIR)/.deps/go/bin:$(PATH) @@ -25,15 +25,14 @@ define download = if ! mv $$@.unverified $$@; then rm -f $$@.unverified; exit 1; fi endef -$(eval $(call download,go.tar.gz,https://go.dev/dl/go1.17.4.linux-amd64.tar.gz,adab2483f644e2f8a10ae93122f0018cef525ca48d0b8764dae87cb5f4fd4206)) +$(eval $(call download,go.tar.gz,https://go.dev/dl/go1.18beta1.linux-amd64.tar.gz,128f72c5c22640085e4187cd1b540c587cf8fb280f941519bd2d1ae9fdab4f37)) $(eval $(call download,wireguard-nt.zip,https://download.wireguard.com/wireguard-nt/wireguard-nt-0.10.1.zip,772c0b1463d8d2212716f43f06f4594d880dea4f735165bd68e388fc41b81605)) -.deps/go/prepared: .distfiles/go.tar.gz $(wildcard go-patches/*.patch) +.deps/go/prepared: .distfiles/go.tar.gz mkdir -p .deps rm -rf .deps/go bsdtar -C .deps -xf .distfiles/go.tar.gz chmod -R +w .deps/go - cat $(filter %.patch,$^) | patch -f -N -r- -p1 -d .deps/go touch $@ .deps/wireguard-nt/prepared: .distfiles/wireguard-nt.zip @@ -72,7 +71,7 @@ remaster: .deps/go/prepared rm -f go.sum go.mod cp go.mod.master go.mod go get -d - sed -i $(shell curl -L https://go.dev/dl/?mode=json | jq -r '(".windows-amd64.zip",".linux-amd64.tar.gz") as $$suffix | .[0].files[] | select(.filename|endswith($$suffix)) | ("-e", "s/go[0-9][^ ]*\\\($$suffix)\\([ ,]\\)[a-f0-9]\\+/\(.filename)\\1\(.sha256)/") | @sh') Makefile build.bat + sed -i $(shell curl -L 'https://go.dev/dl/?mode=json&include=all' | jq -r '(".windows-amd64.zip",".linux-amd64.tar.gz") as $$suffix | .[-1].files[] | select(.filename|endswith($$suffix)) | ("-e", "s/go[0-9][^ ]*\\\($$suffix)\\([ ,]\\)[a-f0-9]\\+/\(.filename)\\1\(.sha256)/") | @sh') Makefile build.bat fmt: export GOARCH := amd64 fmt: .deps/go/prepared diff --git a/README.md b/README.md index 334ff9f86..4ae2f2675 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ In addition to this [`README.md`](README.md), the following documents are also a This repository is MIT-licensed. ```text -Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. +Copyright (C) 2018-2022 WireGuard LLC. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/build.bat b/build.bat index ed568b5c0..631bcd0f2 100644 --- a/build.bat +++ b/build.bat @@ -1,6 +1,6 @@ @echo off rem SPDX-License-Identifier: MIT -rem Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. +rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. setlocal enabledelayedexpansion set BUILDDIR=%~dp0 @@ -13,7 +13,7 @@ if exist .deps\prepared goto :render rmdir /s /q .deps 2> NUL mkdir .deps || goto :error cd .deps || goto :error - call :download go.zip https://go.dev/dl/go1.17.4.windows-amd64.zip 903cffeb7c6ab7490b9101086a2b978076bd9356e56369404b9c45dff866da77 || goto :error + call :download go.zip https://go.dev/dl/go1.18beta1.windows-amd64.zip 3a43ab4ec28eee6b10fd412a055724d962227f1c27a78960d6d229d741f8353d || goto :error rem Mirror of https://github.com/mstorsjo/llvm-mingw/releases/download/20201020/llvm-mingw-20201020-msvcrt-x86_64.zip call :download llvm-mingw-msvcrt.zip https://download.wireguard.com/windows-toolchain/distfiles/llvm-mingw-20201020-msvcrt-x86_64.zip 2e46593245090df96d15e360e092f0b62b97e93866e0162dca7f93b16722b844 || goto :error rem Mirror of https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip @@ -21,11 +21,7 @@ if exist .deps\prepared goto :render rem Mirror of https://sourceforge.net/projects/ezwinports/files/make-4.2.1-without-guile-w32-bin.zip call :download make.zip https://download.wireguard.com/windows-toolchain/distfiles/make-4.2.1-without-guile-w32-bin.zip 30641be9602712be76212b99df7209f4f8f518ba764cf564262bc9d6e4047cc7 "--strip-components 1 bin" || goto :error call :download wireguard-tools.zip https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-1ee37b8e4833a25efe6f1fc0d5bdcb476148f4ba.zip ed0739bc3e5a7021a59d4cc4fc63e5fb60a0cb8628d30515a747bfbdcf1fdb0a "--exclude wg-quick --strip-components 1" || goto :error - rem Mirror of https://sourceforge.net/projects/gnuwin32/files/patch/2.5.9-7/patch-2.5.9-7-bin.zip with fixed manifest - call :download patch.zip https://download.wireguard.com/windows-toolchain/distfiles/patch-2.5.9-7-bin-fixed-manifest.zip 25977006ca9713f2662a5d0a2ed3a5a138225b8be3757035bd7da9dcf985d0a1 "--strip-components 1 bin" || goto :error call :download wireguard-nt.zip https://download.wireguard.com/wireguard-nt/wireguard-nt-0.10.1.zip 772c0b1463d8d2212716f43f06f4594d880dea4f735165bd68e388fc41b81605 || goto :error - echo [+] Patching go - for %%a in ("..\go-patches\*.patch") do .\patch.exe -f -N -r- -d go -p1 --binary < "%%a" || goto :error copy /y NUL prepared > NUL || goto :error cd .. || goto :error @@ -77,7 +73,7 @@ if exist .deps\prepared goto :render echo [+] Assembling resources %1 %~2-w64-mingw32-windres -I ".deps\wireguard-nt\bin\%~1" -DWIREGUARD_VERSION_ARRAY=%WIREGUARD_VERSION_ARRAY% -DWIREGUARD_VERSION_STR=%WIREGUARD_VERSION% -i resources.rc -o "resources_%~3.syso" -O coff -c 65001 || exit /b %errorlevel% echo [+] Building program %1 - go build -tags load_wgnt_from_rsrc -ldflags="-H windowsgui -s -w" -trimpath -v -o "%~1\wireguard.exe" || exit /b 1 + go build -tags load_wgnt_from_rsrc -ldflags="-H windowsgui -s -w" -trimpath -buildinfo=false -buildvcs=false -v -o "%~1\wireguard.exe" || exit /b 1 if not exist "%~1\wg.exe" ( echo [+] Building command line tools %1 del .deps\src\*.exe .deps\src\*.o .deps\src\wincompat\*.o .deps\src\wincompat\*.lib 2> NUL diff --git a/conf/admin_windows.go b/conf/admin_windows.go index a135aa6da..91d4bdc91 100644 --- a/conf/admin_windows.go +++ b/conf/admin_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/config.go b/conf/config.go index edbd71761..684c6d1a5 100644 --- a/conf/config.go +++ b/conf/config.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf @@ -10,11 +10,10 @@ import ( "crypto/subtle" "encoding/base64" "fmt" + "net/netip" "strings" "time" - "golang.zx2c4.com/go118/netip" - "golang.org/x/crypto/curve25519" "golang.zx2c4.com/wireguard/windows/l18n" diff --git a/conf/dnsresolver_windows.go b/conf/dnsresolver_windows.go index fcd271534..41bfd1378 100644 --- a/conf/dnsresolver_windows.go +++ b/conf/dnsresolver_windows.go @@ -1,16 +1,16 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf import ( "log" + "net/netip" "time" "unsafe" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" "golang.org/x/sys/windows" diff --git a/conf/dpapi/dpapi_windows.go b/conf/dpapi/dpapi_windows.go index 951f86934..49a329153 100644 --- a/conf/dpapi/dpapi_windows.go +++ b/conf/dpapi/dpapi_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package dpapi diff --git a/conf/dpapi/dpapi_windows_test.go b/conf/dpapi/dpapi_windows_test.go index a9122314c..fd7307e6c 100644 --- a/conf/dpapi/dpapi_windows_test.go +++ b/conf/dpapi/dpapi_windows_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package dpapi diff --git a/conf/filewriter_windows.go b/conf/filewriter_windows.go index e46e4c8cb..c6bb2b455 100644 --- a/conf/filewriter_windows.go +++ b/conf/filewriter_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/migration_windows.go b/conf/migration_windows.go index 4e106e202..ed288f3c6 100644 --- a/conf/migration_windows.go +++ b/conf/migration_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/mksyscall.go b/conf/mksyscall.go index c7ed0e4fd..2d5d1de44 100644 --- a/conf/mksyscall.go +++ b/conf/mksyscall.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/name.go b/conf/name.go index 1ecb3225d..0d084070b 100644 --- a/conf/name.go +++ b/conf/name.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/parser.go b/conf/parser.go index 1baf02ff6..d077ee7fd 100644 --- a/conf/parser.go +++ b/conf/parser.go @@ -1,17 +1,16 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf import ( "encoding/base64" + "net/netip" "strconv" "strings" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" "golang.org/x/text/encoding/unicode" @@ -182,10 +181,7 @@ func FromWgQuick(s, name string) (*Config, error) { sawPrivateKey := false var peer *Peer for _, line := range lines { - pound := strings.IndexByte(line, '#') - if pound >= 0 { - line = line[:pound] - } + line, _, _ = strings.Cut(line, "#") line = strings.TrimSpace(line) lineLower := strings.ToLower(line) if len(line) == 0 { diff --git a/conf/parser_test.go b/conf/parser_test.go index 67a208eb1..25d906fd7 100644 --- a/conf/parser_test.go +++ b/conf/parser_test.go @@ -1,16 +1,15 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf import ( + "net/netip" "reflect" "runtime" "testing" - - "golang.zx2c4.com/go118/netip" ) const testInput = ` @@ -46,7 +45,7 @@ func noError(t *testing.T, err error) bool { return false } -func equal(t *testing.T, expected, actual interface{}) bool { +func equal(t *testing.T, expected, actual any) bool { if reflect.DeepEqual(expected, actual) { return true } @@ -55,7 +54,7 @@ func equal(t *testing.T, expected, actual interface{}) bool { return false } -func lenTest(t *testing.T, actualO interface{}, expected int) bool { +func lenTest(t *testing.T, actualO any, expected int) bool { actual := reflect.ValueOf(actualO).Len() if reflect.DeepEqual(expected, actual) { return true @@ -65,7 +64,7 @@ func lenTest(t *testing.T, actualO interface{}, expected int) bool { return false } -func contains(t *testing.T, list, element interface{}) bool { +func contains(t *testing.T, list, element any) bool { listValue := reflect.ValueOf(list) for i := 0; i < listValue.Len(); i++ { if reflect.DeepEqual(listValue.Index(i).Interface(), element) { diff --git a/conf/path_windows.go b/conf/path_windows.go index ec93d5ff5..0ff0a0573 100644 --- a/conf/path_windows.go +++ b/conf/path_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/store.go b/conf/store.go index af2530466..02807b777 100644 --- a/conf/store.go +++ b/conf/store.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/store_test.go b/conf/store_test.go index 304a11e70..3427a2b19 100644 --- a/conf/store_test.go +++ b/conf/store_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/storewatcher.go b/conf/storewatcher.go index 94586c384..70a44add8 100644 --- a/conf/storewatcher.go +++ b/conf/storewatcher.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/storewatcher_windows.go b/conf/storewatcher_windows.go index a12fb59b0..0c4b74e74 100644 --- a/conf/storewatcher_windows.go +++ b/conf/storewatcher_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf diff --git a/conf/writer.go b/conf/writer.go index 7feb536a8..8df6a0f13 100644 --- a/conf/writer.go +++ b/conf/writer.go @@ -1,17 +1,16 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf import ( "fmt" + "net/netip" "strings" "unsafe" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" "golang.zx2c4.com/wireguard/windows/driver" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" diff --git a/docs/buildrun.md b/docs/buildrun.md index 209c57ac5..3d356f2aa 100644 --- a/docs/buildrun.md +++ b/docs/buildrun.md @@ -60,8 +60,8 @@ C:\Projects\wireguard-windows\installer> build Add a file called `sign.bat` in the root of this repository with these contents, or similar: ```text -set SigningCertificate=DF98E075A012ED8C86FBCF14854B8F9555CB3D45 -set TimestampServer=http://timestamp.digicert.com +set SigningCertificate=8BC932FDFF15B892E8364C49B383210810E4709D +set TimestampServer=http://timestamp.entrust.net/rfc3161ts2 ``` After, run the above `build` commands as usual, from a shell that has [`signtool.exe`](https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/signtool) in its `PATH`, such as the Visual Studio 2017 command prompt. diff --git a/driver/configuration_windows.go b/driver/configuration_windows.go index 5a12be63e..d838dcf28 100644 --- a/driver/configuration_windows.go +++ b/driver/configuration_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package driver @@ -81,7 +81,7 @@ var ( // SetAdapterState sets the adapter either Up or Down. func (wireguard *Adapter) SetAdapterState(adapterState AdapterState) (err error) { - r0, _, e1 := syscall.Syscall(procWireGuardSetAdapterState.Addr(), 2, wireguard.handle, uintptr(adapterState), 0) + r0, _, e1 := syscall.SyscallN(procWireGuardSetAdapterState.Addr(), wireguard.handle, uintptr(adapterState)) if r0 == 0 { err = e1 } @@ -90,7 +90,7 @@ func (wireguard *Adapter) SetAdapterState(adapterState AdapterState) (err error) // AdapterState returns the current state of the adapter. func (wireguard *Adapter) AdapterState() (adapterState AdapterState, err error) { - r0, _, e1 := syscall.Syscall(procWireGuardGetAdapterState.Addr(), 2, wireguard.handle, uintptr(unsafe.Pointer(&adapterState)), 0) + r0, _, e1 := syscall.SyscallN(procWireGuardGetAdapterState.Addr(), wireguard.handle, uintptr(unsafe.Pointer(&adapterState))) if r0 == 0 { err = e1 } @@ -99,7 +99,7 @@ func (wireguard *Adapter) AdapterState() (adapterState AdapterState, err error) // SetConfiguration sets the adapter configuration. func (wireguard *Adapter) SetConfiguration(interfaze *Interface, size uint32) (err error) { - r0, _, e1 := syscall.Syscall(procWireGuardSetConfiguration.Addr(), 3, wireguard.handle, uintptr(unsafe.Pointer(interfaze)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procWireGuardSetConfiguration.Addr(), wireguard.handle, uintptr(unsafe.Pointer(interfaze)), uintptr(size)) if r0 == 0 { err = e1 } @@ -114,7 +114,7 @@ func (wireguard *Adapter) Configuration() (interfaze *Interface, err error) { } for { buf := make([]byte, size) - r0, _, e1 := syscall.Syscall(procWireGuardGetConfiguration.Addr(), 3, wireguard.handle, uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&size))) + r0, _, e1 := syscall.SyscallN(procWireGuardGetConfiguration.Addr(), wireguard.handle, uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&size))) if r0 != 0 { wireguard.lastGetGuessSize = size return (*Interface)(unsafe.Pointer(&buf[0])), nil diff --git a/driver/dll_windows.go b/driver/dll_windows.go index 057595ec9..5dcb849ec 100644 --- a/driver/dll_windows.go +++ b/driver/dll_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package driver diff --git a/driver/driver_windows.go b/driver/driver_windows.go index 74dd087ce..462c3a309 100644 --- a/driver/driver_windows.go +++ b/driver/driver_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package driver @@ -67,11 +67,11 @@ func setupLogger(dll *lazyDLL) { } else if runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" { callback = windows.NewCallback(logMessage) } - syscall.Syscall(dll.NewProc("WireGuardSetLogger").Addr(), 1, callback, 0, 0) + syscall.SyscallN(dll.NewProc("WireGuardSetLogger").Addr(), callback) } func closeAdapter(wireguard *Adapter) { - syscall.Syscall(procWireGuardCloseAdapter.Addr(), 1, wireguard.handle, 0, 0) + syscall.SyscallN(procWireGuardCloseAdapter.Addr(), wireguard.handle) } // CreateAdapter creates a WireGuard adapter. name is the cosmetic name of the adapter. @@ -90,7 +90,7 @@ func CreateAdapter(name, tunnelType string, requestedGUID *windows.GUID) (wiregu if err != nil { return } - r0, _, e1 := syscall.Syscall(procWireGuardCreateAdapter.Addr(), 3, uintptr(unsafe.Pointer(name16)), uintptr(unsafe.Pointer(tunnelType16)), uintptr(unsafe.Pointer(requestedGUID))) + r0, _, e1 := syscall.SyscallN(procWireGuardCreateAdapter.Addr(), uintptr(unsafe.Pointer(name16)), uintptr(unsafe.Pointer(tunnelType16)), uintptr(unsafe.Pointer(requestedGUID))) if r0 == 0 { err = e1 return @@ -107,7 +107,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) { if err != nil { return } - r0, _, e1 := syscall.Syscall(procWireGuardOpenAdapter.Addr(), 1, uintptr(unsafe.Pointer(name16)), 0, 0) + r0, _, e1 := syscall.SyscallN(procWireGuardOpenAdapter.Addr(), uintptr(unsafe.Pointer(name16))) if r0 == 0 { err = e1 return @@ -120,7 +120,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) { // Close closes a WireGuard adapter. func (wireguard *Adapter) Close() (err error) { runtime.SetFinalizer(wireguard, nil) - r1, _, e1 := syscall.Syscall(procWireGuardCloseAdapter.Addr(), 1, wireguard.handle, 0, 0) + r1, _, e1 := syscall.SyscallN(procWireGuardCloseAdapter.Addr(), wireguard.handle) if r1 == 0 { err = e1 } @@ -129,7 +129,7 @@ func (wireguard *Adapter) Close() (err error) { // Uninstall removes the driver from the system if no drivers are currently in use. func Uninstall() (err error) { - r1, _, e1 := syscall.Syscall(procWireGuardDeleteDriver.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procWireGuardDeleteDriver.Addr()) if r1 == 0 { err = e1 } @@ -146,7 +146,7 @@ const ( // SetLogging enables or disables logging on the WireGuard adapter. func (wireguard *Adapter) SetLogging(logState AdapterLogState) (err error) { - r1, _, e1 := syscall.Syscall(procWireGuardSetAdapterLogging.Addr(), 2, wireguard.handle, uintptr(logState), 0) + r1, _, e1 := syscall.SyscallN(procWireGuardSetAdapterLogging.Addr(), wireguard.handle, uintptr(logState)) if r1 == 0 { err = e1 } @@ -155,7 +155,7 @@ func (wireguard *Adapter) SetLogging(logState AdapterLogState) (err error) { // RunningVersion returns the version of the loaded driver. func RunningVersion() (version uint32, err error) { - r0, _, e1 := syscall.Syscall(procWireGuardGetRunningDriverVersion.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procWireGuardGetRunningDriverVersion.Addr()) version = uint32(r0) if version == 0 { err = e1 @@ -165,6 +165,6 @@ func RunningVersion() (version uint32, err error) { // LUID returns the LUID of the adapter. func (wireguard *Adapter) LUID() (luid winipcfg.LUID) { - syscall.Syscall(procWireGuardGetAdapterLUID.Addr(), 2, wireguard.handle, uintptr(unsafe.Pointer(&luid)), 0) + syscall.SyscallN(procWireGuardGetAdapterLUID.Addr(), wireguard.handle, uintptr(unsafe.Pointer(&luid))) return } diff --git a/driver/memmod/memmod_windows.go b/driver/memmod/memmod_windows.go index 63f066fd2..7b54282aa 100644 --- a/driver/memmod/memmod_windows.go +++ b/driver/memmod/memmod_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod @@ -233,7 +233,7 @@ func (module *Module) executeTLS() { if f == 0 { break } - syscall.Syscall(f, 3, module.codeBase, uintptr(DLL_PROCESS_ATTACH), uintptr(0)) + syscall.SyscallN(f, module.codeBase, DLL_PROCESS_ATTACH, 0) callback += unsafe.Sizeof(f) } } @@ -444,7 +444,7 @@ func hookRtlPcToFileHeader() error { } } loadedAddressRangesMu.RUnlock() - ret, _, _ := syscall.Syscall(originalRtlPcToFileHeader, 2, pcValue, uintptr(unsafe.Pointer(baseOfImage)), 0) + ret, _, _ := syscall.SyscallN(originalRtlPcToFileHeader, pcValue, uintptr(unsafe.Pointer(baseOfImage))) return ret }) err = windows.VirtualProtect(uintptr(unsafe.Pointer(thunk)), unsafe.Sizeof(*thunk), oldProtect, &oldProtect) @@ -605,7 +605,7 @@ func LoadLibrary(data []byte) (module *Module, err error) { module.entry = module.codeBase + uintptr(module.headers.OptionalHeader.AddressOfEntryPoint) if module.isDLL { // Notify library about attaching to process. - r0, _, _ := syscall.Syscall(module.entry, 3, module.codeBase, uintptr(DLL_PROCESS_ATTACH), 0) + r0, _, _ := syscall.SyscallN(module.entry, module.codeBase, DLL_PROCESS_ATTACH, 0) successful := r0 != 0 if !successful { err = windows.ERROR_DLL_INIT_FAILED @@ -623,7 +623,7 @@ func LoadLibrary(data []byte) (module *Module, err error) { func (module *Module) Free() { if module.initialized { // Notify library about detaching from process. - syscall.Syscall(module.entry, 3, module.codeBase, uintptr(DLL_PROCESS_DETACH), 0) + syscall.SyscallN(module.entry, module.codeBase, DLL_PROCESS_DETACH, 0) module.initialized = false } if module.modules != nil { diff --git a/driver/memmod/memmod_windows_32.go b/driver/memmod/memmod_windows_32.go index 50e6febf0..611fbe53b 100644 --- a/driver/memmod/memmod_windows_32.go +++ b/driver/memmod/memmod_windows_32.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/memmod_windows_386.go b/driver/memmod/memmod_windows_386.go index 475c5c52b..71d6c93ea 100644 --- a/driver/memmod/memmod_windows_386.go +++ b/driver/memmod/memmod_windows_386.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/memmod_windows_64.go b/driver/memmod/memmod_windows_64.go index a53851c6b..28ada96eb 100644 --- a/driver/memmod/memmod_windows_64.go +++ b/driver/memmod/memmod_windows_64.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/memmod_windows_amd64.go b/driver/memmod/memmod_windows_amd64.go index a021a633c..2459b2d25 100644 --- a/driver/memmod/memmod_windows_amd64.go +++ b/driver/memmod/memmod_windows_amd64.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/memmod_windows_arm.go b/driver/memmod/memmod_windows_arm.go index 4637a01de..a644cee66 100644 --- a/driver/memmod/memmod_windows_arm.go +++ b/driver/memmod/memmod_windows_arm.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/memmod_windows_arm64.go b/driver/memmod/memmod_windows_arm64.go index b8f125963..09e246394 100644 --- a/driver/memmod/memmod_windows_arm64.go +++ b/driver/memmod/memmod_windows_arm64.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/syscall_windows.go b/driver/memmod/syscall_windows.go index b79be69e9..cdc6ef678 100644 --- a/driver/memmod/syscall_windows.go +++ b/driver/memmod/syscall_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/syscall_windows_32.go b/driver/memmod/syscall_windows_32.go index f036ecb88..dde8b3609 100644 --- a/driver/memmod/syscall_windows_32.go +++ b/driver/memmod/syscall_windows_32.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/memmod/syscall_windows_64.go b/driver/memmod/syscall_windows_64.go index 6f2c03967..f23524fbc 100644 --- a/driver/memmod/syscall_windows_64.go +++ b/driver/memmod/syscall_windows_64.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2017-2022 WireGuard LLC. All Rights Reserved. */ package memmod diff --git a/driver/wintunremoval_windows.go b/driver/wintunremoval_windows.go index 7ccfd6ff9..ab51d9899 100644 --- a/driver/wintunremoval_windows.go +++ b/driver/wintunremoval_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package driver diff --git a/elevate/doas.go b/elevate/doas.go index da692b208..b67ee88cc 100644 --- a/elevate/doas.go +++ b/elevate/doas.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package elevate @@ -19,11 +19,11 @@ import ( func setAllEnv(env []string) { windows.Clearenv() for _, e := range env { - kv := strings.SplitN(e, "=", 2) - if len(kv) != 2 { + k, v, ok := strings.Cut(e, "=") + if !ok { continue } - windows.Setenv(kv[0], kv[1]) + windows.Setenv(k, v) } } diff --git a/elevate/loader.go b/elevate/loader.go index d474a0073..7d15f8a44 100644 --- a/elevate/loader.go +++ b/elevate/loader.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package elevate diff --git a/elevate/membership.go b/elevate/membership.go index e73b2f9da..383a10ba1 100644 --- a/elevate/membership.go +++ b/elevate/membership.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package elevate diff --git a/elevate/privileges.go b/elevate/privileges.go index 8fc38555c..3d51640fe 100644 --- a/elevate/privileges.go +++ b/elevate/privileges.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package elevate diff --git a/elevate/shellexecute.go b/elevate/shellexecute.go index 0c411a665..e0be9d98a 100644 --- a/elevate/shellexecute.go +++ b/elevate/shellexecute.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package elevate @@ -130,13 +130,13 @@ func ShellExecute(program, arguments, directory string, show int32) (err error) return } - defer syscall.Syscall((*interfacePointer)[releaseOffset], 1, uintptr(unsafe.Pointer(interfacePointer)), 0, 0) + defer syscall.SyscallN((*interfacePointer)[releaseOffset], uintptr(unsafe.Pointer(interfacePointer))) if program16 == nil { return } - if ret, _, _ := syscall.Syscall6((*interfacePointer)[shellExecuteOffset], 6, + if ret, _, _ := syscall.SyscallN((*interfacePointer)[shellExecuteOffset], uintptr(unsafe.Pointer(interfacePointer)), uintptr(unsafe.Pointer(program16)), uintptr(unsafe.Pointer(arguments16)), diff --git a/embeddable-dll-service/build.bat b/embeddable-dll-service/build.bat index db8c77380..eca1f0cfc 100644 --- a/embeddable-dll-service/build.bat +++ b/embeddable-dll-service/build.bat @@ -1,6 +1,6 @@ @echo off rem SPDX-License-Identifier: MIT -rem Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. +rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. setlocal set BUILDDIR=%~dp0 diff --git a/embeddable-dll-service/csharp/DemoUI/MainWindow.Designer.cs b/embeddable-dll-service/csharp/DemoUI/MainWindow.Designer.cs index 5fae35d3e..5aad1b979 100644 --- a/embeddable-dll-service/csharp/DemoUI/MainWindow.Designer.cs +++ b/embeddable-dll-service/csharp/DemoUI/MainWindow.Designer.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ namespace DemoUI diff --git a/embeddable-dll-service/csharp/DemoUI/MainWindow.cs b/embeddable-dll-service/csharp/DemoUI/MainWindow.cs index 6e3eb21f0..1df17181b 100644 --- a/embeddable-dll-service/csharp/DemoUI/MainWindow.cs +++ b/embeddable-dll-service/csharp/DemoUI/MainWindow.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/DemoUI/Program.cs b/embeddable-dll-service/csharp/DemoUI/Program.cs index 8c420973d..3649ab93b 100644 --- a/embeddable-dll-service/csharp/DemoUI/Program.cs +++ b/embeddable-dll-service/csharp/DemoUI/Program.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/TunnelDll/Driver.cs b/embeddable-dll-service/csharp/TunnelDll/Driver.cs index f3543972b..69911ec8c 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Driver.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Driver.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/TunnelDll/Keypair.cs b/embeddable-dll-service/csharp/TunnelDll/Keypair.cs index 146d56e06..59847b983 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Keypair.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Keypair.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/TunnelDll/Ringlogger.cs b/embeddable-dll-service/csharp/TunnelDll/Ringlogger.cs index 469927c1b..9db01fc87 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Ringlogger.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Ringlogger.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/TunnelDll/Service.cs b/embeddable-dll-service/csharp/TunnelDll/Service.cs index 8e25b6c4a..2a8358ff1 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Service.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Service.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/csharp/TunnelDll/Win32.cs b/embeddable-dll-service/csharp/TunnelDll/Win32.cs index b4084ccfd..8e7f986d9 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Win32.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Win32.cs @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ using System; diff --git a/embeddable-dll-service/main.go b/embeddable-dll-service/main.go index 7450d72d5..f313ae7f1 100644 --- a/embeddable-dll-service/main.go +++ b/embeddable-dll-service/main.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package main diff --git a/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch b/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch deleted file mode 100644 index 3b44b363d..000000000 --- a/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Thu, 3 Dec 2020 13:29:58 +0100 -Subject: [PATCH] runtime: allow builtin write function to be redirected with - function pointer - -The x/sys/windows package currently uses go:linkname for other facilities -inside of runtime that are not suitable to be exposed as a public API -due to their dangers but are still necessary for manipulating any -low-level plumbing that the runtime controls. - -Logging, via the built-in println and panic handler, is one such -low-level plumbing feature. In this case, x/sys/windows/svc needs to be -able to redirect panics to the Windows event log. Because the event log -is a complicated interface, this requires a bit more fiddling than the -simple solution used on Android (baking it into runtime itself), and -because Windows services are very diverse, the event log might not even -always be a desirable destination. - -This commit accomplishes this by exposing a function pointer called -"overrideWrite" that low-level runtime packages like x/sys/windows/svc -can use to redirect output logs toward the event log or otherwise. - -It is not safe or acceptable to use as a generic mechanism, and for that -reason, we wouldn't want to expose this as a real stable API, similar to -the other instances of go:linkname in x/sys/windows. But for packages -that must interoperate with low-level Go runtime fundamentals, this is a -safety hatch for packages that are developed in tandem with the runtime. -x/sys/windows is one such package. - -Updates #42888. - -Change-Id: I77a32ff7e1494324e8cc38e792e007f86d32672d ---- - src/runtime/time_nofake.go | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go -index 5a4ceaf43d..68c01805a5 100644 ---- a/src/runtime/time_nofake.go -+++ b/src/runtime/time_nofake.go -@@ -20,9 +20,14 @@ func nanotime() int64 { - return nanotime1() - } - -+var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32 -+ - // write must be nosplit on Windows (see write1) - // - //go:nosplit - func write(fd uintptr, p unsafe.Pointer, n int32) int32 { -+ if overrideWrite != nil { -+ return overrideWrite(fd, noescape(p), n) -+ } - return write1(fd, p, n) - } diff --git a/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch b/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch deleted file mode 100644 index 0dac195aa..000000000 --- a/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch +++ /dev/null @@ -1,328 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Mon, 11 Oct 2021 21:31:47 -0600 -Subject: [PATCH] [release-branch.go1.17] cmd/compile: speed up unsafe.Slice by - omitting checks - -unsafe.Slice is already an unsafe operation, like unsafe.Pointer casts. -So, assume the user knows what they're doing, unless checkptr is used, -in which case, we can then emit the checker code, just like -unsafe.Pointer casts do. - -Fixes #48798. - -Change-Id: Ice1f615b49fe13556f71495f303d4ff0eb794bd9 ---- - src/cmd/compile/internal/typecheck/builtin.go | 179 +++++++++--------- - .../internal/typecheck/builtin/runtime.go | 2 - - src/cmd/compile/internal/walk/builtin.go | 19 +- - test/unsafebuiltins.go | 30 +-- - 4 files changed, 92 insertions(+), 138 deletions(-) - -diff --git a/src/cmd/compile/internal/typecheck/builtin.go b/src/cmd/compile/internal/typecheck/builtin.go -index 833b17b414..add59020a7 100644 ---- a/src/cmd/compile/internal/typecheck/builtin.go -+++ b/src/cmd/compile/internal/typecheck/builtin.go -@@ -136,72 +136,70 @@ var runtimeDecls = [...]struct { - {"makeslice64", funcTag, 113}, - {"makeslicecopy", funcTag, 114}, - {"growslice", funcTag, 116}, -- {"unsafeslice", funcTag, 117}, -- {"unsafeslice64", funcTag, 118}, -- {"unsafeslicecheckptr", funcTag, 118}, -- {"memmove", funcTag, 119}, -- {"memclrNoHeapPointers", funcTag, 120}, -- {"memclrHasPointers", funcTag, 120}, -- {"memequal", funcTag, 121}, -- {"memequal0", funcTag, 122}, -- {"memequal8", funcTag, 122}, -- {"memequal16", funcTag, 122}, -- {"memequal32", funcTag, 122}, -- {"memequal64", funcTag, 122}, -- {"memequal128", funcTag, 122}, -- {"f32equal", funcTag, 123}, -- {"f64equal", funcTag, 123}, -- {"c64equal", funcTag, 123}, -- {"c128equal", funcTag, 123}, -- {"strequal", funcTag, 123}, -- {"interequal", funcTag, 123}, -- {"nilinterequal", funcTag, 123}, -- {"memhash", funcTag, 124}, -- {"memhash0", funcTag, 125}, -- {"memhash8", funcTag, 125}, -- {"memhash16", funcTag, 125}, -- {"memhash32", funcTag, 125}, -- {"memhash64", funcTag, 125}, -- {"memhash128", funcTag, 125}, -- {"f32hash", funcTag, 125}, -- {"f64hash", funcTag, 125}, -- {"c64hash", funcTag, 125}, -- {"c128hash", funcTag, 125}, -- {"strhash", funcTag, 125}, -- {"interhash", funcTag, 125}, -- {"nilinterhash", funcTag, 125}, -- {"int64div", funcTag, 126}, -- {"uint64div", funcTag, 127}, -- {"int64mod", funcTag, 126}, -- {"uint64mod", funcTag, 127}, -- {"float64toint64", funcTag, 128}, -- {"float64touint64", funcTag, 129}, -- {"float64touint32", funcTag, 130}, -- {"int64tofloat64", funcTag, 131}, -- {"uint64tofloat64", funcTag, 132}, -- {"uint32tofloat64", funcTag, 133}, -- {"complex128div", funcTag, 134}, -- {"getcallerpc", funcTag, 135}, -- {"getcallersp", funcTag, 135}, -+ {"unsafeslicecheckptr", funcTag, 117}, -+ {"memmove", funcTag, 118}, -+ {"memclrNoHeapPointers", funcTag, 119}, -+ {"memclrHasPointers", funcTag, 119}, -+ {"memequal", funcTag, 120}, -+ {"memequal0", funcTag, 121}, -+ {"memequal8", funcTag, 121}, -+ {"memequal16", funcTag, 121}, -+ {"memequal32", funcTag, 121}, -+ {"memequal64", funcTag, 121}, -+ {"memequal128", funcTag, 121}, -+ {"f32equal", funcTag, 122}, -+ {"f64equal", funcTag, 122}, -+ {"c64equal", funcTag, 122}, -+ {"c128equal", funcTag, 122}, -+ {"strequal", funcTag, 122}, -+ {"interequal", funcTag, 122}, -+ {"nilinterequal", funcTag, 122}, -+ {"memhash", funcTag, 123}, -+ {"memhash0", funcTag, 124}, -+ {"memhash8", funcTag, 124}, -+ {"memhash16", funcTag, 124}, -+ {"memhash32", funcTag, 124}, -+ {"memhash64", funcTag, 124}, -+ {"memhash128", funcTag, 124}, -+ {"f32hash", funcTag, 124}, -+ {"f64hash", funcTag, 124}, -+ {"c64hash", funcTag, 124}, -+ {"c128hash", funcTag, 124}, -+ {"strhash", funcTag, 124}, -+ {"interhash", funcTag, 124}, -+ {"nilinterhash", funcTag, 124}, -+ {"int64div", funcTag, 125}, -+ {"uint64div", funcTag, 126}, -+ {"int64mod", funcTag, 125}, -+ {"uint64mod", funcTag, 126}, -+ {"float64toint64", funcTag, 127}, -+ {"float64touint64", funcTag, 128}, -+ {"float64touint32", funcTag, 129}, -+ {"int64tofloat64", funcTag, 130}, -+ {"uint64tofloat64", funcTag, 131}, -+ {"uint32tofloat64", funcTag, 132}, -+ {"complex128div", funcTag, 133}, -+ {"getcallerpc", funcTag, 134}, -+ {"getcallersp", funcTag, 134}, - {"racefuncenter", funcTag, 31}, - {"racefuncexit", funcTag, 9}, - {"raceread", funcTag, 31}, - {"racewrite", funcTag, 31}, -- {"racereadrange", funcTag, 136}, -- {"racewriterange", funcTag, 136}, -- {"msanread", funcTag, 136}, -- {"msanwrite", funcTag, 136}, -- {"msanmove", funcTag, 137}, -- {"checkptrAlignment", funcTag, 138}, -- {"checkptrArithmetic", funcTag, 140}, -- {"libfuzzerTraceCmp1", funcTag, 141}, -- {"libfuzzerTraceCmp2", funcTag, 142}, -- {"libfuzzerTraceCmp4", funcTag, 143}, -- {"libfuzzerTraceCmp8", funcTag, 144}, -- {"libfuzzerTraceConstCmp1", funcTag, 141}, -- {"libfuzzerTraceConstCmp2", funcTag, 142}, -- {"libfuzzerTraceConstCmp4", funcTag, 143}, -- {"libfuzzerTraceConstCmp8", funcTag, 144}, -+ {"racereadrange", funcTag, 135}, -+ {"racewriterange", funcTag, 135}, -+ {"msanread", funcTag, 135}, -+ {"msanwrite", funcTag, 135}, -+ {"msanmove", funcTag, 136}, -+ {"checkptrAlignment", funcTag, 137}, -+ {"checkptrArithmetic", funcTag, 139}, -+ {"libfuzzerTraceCmp1", funcTag, 140}, -+ {"libfuzzerTraceCmp2", funcTag, 141}, -+ {"libfuzzerTraceCmp4", funcTag, 142}, -+ {"libfuzzerTraceCmp8", funcTag, 143}, -+ {"libfuzzerTraceConstCmp1", funcTag, 140}, -+ {"libfuzzerTraceConstCmp2", funcTag, 141}, -+ {"libfuzzerTraceConstCmp4", funcTag, 142}, -+ {"libfuzzerTraceConstCmp8", funcTag, 143}, - {"x86HasPOPCNT", varTag, 6}, - {"x86HasSSE41", varTag, 6}, - {"x86HasFMA", varTag, 6}, -@@ -224,7 +222,7 @@ func params(tlist ...*types.Type) []*types.Field { - } - - func runtimeTypes() []*types.Type { -- var typs [145]*types.Type -+ var typs [144]*types.Type - typs[0] = types.ByteType - typs[1] = types.NewPtr(typs[0]) - typs[2] = types.Types[types.TANY] -@@ -342,33 +340,32 @@ func runtimeTypes() []*types.Type { - typs[114] = newSig(params(typs[1], typs[15], typs[15], typs[7]), params(typs[7])) - typs[115] = types.NewSlice(typs[2]) - typs[116] = newSig(params(typs[1], typs[115], typs[15]), params(typs[115])) -- typs[117] = newSig(params(typs[1], typs[7], typs[15]), nil) -- typs[118] = newSig(params(typs[1], typs[7], typs[22]), nil) -- typs[119] = newSig(params(typs[3], typs[3], typs[5]), nil) -- typs[120] = newSig(params(typs[7], typs[5]), nil) -- typs[121] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6])) -- typs[122] = newSig(params(typs[3], typs[3]), params(typs[6])) -- typs[123] = newSig(params(typs[7], typs[7]), params(typs[6])) -- typs[124] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5])) -- typs[125] = newSig(params(typs[7], typs[5]), params(typs[5])) -- typs[126] = newSig(params(typs[22], typs[22]), params(typs[22])) -- typs[127] = newSig(params(typs[24], typs[24]), params(typs[24])) -- typs[128] = newSig(params(typs[20]), params(typs[22])) -- typs[129] = newSig(params(typs[20]), params(typs[24])) -- typs[130] = newSig(params(typs[20]), params(typs[60])) -- typs[131] = newSig(params(typs[22]), params(typs[20])) -- typs[132] = newSig(params(typs[24]), params(typs[20])) -- typs[133] = newSig(params(typs[60]), params(typs[20])) -- typs[134] = newSig(params(typs[26], typs[26]), params(typs[26])) -- typs[135] = newSig(nil, params(typs[5])) -- typs[136] = newSig(params(typs[5], typs[5]), nil) -- typs[137] = newSig(params(typs[5], typs[5], typs[5]), nil) -- typs[138] = newSig(params(typs[7], typs[1], typs[5]), nil) -- typs[139] = types.NewSlice(typs[7]) -- typs[140] = newSig(params(typs[7], typs[139]), nil) -- typs[141] = newSig(params(typs[64], typs[64]), nil) -- typs[142] = newSig(params(typs[58], typs[58]), nil) -- typs[143] = newSig(params(typs[60], typs[60]), nil) -- typs[144] = newSig(params(typs[24], typs[24]), nil) -+ typs[117] = newSig(params(typs[1], typs[7], typs[22]), nil) -+ typs[118] = newSig(params(typs[3], typs[3], typs[5]), nil) -+ typs[119] = newSig(params(typs[7], typs[5]), nil) -+ typs[120] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6])) -+ typs[121] = newSig(params(typs[3], typs[3]), params(typs[6])) -+ typs[122] = newSig(params(typs[7], typs[7]), params(typs[6])) -+ typs[123] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5])) -+ typs[124] = newSig(params(typs[7], typs[5]), params(typs[5])) -+ typs[125] = newSig(params(typs[22], typs[22]), params(typs[22])) -+ typs[126] = newSig(params(typs[24], typs[24]), params(typs[24])) -+ typs[127] = newSig(params(typs[20]), params(typs[22])) -+ typs[128] = newSig(params(typs[20]), params(typs[24])) -+ typs[129] = newSig(params(typs[20]), params(typs[60])) -+ typs[130] = newSig(params(typs[22]), params(typs[20])) -+ typs[131] = newSig(params(typs[24]), params(typs[20])) -+ typs[132] = newSig(params(typs[60]), params(typs[20])) -+ typs[133] = newSig(params(typs[26], typs[26]), params(typs[26])) -+ typs[134] = newSig(nil, params(typs[5])) -+ typs[135] = newSig(params(typs[5], typs[5]), nil) -+ typs[136] = newSig(params(typs[5], typs[5], typs[5]), nil) -+ typs[137] = newSig(params(typs[7], typs[1], typs[5]), nil) -+ typs[138] = types.NewSlice(typs[7]) -+ typs[139] = newSig(params(typs[7], typs[138]), nil) -+ typs[140] = newSig(params(typs[64], typs[64]), nil) -+ typs[141] = newSig(params(typs[58], typs[58]), nil) -+ typs[142] = newSig(params(typs[60], typs[60]), nil) -+ typs[143] = newSig(params(typs[24], typs[24]), nil) - return typs[:] - } -diff --git a/src/cmd/compile/internal/typecheck/builtin/runtime.go b/src/cmd/compile/internal/typecheck/builtin/runtime.go -index 2b29ea3c08..bd45258058 100644 ---- a/src/cmd/compile/internal/typecheck/builtin/runtime.go -+++ b/src/cmd/compile/internal/typecheck/builtin/runtime.go -@@ -183,8 +183,6 @@ func makeslice(typ *byte, len int, cap int) unsafe.Pointer - func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer - func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer - func growslice(typ *byte, old []any, cap int) (ary []any) --func unsafeslice(typ *byte, ptr unsafe.Pointer, len int) --func unsafeslice64(typ *byte, ptr unsafe.Pointer, len int64) - func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64) - - func memmove(to *any, frm *any, length uintptr) -diff --git a/src/cmd/compile/internal/walk/builtin.go b/src/cmd/compile/internal/walk/builtin.go -index 14efc05e32..2843d468e5 100644 ---- a/src/cmd/compile/internal/walk/builtin.go -+++ b/src/cmd/compile/internal/walk/builtin.go -@@ -656,27 +656,14 @@ func walkRecover(nn *ir.CallExpr, init *ir.Nodes) ir.Node { - func walkUnsafeSlice(n *ir.BinaryExpr, init *ir.Nodes) ir.Node { - ptr := safeExpr(n.X, init) - len := safeExpr(n.Y, init) -- -- fnname := "unsafeslice64" - lenType := types.Types[types.TINT64] -- -- // Type checking guarantees that TIDEAL len/cap are positive and fit in an int. -- // The case of len or cap overflow when converting TUINT or TUINTPTR to TINT -- // will be handled by the negative range checks in unsafeslice during runtime. -+ t := n.Type() - if ir.ShouldCheckPtr(ir.CurFunc, 1) { -- fnname = "unsafeslicecheckptr" -- // for simplicity, unsafeslicecheckptr always uses int64 -+ fn := typecheck.LookupRuntime("unsafeslicecheckptr") -+ init.Append(mkcall1(fn, nil, init, reflectdata.TypePtr(t.Elem()), typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]), typecheck.Conv(len, lenType))) - } else if len.Type().IsKind(types.TIDEAL) || len.Type().Size() <= types.Types[types.TUINT].Size() { -- fnname = "unsafeslice" - lenType = types.Types[types.TINT] - } -- -- t := n.Type() -- -- // Call runtime.unsafeslice{,64,checkptr} to check ptr and len. -- fn := typecheck.LookupRuntime(fnname) -- init.Append(mkcall1(fn, nil, init, reflectdata.TypePtr(t.Elem()), typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]), typecheck.Conv(len, lenType))) -- - h := ir.NewSliceHeaderExpr(n.Pos(), t, - typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]), - typecheck.Conv(len, types.Types[types.TINT]), -diff --git a/test/unsafebuiltins.go b/test/unsafebuiltins.go -index 4c940aa855..d613088827 100644 ---- a/test/unsafebuiltins.go -+++ b/test/unsafebuiltins.go -@@ -6,10 +6,7 @@ - - package main - --import ( -- "math" -- "unsafe" --) -+import "unsafe" - - const maxUintptr = 1 << (8 * unsafe.Sizeof(uintptr(0))) - -@@ -29,24 +26,6 @@ func main() { - assert(&s[0] == &p[0]) - assert(len(s) == len(p)) - assert(cap(s) == len(p)) -- -- // nil pointer with zero length returns nil -- assert(unsafe.Slice((*int)(nil), 0) == nil) -- -- // nil pointer with positive length panics -- mustPanic(func() { _ = unsafe.Slice((*int)(nil), 1) }) -- -- // negative length -- var neg int = -1 -- mustPanic(func() { _ = unsafe.Slice(new(byte), neg) }) -- -- // length too large -- var tooBig uint64 = math.MaxUint64 -- mustPanic(func() { _ = unsafe.Slice(new(byte), tooBig) }) -- -- // size overflows address space -- mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8) }) -- mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8+1) }) - } - } - -@@ -55,10 +34,3 @@ func assert(ok bool) { - panic("FAIL") - } - } -- --func mustPanic(f func()) { -- defer func() { -- assert(recover() != nil) -- }() -- f() --} diff --git a/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch b/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch deleted file mode 100644 index dbab4ba09..000000000 --- a/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Tue, 23 Nov 2021 20:04:24 +0100 -Subject: [PATCH] [release-branch.go1.17] runtime: support non-cooperative - preemption on windows/arm - -This adds support for injecting asynchronous preemption calls on -windows/arm. This code follows sigctxt.pushCall for POSIX OSes -on arm, except we subtract 1 from IP, just as in CL 273727. - -Updates #10958. -Updates #24543. -Updates #49759. - -Change-Id: Id0c2aed28662f50631b8c8cede3b4e6f088dafea -Reviewed-on: https://go-review.googlesource.com/c/go/+/366734 -Trust: Jason A. Donenfeld -Reviewed-by: Austin Clements -Reviewed-by: Patrik Nyblom -Reviewed-by: Cherry Mui ---- - src/runtime/os_windows.go | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go -index f0935264ac..faeb6ce552 100644 ---- a/src/runtime/os_windows.go -+++ b/src/runtime/os_windows.go -@@ -1303,7 +1303,7 @@ func setThreadCPUProfiler(hz int32) { - atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz)) - } - --const preemptMSupported = GOARCH == "386" || GOARCH == "amd64" -+const preemptMSupported = GOARCH != "arm64" - - // suspendLock protects simultaneous SuspendThread operations from - // suspending each other. -@@ -1396,8 +1396,20 @@ func preemptM(mp *m) { - *(*uintptr)(unsafe.Pointer(sp)) = newpc - c.set_sp(sp) - c.set_ip(targetPC) -- } - -+ case "arm": -+ // Push LR. The injected call is responsible -+ // for restoring LR. gentraceback is aware of -+ // this extra slot. See sigctxt.pushCall in -+ // signal_arm.go, which is similar except we -+ // subtract 1 from IP here. -+ sp := c.sp() -+ sp -= sys.PtrSize -+ c.set_sp(sp) -+ *(*uint32)(unsafe.Pointer(sp)) = uint32(c.lr()) -+ c.set_lr(newpc - 1) -+ c.set_ip(targetPC) -+ } - stdcall2(_SetThreadContext, thread, uintptr(unsafe.Pointer(c))) - } - } diff --git a/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch b/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch deleted file mode 100644 index c99ea390b..000000000 --- a/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Tue, 23 Nov 2021 20:57:24 +0100 -Subject: [PATCH] runtime: support non-cooperative preemption on windows/arm64 - -This adds support for injecting asynchronous preemption calls on -windows/arm64. This code exactly follows sigctxt.pushCall for POSIX OSes -on arm64. - -Fixes #49759. - -Change-Id: Id35ff6bc105c1db9d7ed2918d3ecab0e4e9a9431 -Reviewed-on: https://go-review.googlesource.com/c/go/+/366735 -Trust: Jason A. Donenfeld -Run-TryBot: Jason A. Donenfeld -TryBot-Result: Go Bot -Reviewed-by: Cherry Mui -Reviewed-by: Austin Clements -Reviewed-by: Patrik Nyblom ---- - src/runtime/os_windows.go | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go -index faeb6ce552..7bf9a426d1 100644 ---- a/src/runtime/os_windows.go -+++ b/src/runtime/os_windows.go -@@ -1303,18 +1303,13 @@ func setThreadCPUProfiler(hz int32) { - atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz)) - } - --const preemptMSupported = GOARCH != "arm64" -+const preemptMSupported = true - - // suspendLock protects simultaneous SuspendThread operations from - // suspending each other. - var suspendLock mutex - - func preemptM(mp *m) { -- if !preemptMSupported { -- // TODO: Implement call injection -- return -- } -- - if mp == getg().m { - throw("self-preempt") - } -@@ -1409,6 +1404,17 @@ func preemptM(mp *m) { - *(*uint32)(unsafe.Pointer(sp)) = uint32(c.lr()) - c.set_lr(newpc - 1) - c.set_ip(targetPC) -+ -+ case "arm64": -+ // Push LR. The injected call is responsible -+ // for restoring LR. gentraceback is aware of -+ // this extra slot. See sigctxt.pushCall in -+ // signal_arm64.go. -+ sp := c.sp() - 16 // SP needs 16-byte alignment -+ c.set_sp(sp) -+ *(*uint64)(unsafe.Pointer(sp)) = uint64(c.lr()) -+ c.set_lr(newpc) -+ c.set_ip(targetPC) - } - stdcall2(_SetThreadContext, thread, uintptr(unsafe.Pointer(c))) - } diff --git a/go.mod b/go.mod index 3935f62a5..52c8b64d8 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,14 @@ module golang.zx2c4.com/wireguard/windows -go 1.17 +go 1.18 require ( github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 github.com/lxn/win v0.0.0-20210218163916-a377121e959e - golang.org/x/crypto v0.0.0-20211202192323-5770296d904e - golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c - golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 + golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 + golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9 + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 - golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d ) require ( diff --git a/go.mod.master b/go.mod.master index 01ef436e0..ca40b2f0c 100644 --- a/go.mod.master +++ b/go.mod.master @@ -1,6 +1,6 @@ module golang.zx2c4.com/wireguard/windows -go 1.17 +go 1.18 require ( github.com/lxn/walk latest @@ -9,7 +9,6 @@ require ( golang.org/x/net latest golang.org/x/sys latest golang.org/x/text master - golang.zx2c4.com/go118/netip master ) replace ( diff --git a/go.sum b/go.sum index 74d411f76..504666f68 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,18 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8= -golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 h1:TyHqChC80pFkXWraUUf6RuB5IqFdQieMLwwCJokV2pc= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 h1:GLw7MR8AfAG2GmGcmVgObFOHXYypgGjnGno25RDwn3Y= golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0= @@ -23,8 +23,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d h1:9+v0G0naRhLPOJEeJOL6NuXTtAHHwmkyZlgQJ0XcQ8I= -golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d/go.mod h1:5yyfuiqVIJ7t+3MqrpTQ+QqRkMWiESiyDvPNvKYCecg= golang.zx2c4.com/wireguard/windows v0.0.0-20210121140954-e7fc19d483bd h1:kAUzMAITME2MCtrXBaUa9P4tndiXGWO674k9gn6ZR28= golang.zx2c4.com/wireguard/windows v0.0.0-20210121140954-e7fc19d483bd/go.mod h1:Y+FYqVFaQO6a+1uigm0N0GiuaZrLEaBxEiJ8tfH9sMQ= golang.zx2c4.com/wireguard/windows v0.0.0-20210224134948-620c54ef6199 h1:ogXKLng/Myrt2odYTkleySGzQj/GWg9GV1AQ8P9NnU4= diff --git a/gotext.go b/gotext.go index 04f34fe1d..db39bdd3f 100644 --- a/gotext.go +++ b/gotext.go @@ -4,7 +4,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package main diff --git a/installer/build.bat b/installer/build.bat index c82ad8fec..60d2558ca 100644 --- a/installer/build.bat +++ b/installer/build.bat @@ -1,6 +1,6 @@ @echo off rem SPDX-License-Identifier: MIT -rem Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. +rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. setlocal set PATHEXT=.exe diff --git a/installer/customactions.c b/installer/customactions.c index 66fa46108..d3078a31b 100644 --- a/installer/customactions.c +++ b/installer/customactions.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT /* - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ #include diff --git a/installer/fetcher/Makefile b/installer/fetcher/Makefile index 8bc06ff15..a247adfe2 100644 --- a/installer/fetcher/Makefile +++ b/installer/fetcher/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright (C) 2015-2021 Jason A. Donenfeld . All Rights Reserved. +# Copyright (C) 2015-2022 Jason A. Donenfeld . All Rights Reserved. CFLAGS ?= -Os DEPLOYMENT_HOST ?= winvm diff --git a/installer/fetcher/constants.h b/installer/fetcher/constants.h index 8f2f3403b..96d88d0e4 100644 --- a/installer/fetcher/constants.h +++ b/installer/fetcher/constants.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #ifndef _CONSTANTS_H diff --git a/installer/fetcher/crypto.c b/installer/fetcher/crypto.c index 880cff30d..33154efb1 100644 --- a/installer/fetcher/crypto.c +++ b/installer/fetcher/crypto.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. * Copyright (c) 2020, Google Inc. */ @@ -2239,7 +2239,7 @@ void blake2b256_update(struct blake2b256_state *state, const uint8_t *in, state->buflen += inlen; } -void blake2b256_final(struct blake2b256_state *state, uint8_t *out) +void blake2b256_final(struct blake2b256_state *state, uint8_t out[32]) { state->t[0] += state->buflen; state->t[1] += (state->t[0] < state->buflen); @@ -2247,6 +2247,6 @@ void blake2b256_final(struct blake2b256_state *state, uint8_t *out) memset(state->buf + state->buflen, 0, 128 - state->buflen); blake2b256_compress(state, state->buf); - for (int i = 0; i < 8; ++i) + for (int i = 0; i < 4; ++i) store_le64(out + i * sizeof(state->h[i]), state->h[i]); } diff --git a/installer/fetcher/crypto.h b/installer/fetcher/crypto.h index 51691a464..dc234ec7c 100644 --- a/installer/fetcher/crypto.h +++ b/installer/fetcher/crypto.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #ifndef _CRYPTO_H @@ -21,7 +21,7 @@ struct blake2b256_state { void blake2b256_init(struct blake2b256_state *state); void blake2b256_update(struct blake2b256_state *state, const uint8_t *in, unsigned int inlen); -void blake2b256_final(struct blake2b256_state *state, uint8_t *out); +void blake2b256_final(struct blake2b256_state *state, uint8_t out[32]); bool ed25519_verify(const uint8_t signature[64], const uint8_t public_key[32], const void *message, size_t message_size); diff --git a/installer/fetcher/fetcher.c b/installer/fetcher/fetcher.c index 7392fb598..b3fbc9949 100644 --- a/installer/fetcher/fetcher.c +++ b/installer/fetcher/fetcher.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #include diff --git a/installer/fetcher/filelist.c b/installer/fetcher/filelist.c index a65c397d9..f938e324f 100644 --- a/installer/fetcher/filelist.c +++ b/installer/fetcher/filelist.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #include "constants.h" diff --git a/installer/fetcher/filelist.h b/installer/fetcher/filelist.h index 7b3b72634..7da57470b 100644 --- a/installer/fetcher/filelist.h +++ b/installer/fetcher/filelist.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #ifndef _FILELIST_H diff --git a/installer/fetcher/resources.rc b/installer/fetcher/resources.rc index 771c6d460..f2bedb66e 100644 --- a/installer/fetcher/resources.rc +++ b/installer/fetcher/resources.rc @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #include @@ -27,7 +27,7 @@ BEGIN VALUE "FileDescription", "WireGuard Installer: Fast, Modern, Secure VPN Tunnel" VALUE "FileVersion", VERSION_STR VALUE "InternalName", "wireguard-installer" - VALUE "LegalCopyright", "Copyright © 2015-2021 Jason A. Donenfeld . All Rights Reserved." + VALUE "LegalCopyright", "Copyright © 2015-2022 Jason A. Donenfeld . All Rights Reserved." VALUE "OriginalFilename", "wireguard-installer.exe" VALUE "ProductName", "WireGuard" VALUE "ProductVersion", VERSION_STR diff --git a/installer/fetcher/systeminfo.c b/installer/fetcher/systeminfo.c index 3753965eb..f1f80e7fb 100644 --- a/installer/fetcher/systeminfo.c +++ b/installer/fetcher/systeminfo.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #include "systeminfo.h" diff --git a/installer/fetcher/systeminfo.h b/installer/fetcher/systeminfo.h index bcb2ab9ec..2c06a166f 100644 --- a/installer/fetcher/systeminfo.h +++ b/installer/fetcher/systeminfo.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #ifndef _SYSTEMINFO_H diff --git a/installer/fetcher/version.h b/installer/fetcher/version.h index 794a99267..dd6f54d1e 100644 --- a/installer/fetcher/version.h +++ b/installer/fetcher/version.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Copyright (C) 2020-2021 Jason A. Donenfeld. All Rights Reserved. + * Copyright (C) 2020-2022 Jason A. Donenfeld. All Rights Reserved. */ #ifndef _VERSION_H diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs index 9cc271565..ab90d3cdc 100644 --- a/installer/wireguard.wxs +++ b/installer/wireguard.wxs @@ -2,7 +2,7 @@ diff --git a/l18n/l18n.go b/l18n/l18n.go index 4af5cfdba..512fe2a29 100644 --- a/l18n/l18n.go +++ b/l18n/l18n.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package l18n @@ -52,7 +52,7 @@ func lang() (tag language.Tag) { } // Sprintf is like fmt.Sprintf, but using language-specific formatting. -func Sprintf(key message.Reference, a ...interface{}) string { +func Sprintf(key message.Reference, a ...any) string { return prn().Sprintf(key, a...) } diff --git a/main.go b/main.go index 1f031345e..62a0b559a 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package main @@ -41,20 +41,20 @@ func setLogFile() { } } -func fatal(v ...interface{}) { +func fatal(v ...any) { if log.Writer() == io.Discard { windows.MessageBox(0, windows.StringToUTF16Ptr(fmt.Sprint(v...)), windows.StringToUTF16Ptr(l18n.Sprintf("Error")), windows.MB_ICONERROR) os.Exit(1) } else { - log.Fatal(append([]interface{}{l18n.Sprintf("Error: ")}, v...)) + log.Fatal(append([]any{l18n.Sprintf("Error: ")}, v...)) } } -func fatalf(format string, v ...interface{}) { +func fatalf(format string, v ...any) { fatal(l18n.Sprintf(format, v...)) } -func info(title, format string, v ...interface{}) { +func info(title, format string, v ...any) { if log.Writer() == io.Discard { windows.MessageBox(0, windows.StringToUTF16Ptr(l18n.Sprintf(format, v...)), windows.StringToUTF16Ptr(title), windows.MB_ICONINFORMATION) } else { diff --git a/manager/install.go b/manager/install.go index 2ab94bc15..44a744cf0 100644 --- a/manager/install.go +++ b/manager/install.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/ipc_client.go b/manager/ipc_client.go index 199156bc2..8c9c4c041 100644 --- a/manager/ipc_client.go +++ b/manager/ipc_client.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/ipc_driver.go b/manager/ipc_driver.go index a4f83e614..6cb43c38a 100644 --- a/manager/ipc_driver.go +++ b/manager/ipc_driver.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/ipc_server.go b/manager/ipc_server.go index bb36c6490..e21ffaf00 100644 --- a/manager/ipc_server.go +++ b/manager/ipc_server.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager @@ -461,7 +461,7 @@ func IPCServerListen(reader, writer, events *os.File, elevatedToken windows.Toke }() } -func notifyAll(notificationType NotificationType, adminOnly bool, ifaces ...interface{}) { +func notifyAll(notificationType NotificationType, adminOnly bool, ifaces ...any) { if len(managerServices) == 0 { return } diff --git a/manager/service.go b/manager/service.go index 5e243969e..47e20d456 100644 --- a/manager/service.go +++ b/manager/service.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/tunneltracker.go b/manager/tunneltracker.go index 4a6fb5bbe..9003d4457 100644 --- a/manager/tunneltracker.go +++ b/manager/tunneltracker.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/uiprocess.go b/manager/uiprocess.go index 08c29f404..b33b1ad34 100644 --- a/manager/uiprocess.go +++ b/manager/uiprocess.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/manager/updatestate.go b/manager/updatestate.go index cb65e7dd1..d5a19c8d1 100644 --- a/manager/updatestate.go +++ b/manager/updatestate.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package manager diff --git a/quickinstall.bat b/quickinstall.bat index 95157bbda..47d66a305 100644 --- a/quickinstall.bat +++ b/quickinstall.bat @@ -1,6 +1,6 @@ @echo off rem SPDX-License-Identifier: MIT -rem Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. +rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. setlocal cd /d %~dp0 || exit /b 1 diff --git a/resources.rc b/resources.rc index 1a8076fd3..0601d9386 100644 --- a/resources.rc +++ b/resources.rc @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ #include @@ -32,7 +32,7 @@ BEGIN \ VALUE "FileDescription", file_desc \ VALUE "FileVersion", EXPAND(WIREGUARD_VERSION_STR) \ VALUE "InternalName", "wireguard-windows" \ - VALUE "LegalCopyright", "Copyright © 2015-2021 Jason A. Donenfeld . All Rights Reserved." \ + VALUE "LegalCopyright", "Copyright © 2015-2022 Jason A. Donenfeld . All Rights Reserved." \ VALUE "OriginalFilename", "wireguard.exe" \ VALUE "ProductName", "WireGuard" \ VALUE "ProductVersion", EXPAND(WIREGUARD_VERSION_STR) \ diff --git a/ringlogger/cli_test.go b/ringlogger/cli_test.go index 960fe547a..12541c818 100644 --- a/ringlogger/cli_test.go +++ b/ringlogger/cli_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ringlogger diff --git a/ringlogger/dump.go b/ringlogger/dump.go index babd85d2a..3c0897512 100644 --- a/ringlogger/dump.go +++ b/ringlogger/dump.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ringlogger diff --git a/ringlogger/global.go b/ringlogger/global.go index 6b6141907..5c522a707 100644 --- a/ringlogger/global.go +++ b/ringlogger/global.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ringlogger diff --git a/ringlogger/ringlogger.go b/ringlogger/ringlogger.go index e002b2fe2..e932f88ca 100644 --- a/ringlogger/ringlogger.go +++ b/ringlogger/ringlogger.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ringlogger @@ -63,6 +63,7 @@ func NewRinglogger(filename, tag string) (*Ringlogger, error) { } rl, err := newRingloggerFromMappingHandle(mapping, tag, windows.FILE_MAP_WRITE) if err != nil { + windows.CloseHandle(mapping) return nil, err } rl.file = file @@ -82,10 +83,6 @@ func newRingloggerFromMappingHandle(mappingHandle windows.Handle, tag string, ac if err != nil { return nil, err } - if err != nil { - windows.CloseHandle(mappingHandle) - return nil, err - } log := (*logMem)(unsafe.Pointer(view)) if log.magic != magic { bytes := (*[unsafe.Sizeof(logMem{})]byte)(unsafe.Pointer(log)) diff --git a/services/boot.go b/services/boot.go index 6649dafbe..ae7aadda2 100644 --- a/services/boot.go +++ b/services/boot.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package services diff --git a/services/errors.go b/services/errors.go index 763690e98..c05884941 100644 --- a/services/errors.go +++ b/services/errors.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package services diff --git a/tunnel/addressconfig.go b/tunnel/addressconfig.go index 8be13fb93..a3ce62951 100644 --- a/tunnel/addressconfig.go +++ b/tunnel/addressconfig.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel @@ -8,10 +8,9 @@ package tunnel import ( "fmt" "log" + "net/netip" "time" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" "golang.zx2c4.com/wireguard/windows/conf" "golang.zx2c4.com/wireguard/windows/services" diff --git a/tunnel/deterministicguid.go b/tunnel/deterministicguid.go index 818902e2c..405d33a39 100644 --- a/tunnel/deterministicguid.go +++ b/tunnel/deterministicguid.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel diff --git a/tunnel/firewall/blocker.go b/tunnel/firewall/blocker.go index 4be62aa98..8a4967ba2 100644 --- a/tunnel/firewall/blocker.go +++ b/tunnel/firewall/blocker.go @@ -1,16 +1,15 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall import ( "errors" + "net/netip" "unsafe" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" ) diff --git a/tunnel/firewall/helpers.go b/tunnel/firewall/helpers.go index e3e4eac67..46e43aa56 100644 --- a/tunnel/firewall/helpers.go +++ b/tunnel/firewall/helpers.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/mksyscall.go b/tunnel/firewall/mksyscall.go index d5ff98aa2..fc108007e 100644 --- a/tunnel/firewall/mksyscall.go +++ b/tunnel/firewall/mksyscall.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/rules.go b/tunnel/firewall/rules.go index c5a0c4e69..41632f98d 100644 --- a/tunnel/firewall/rules.go +++ b/tunnel/firewall/rules.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall @@ -8,11 +8,10 @@ package firewall import ( "encoding/binary" "errors" + "net/netip" "runtime" "unsafe" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" ) diff --git a/tunnel/firewall/syscall_windows.go b/tunnel/firewall/syscall_windows.go index 661527d9f..4d8eea42c 100644 --- a/tunnel/firewall/syscall_windows.go +++ b/tunnel/firewall/syscall_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/types_windows.go b/tunnel/firewall/types_windows.go index 991147cba..54e2aad73 100644 --- a/tunnel/firewall/types_windows.go +++ b/tunnel/firewall/types_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/types_windows_32.go b/tunnel/firewall/types_windows_32.go index 735146703..29ae553ae 100644 --- a/tunnel/firewall/types_windows_32.go +++ b/tunnel/firewall/types_windows_32.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/types_windows_64.go b/tunnel/firewall/types_windows_64.go index b6c48b59e..a476a7455 100644 --- a/tunnel/firewall/types_windows_64.go +++ b/tunnel/firewall/types_windows_64.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/firewall/types_windows_test.go b/tunnel/firewall/types_windows_test.go index cbb73b5c2..afa1988f6 100644 --- a/tunnel/firewall/types_windows_test.go +++ b/tunnel/firewall/types_windows_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package firewall diff --git a/tunnel/interfacewatcher.go b/tunnel/interfacewatcher.go index b26d71dee..a831d06e4 100644 --- a/tunnel/interfacewatcher.go +++ b/tunnel/interfacewatcher.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel diff --git a/tunnel/mtumonitor.go b/tunnel/mtumonitor.go index 766ca1b8d..c07823a24 100644 --- a/tunnel/mtumonitor.go +++ b/tunnel/mtumonitor.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel diff --git a/tunnel/pitfalls.go b/tunnel/pitfalls.go index 6ac0f7252..fdef6eb21 100644 --- a/tunnel/pitfalls.go +++ b/tunnel/pitfalls.go @@ -1,18 +1,18 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel import ( "log" + "net/netip" "strings" "unsafe" "golang.org/x/sys/windows" "golang.org/x/sys/windows/svc/mgr" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/windows/conf" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" ) diff --git a/tunnel/scriptrunner.go b/tunnel/scriptrunner.go index 450d8e21e..eb97d98d2 100644 --- a/tunnel/scriptrunner.go +++ b/tunnel/scriptrunner.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel diff --git a/tunnel/service.go b/tunnel/service.go index 3ab52932e..709b16101 100644 --- a/tunnel/service.go +++ b/tunnel/service.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package tunnel diff --git a/tunnel/winipcfg/interface_change_handler.go b/tunnel/winipcfg/interface_change_handler.go index 4d229e78e..af29801af 100644 --- a/tunnel/winipcfg/interface_change_handler.go +++ b/tunnel/winipcfg/interface_change_handler.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/luid.go b/tunnel/winipcfg/luid.go index 744fee627..0c898b89a 100644 --- a/tunnel/winipcfg/luid.go +++ b/tunnel/winipcfg/luid.go @@ -1,16 +1,15 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg import ( "errors" + "net/netip" "strings" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" ) diff --git a/tunnel/winipcfg/mksyscall.go b/tunnel/winipcfg/mksyscall.go index e9e06676e..d62d38df9 100644 --- a/tunnel/winipcfg/mksyscall.go +++ b/tunnel/winipcfg/mksyscall.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/netsh.go b/tunnel/winipcfg/netsh.go index 17e0778c7..4f8e5b138 100644 --- a/tunnel/winipcfg/netsh.go +++ b/tunnel/winipcfg/netsh.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg @@ -10,13 +10,12 @@ import ( "errors" "fmt" "io" + "net/netip" "os/exec" "path/filepath" "strings" "syscall" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" "golang.org/x/sys/windows/registry" ) diff --git a/tunnel/winipcfg/route_change_handler.go b/tunnel/winipcfg/route_change_handler.go index 75dcf82c4..4b78331e0 100644 --- a/tunnel/winipcfg/route_change_handler.go +++ b/tunnel/winipcfg/route_change_handler.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go index 04510bea9..8e8f4a590 100644 --- a/tunnel/winipcfg/types.go +++ b/tunnel/winipcfg/types.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg @@ -8,11 +8,10 @@ package winipcfg import ( "encoding/binary" "fmt" + "net/netip" "strconv" "unsafe" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" ) diff --git a/tunnel/winipcfg/types_32.go b/tunnel/winipcfg/types_32.go index f22b0539e..1a8d44434 100644 --- a/tunnel/winipcfg/types_32.go +++ b/tunnel/winipcfg/types_32.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/types_64.go b/tunnel/winipcfg/types_64.go index fdf7034a4..3a1fe07fb 100644 --- a/tunnel/winipcfg/types_64.go +++ b/tunnel/winipcfg/types_64.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/types_test.go b/tunnel/winipcfg/types_test.go index d749325a3..b72d73f53 100644 --- a/tunnel/winipcfg/types_test.go +++ b/tunnel/winipcfg/types_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/types_test_32.go b/tunnel/winipcfg/types_test_32.go index ce4f2d587..9e62bfefc 100644 --- a/tunnel/winipcfg/types_test_32.go +++ b/tunnel/winipcfg/types_test_32.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/types_test_64.go b/tunnel/winipcfg/types_test_64.go index 6bdf48f6b..8a1815756 100644 --- a/tunnel/winipcfg/types_test_64.go +++ b/tunnel/winipcfg/types_test_64.go @@ -2,7 +2,7 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/unicast_address_change_handler.go b/tunnel/winipcfg/unicast_address_change_handler.go index 517ff0370..cf4fcb3a2 100644 --- a/tunnel/winipcfg/unicast_address_change_handler.go +++ b/tunnel/winipcfg/unicast_address_change_handler.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/winipcfg.go b/tunnel/winipcfg/winipcfg.go index 558af251f..e24157b96 100644 --- a/tunnel/winipcfg/winipcfg.go +++ b/tunnel/winipcfg/winipcfg.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winipcfg diff --git a/tunnel/winipcfg/winipcfg_test.go b/tunnel/winipcfg/winipcfg_test.go index d863b1a29..b49daf338 100644 --- a/tunnel/winipcfg/winipcfg_test.go +++ b/tunnel/winipcfg/winipcfg_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ /* @@ -22,13 +22,12 @@ Some tests in this file require: package winipcfg import ( + "net/netip" "strings" "syscall" "testing" "time" - "golang.zx2c4.com/go118/netip" - "golang.org/x/sys/windows" ) @@ -65,7 +64,7 @@ func getTestInterface() (*IPAdapterAddresses, error) { marker := strings.ToLower(testInterfaceMarker) for _, ifc := range ifcs { - if strings.Index(strings.ToLower(ifc.FriendlyName()), marker) != -1 { + if strings.Contains(strings.ToLower(ifc.FriendlyName()), marker) { return ifc, nil } } diff --git a/ui/aboutdialog.go b/ui/aboutdialog.go index feee2efc6..0f939b155 100644 --- a/ui/aboutdialog.go +++ b/ui/aboutdialog.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui @@ -107,7 +107,7 @@ func runAboutDialog(owner walk.Form) error { copyrightFont, _ := walk.NewFont("Segoe UI", 7, 0) copyrightLbl.SetFont(copyrightFont) copyrightLbl.SetTextAlignment(walk.AlignHCenterVNear) - copyrightLbl.SetText("Copyright © 2015-2021 Jason A. Donenfeld. All Rights Reserved.") + copyrightLbl.SetText("Copyright © 2015-2022 Jason A. Donenfeld. All Rights Reserved.") buttonCP, err := walk.NewComposite(showingAboutDialog) if err != nil { diff --git a/ui/confview.go b/ui/confview.go index 824baf7f9..e55c7d2bc 100644 --- a/ui/confview.go +++ b/ui/confview.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/editdialog.go b/ui/editdialog.go index 4a7383d11..45b25fd07 100644 --- a/ui/editdialog.go +++ b/ui/editdialog.go @@ -1,15 +1,14 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui import ( + "net/netip" "strings" - "golang.zx2c4.com/go118/netip" - "github.com/lxn/walk" "github.com/lxn/win" "golang.org/x/sys/windows" diff --git a/ui/filesave.go b/ui/filesave.go index 63f50dd5e..3a54f0155 100644 --- a/ui/filesave.go +++ b/ui/filesave.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/iconprovider.go b/ui/iconprovider.go index 18db0eaa7..154a16289 100644 --- a/ui/iconprovider.go +++ b/ui/iconprovider.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/listview.go b/ui/listview.go index 428d8330f..609feb40a 100644 --- a/ui/listview.go +++ b/ui/listview.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui @@ -32,7 +32,7 @@ func (t *ListModel) RowCount() int { return len(t.tunnels) } -func (t *ListModel) Value(row, col int) interface{} { +func (t *ListModel) Value(row, col int) any { if col != 0 || row < 0 || row >= len(t.tunnels) { return "" } diff --git a/ui/logpage.go b/ui/logpage.go index 17c3c8f01..5b7681b34 100644 --- a/ui/logpage.go +++ b/ui/logpage.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui @@ -216,6 +216,6 @@ func newLogModel(lp *LogPage) *logModel { return mdl } -func (mdl *logModel) Items() interface{} { +func (mdl *logModel) Items() any { return mdl.items } diff --git a/ui/managewindow.go b/ui/managewindow.go index d02e223a4..30a1cedc9 100644 --- a/ui/managewindow.go +++ b/ui/managewindow.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/raise.go b/ui/raise.go index c402bea79..3cea8a884 100644 --- a/ui/raise.go +++ b/ui/raise.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/syntax/highlighter.go b/ui/syntax/highlighter.go index abf6846dd..d52b9a4e8 100644 --- a/ui/syntax/highlighter.go +++ b/ui/syntax/highlighter.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. * * This is a direct translation of the original C, and for that reason, it's pretty unusual Go code: * https://git.zx2c4.com/wireguard-tools/tree/contrib/highlighter/highlighter.c diff --git a/ui/syntax/syntaxedit.go b/ui/syntax/syntaxedit.go index 2fbf0343e..e5c0fa082 100644 --- a/ui/syntax/syntaxedit.go +++ b/ui/syntax/syntaxedit.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package syntax @@ -478,10 +478,10 @@ func NewSyntaxEdit(parent walk.Container) (*SyntaxEdit, error) { se.GraphicsEffects().Add(walk.InteractionEffect) se.GraphicsEffects().Add(walk.FocusEffect) se.MustRegisterProperty("Text", walk.NewProperty( - func() interface{} { + func() any { return se.Text() }, - func(v interface{}) error { + func(v any) error { if s, ok := v.(string); ok { return se.SetText(s) } diff --git a/ui/tray.go b/ui/tray.go index f5765f8a5..7771c966e 100644 --- a/ui/tray.go +++ b/ui/tray.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go index 4c687a399..d104f5985 100644 --- a/ui/tunnelspage.go +++ b/ui/tunnelspage.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/ui.go b/ui/ui.go index 7f82e7aec..569fc8aec 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/ui/updatepage.go b/ui/updatepage.go index 96fc87f35..ff2bbe5f8 100644 --- a/ui/updatepage.go +++ b/ui/updatepage.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui diff --git a/updater/authenticode.go b/updater/authenticode.go index fc8691f30..1e0a25c03 100644 --- a/updater/authenticode.go +++ b/updater/authenticode.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/constants.go b/updater/constants.go index 04b972fed..cf0ced92f 100644 --- a/updater/constants.go +++ b/updater/constants.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/downloader.go b/updater/downloader.go index b8b2763d1..bf28db544 100644 --- a/updater/downloader.go +++ b/updater/downloader.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/msirunner.go b/updater/msirunner.go index c68fdce79..ec6b1bd3d 100644 --- a/updater/msirunner.go +++ b/updater/msirunner.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/signify.go b/updater/signify.go index eef9198ae..de50fcba0 100644 --- a/updater/signify.go +++ b/updater/signify.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater @@ -53,17 +53,17 @@ func readFileList(input []byte) (fileList, error) { if len(line) == 0 && index == len(fileLines)-1 { break } - components := strings.SplitN(line, " ", 2) - if len(components) != 2 { + first, second, ok := strings.Cut(line, " ") + if !ok { return nil, errors.New("File hash line has too few components") } - maybeHash, err := hex.DecodeString(components[0]) + maybeHash, err := hex.DecodeString(first) if err != nil || len(maybeHash) != blake2b.Size256 { return nil, errors.New("File hash is invalid base64 or incorrect number of bytes") } var hash [blake2b.Size256]byte copy(hash[:], maybeHash) - fileHashes[components[1]] = hash + fileHashes[second] = hash } if len(fileHashes) == 0 { return nil, errors.New("No file hashes found in signed input") diff --git a/updater/updater_test.go b/updater/updater_test.go index a90b13cb5..809262bd3 100644 --- a/updater/updater_test.go +++ b/updater/updater_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/versions.go b/updater/versions.go index 5b42a748e..dfc4c6659 100644 --- a/updater/versions.go +++ b/updater/versions.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package updater diff --git a/updater/winhttp/mksyscall.go b/updater/winhttp/mksyscall.go index 1daedb08c..54c06e85d 100644 --- a/updater/winhttp/mksyscall.go +++ b/updater/winhttp/mksyscall.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winhttp diff --git a/updater/winhttp/syscall_windows.go b/updater/winhttp/syscall_windows.go index 90a5daeaa..4f967bfa6 100644 --- a/updater/winhttp/syscall_windows.go +++ b/updater/winhttp/syscall_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winhttp diff --git a/updater/winhttp/winhttp.go b/updater/winhttp/winhttp.go index 44ba44db6..cb19f1946 100644 --- a/updater/winhttp/winhttp.go +++ b/updater/winhttp/winhttp.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winhttp diff --git a/updater/winhttp/winhttp_test.go b/updater/winhttp/winhttp_test.go index 41fbeb6b3..36017a483 100644 --- a/updater/winhttp/winhttp_test.go +++ b/updater/winhttp/winhttp_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package winhttp diff --git a/version/certificate_test.go b/version/certificate_test.go index 677e6fdc4..724c524f0 100644 --- a/version/certificate_test.go +++ b/version/certificate_test.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package version diff --git a/version/official.go b/version/official.go index 250df76fa..2951c893b 100644 --- a/version/official.go +++ b/version/official.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package version diff --git a/version/os.go b/version/os.go index fd6ae4751..ff9188bb2 100644 --- a/version/os.go +++ b/version/os.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package version diff --git a/version/useragent.go b/version/useragent.go index 698e185b9..3b5240c60 100644 --- a/version/useragent.go +++ b/version/useragent.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package version diff --git a/version/version.go b/version/version.go index 3208aacdf..a7f908e8c 100644 --- a/version/version.go +++ b/version/version.go @@ -1,10 +1,10 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package version const ( - Number = "0.5.2" + Number = "0.5.3" )