mirror of
https://github.com/amnezia-vpn/amneziawg-windows-client.git
synced 2026-07-03 14:05:10 +02:00
Compare commits
23 Commits
sync-fixes
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| e628cbd609 | |||
| c9740b17ad | |||
| d4498cf46a | |||
| 8e0e378414 | |||
| d2567418e9 | |||
| 54fa022e2c | |||
| 7c15281ef5 | |||
| 0d4a326a42 | |||
| c7feda5200 | |||
| 9b0947bab2 | |||
| 07aa1d2256 | |||
| fdcd8ebc7a | |||
| 32ca5b77bc | |||
| 3f898ed0f5 | |||
| e20bacac0f | |||
| 0a0e995735 | |||
| 0ed31be796 | |||
| 301b4cc067 | |||
| 1eec79f681 | |||
| 26ccea78a4 | |||
| fb42168fbb | |||
| a9cee076bc | |||
| d8c67fab86 |
@@ -0,0 +1,26 @@
|
||||
name: build7
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build7:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run build
|
||||
run: build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: run installer build
|
||||
run: installer/build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: upload installer artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installer artifacts
|
||||
path: installer/dist/**
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,26 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run build
|
||||
shell: cmd
|
||||
run: build.bat
|
||||
|
||||
- name: run installer build
|
||||
shell: cmd
|
||||
run: installer/build.bat
|
||||
|
||||
- name: upload installer artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installer artifacts
|
||||
path: installer/dist/**
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,64 @@
|
||||
name: release7
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release7:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: prepare version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(grep 'Number = "' version/version.go | sed 's/.*Number = "\(.*\)"/\1/')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: prepare sign
|
||||
env:
|
||||
SIGN_PFX_BASE64: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_BAT_BASE64: ${{ secrets.SIGN_BAT_BASE64 }}
|
||||
run: |
|
||||
echo $SIGN_PFX_BASE64 | base64 --decode > sign.pfx
|
||||
echo $SIGN_BAT_BASE64 | base64 --decode > sign.bat
|
||||
shell: bash
|
||||
|
||||
- name: prepare installer sign
|
||||
env:
|
||||
SIGN_PFX_BASE64: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_BAT_BASE64: ${{ secrets.SIGN_BAT_BASE64 }}
|
||||
run: |
|
||||
echo $SIGN_PFX_BASE64 | base64 --decode > installer/sign.pfx
|
||||
echo $SIGN_BAT_BASE64 | base64 --decode > installer/sign.bat
|
||||
shell: bash
|
||||
|
||||
- name: prepare signtool
|
||||
run: |
|
||||
$signtoolExe = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Recurse -Filter signtool.exe | Where-Object { $_.DirectoryName -match "\\x64$" } | Select-Object -First 1
|
||||
$signtoolPath = $signtoolExe.DirectoryName
|
||||
echo "Adding $signtoolPath to PATH"
|
||||
echo "$signtoolPath" >> $env:GITHUB_PATH
|
||||
shell: pwsh
|
||||
|
||||
- name: run build
|
||||
run: build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: run installer build
|
||||
run: installer/build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: prepare release
|
||||
id: get_release_tag
|
||||
uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
latest: true
|
||||
|
||||
- name: update release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: installer/dist/**
|
||||
tag_name: ${{steps.get_release_tag.outputs.tag_name}}
|
||||
@@ -0,0 +1,59 @@
|
||||
name: sign-build7
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sign-build7:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: prepare version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(grep 'Number = "' version/version.go | sed 's/.*Number = "\(.*\)"/\1/')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: prepare sign
|
||||
env:
|
||||
SIGN_PFX_BASE64: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_BAT_BASE64: ${{ secrets.SIGN_BAT_BASE64 }}
|
||||
run: |
|
||||
echo $SIGN_PFX_BASE64 | base64 --decode > sign.pfx
|
||||
echo $SIGN_BAT_BASE64 | base64 --decode > sign.bat
|
||||
shell: bash
|
||||
|
||||
- name: prepare installer sign
|
||||
env:
|
||||
SIGN_PFX_BASE64: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_BAT_BASE64: ${{ secrets.SIGN_BAT_BASE64 }}
|
||||
run: |
|
||||
echo $SIGN_PFX_BASE64 | base64 --decode > installer/sign.pfx
|
||||
echo $SIGN_BAT_BASE64 | base64 --decode > installer/sign.bat
|
||||
shell: bash
|
||||
|
||||
- name: prepare signtool
|
||||
run: |
|
||||
$signtoolExe = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Recurse -Filter signtool.exe | Where-Object { $_.DirectoryName -match "\\x64$" } | Select-Object -First 1
|
||||
$signtoolPath = $signtoolExe.DirectoryName
|
||||
echo "Adding $signtoolPath to PATH"
|
||||
echo "$signtoolPath" >> $env:GITHUB_PATH
|
||||
shell: pwsh
|
||||
|
||||
- name: run build
|
||||
run: build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: run installer build
|
||||
run: installer/build7.bat
|
||||
shell: cmd
|
||||
|
||||
- name: upload installer artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installer artifacts
|
||||
path: installer/dist/**
|
||||
retention-days: 7
|
||||
@@ -18,6 +18,7 @@ In addition to this [`README.md`](README.md), the following documents are also a
|
||||
- [`buildrun.md`](docs/buildrun.md) – Instructions on building, localizing, running, and developing for this repository.
|
||||
- [`enterprise.md`](docs/enterprise.md) – A summary of various features and tips for making the application usable in enterprise settings.
|
||||
- [`netquirk.md`](docs/netquirk.md) – A description of various networking quirks and "kill-switch" semantics.
|
||||
- [`userregistry.md`](docs/userregistry.md) – A list of registry keys settable by the user for changing the behavior of the application.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ 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.22.12.windows-amd64.zip 2ceda04074eac51f4b0b85a9fcca38bcd49daee24bed9ea1f29958a8e22673a6 || goto :error
|
||||
call :download go.zip https://go.dev/dl/go1.24.4.windows-amd64.zip b751a1136cb9d8a2e7ebb22c538c4f02c09b98138c7c8bfb78a54a4566c013b1 || goto :error
|
||||
call :download llvm-mingw-20231128-ucrt-x86_64.zip https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-x86_64.zip 7a344dafa6942de2c1f4643b3eb5c5ce5317fbab671a887e4d39f326b331798f || goto :error
|
||||
rem Mirror of https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip
|
||||
call :download imagemagick.zip https://download.wireguard.com/windows-toolchain/distfiles/ImageMagick-7.0.8-42-portable-Q16-x64.zip 584e069f56456ce7dde40220948ff9568ac810688c892c5dfb7f6db902aa05aa "convert.exe colors.xml delegates.xml" || goto :error
|
||||
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 amneziawg-tools.zip https://github.com/amnezia-vpn/amneziawg-tools/archive/v1.0.20241018.zip 5141a7d1f2f6d85aa4a12f516b723655b08af2c1d118c0a27fd385d4eb11dec1 "--exclude wg-quick --strip-components 1" || goto :error
|
||||
call :download amneziawg-tools.zip https://github.com/amnezia-vpn/amneziawg-tools/archive/v1.0.20250903.zip 086e0597906fd720ed83991716e77a8794ab750b9ccff8f153c7c05073d0b40c "--exclude wg-quick --strip-components 1" || goto :error
|
||||
call :download wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip 07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51 || goto :error
|
||||
copy /y NUL prepared > NUL || goto :error
|
||||
cd .. || goto :error
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
@echo off
|
||||
rem SPDX-License-Identifier: MIT
|
||||
rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved.
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
set BUILDDIR=%~dp0
|
||||
set PATH=%BUILDDIR%.deps\llvm-mingw-20231128-ucrt-x86_64\bin;%BUILDDIR%.deps\go-legacy-win7\bin;%BUILDDIR%.deps;%PATH%
|
||||
set PATHEXT=.exe
|
||||
cd /d %BUILDDIR% || exit /b 1
|
||||
|
||||
if exist .deps\prepared goto :render
|
||||
:installdeps
|
||||
rmdir /s /q .deps 2> NUL
|
||||
mkdir .deps || goto :error
|
||||
cd .deps || goto :error
|
||||
call :download go-legacy-win7.zip https://github.com/thongtech/go-legacy-win7/releases/download/v1.24.4-1/go-legacy-win7-1.24.4-1.windows_amd64.zip 321a11edf2083434ba95562fb5592e3159907a25396478e5aef5b018d657ac24 || goto :error
|
||||
call :download llvm-mingw-20231128-ucrt-x86_64.zip https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-x86_64.zip 7a344dafa6942de2c1f4643b3eb5c5ce5317fbab671a887e4d39f326b331798f || goto :error
|
||||
rem Mirror of https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip
|
||||
call :download imagemagick.zip https://download.wireguard.com/windows-toolchain/distfiles/ImageMagick-7.0.8-42-portable-Q16-x64.zip 584e069f56456ce7dde40220948ff9568ac810688c892c5dfb7f6db902aa05aa "convert.exe colors.xml delegates.xml" || goto :error
|
||||
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 amneziawg-tools.zip https://github.com/amnezia-vpn/amneziawg-tools/archive/v1.0.20250903.zip 086e0597906fd720ed83991716e77a8794ab750b9ccff8f153c7c05073d0b40c "--exclude wg-quick --strip-components 1" || goto :error
|
||||
call :download wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip 07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51 || goto :error
|
||||
copy /y NUL prepared > NUL || goto :error
|
||||
cd .. || goto :error
|
||||
|
||||
:render
|
||||
echo [+] Rendering icons
|
||||
for %%a in ("ui\icon\*.svg") do convert -background none "%%~fa" -define icon:auto-resize="256,192,128,96,64,48,40,32,24,20,16" -compress zip "%%~dpna.ico" || goto :error
|
||||
|
||||
:build
|
||||
git apply windows7-update.patch
|
||||
for /f "tokens=3" %%a in ('findstr /r "Number.*=.*[0-9.]*" .\version\version.go') do set WIREGUARD_VERSION=%%a
|
||||
set WIREGUARD_VERSION=%WIREGUARD_VERSION:"=%
|
||||
for /f "tokens=1-4" %%a in ("%WIREGUARD_VERSION:.= % 0 0 0") do set WIREGUARD_VERSION_ARRAY=%%a,%%b,%%c,%%d
|
||||
set GOOS=windows
|
||||
set GOARM=7
|
||||
set GOPATH=%BUILDDIR%.deps\gopath
|
||||
set GOROOT=%BUILDDIR%.deps\go-legacy-win7
|
||||
if "%GoGenerate%"=="yes" (
|
||||
echo [+] Regenerating files
|
||||
go generate ./... || exit /b 1
|
||||
)
|
||||
call :build_plat x86 i686 386 || goto :error
|
||||
call :build_plat amd64 x86_64 amd64 || goto :error
|
||||
call :build_plat arm64 aarch64 arm64 || goto :error
|
||||
|
||||
:sign
|
||||
if exist .\sign.bat call .\sign.bat
|
||||
if "%SigningProvider%"=="" goto :success
|
||||
if "%TimestampServer%"=="" goto :success
|
||||
echo [+] Signing
|
||||
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\amneziawg.exe x86\awg.exe amd64\amneziawg.exe amd64\awg.exe arm64\amneziawg.exe arm64\awg.exe || goto :error
|
||||
|
||||
:success
|
||||
echo [+] Success. Launch amneziawg.exe.
|
||||
exit /b 0
|
||||
|
||||
:download
|
||||
echo [+] Downloading %1
|
||||
curl -#fLo %1 %2 || exit /b 1
|
||||
echo [+] Verifying %1
|
||||
for /f %%a in ('CertUtil -hashfile %1 SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="%~3" exit /b 1
|
||||
echo [+] Extracting %1
|
||||
tar -xf %1 %~4 || exit /b 1
|
||||
echo [+] Cleaning up %1
|
||||
del %1 || exit /b 1
|
||||
goto :eof
|
||||
|
||||
:build_plat
|
||||
set GOARCH=%~3
|
||||
mkdir %1 >NUL 2>&1
|
||||
echo [+] Assembling resources %1
|
||||
%~2-w64-mingw32-windres -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 -buildvcs=false -v -o "%~1\amneziawg.exe" || exit /b 1
|
||||
if not exist "%~1\awg.exe" (
|
||||
echo [+] Building command line tools %1
|
||||
del .deps\src\*.exe .deps\src\*.o .deps\src\wincompat\*.o .deps\src\wincompat\*.lib 2> NUL
|
||||
set LDFLAGS=-s
|
||||
make --no-print-directory -C .deps\src PLATFORM=windows CC=%~2-w64-mingw32-gcc WINDRES=%~2-w64-mingw32-windres V=1 RUNSTATEDIR= SYSTEMDUNITDIR= -j%NUMBER_OF_PROCESSORS% || exit /b 1
|
||||
move /Y .deps\src\wg.exe "%~1\awg.exe" > NUL || exit /b 1
|
||||
)
|
||||
if not exist "%~1\wintun.dll" (
|
||||
copy /Y ".deps\wintun\bin\%~1\wintun.dll" "%~1\wintun.dll" > NUL || exit /b 1
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:error
|
||||
echo [-] Failed with error #%errorlevel%.
|
||||
cmd /c exit %errorlevel%
|
||||
@@ -0,0 +1,10 @@
|
||||
# Registry Keys for Users
|
||||
|
||||
#### `HKCU\Software\AmneziaWG\Language`
|
||||
|
||||
When this key is set, the UI will try to use the specified language as display language.
|
||||
Supported languages: "ca", "cs", "de", "en", "es_ES", "et", "fa", "fi", "fr", "id", "it", "ja", "ko", "nl", "pa_IN", "pl", "pt_BR", "ro", "ru", "si_LK", "sk", "sl", "sv_SE", "tr", "uk", "vi", "zh_CN", "zh_TW".
|
||||
|
||||
```
|
||||
> reg add HKCU\Software\AmneziaWG /v Language /t REG_SZ /d "en" /f
|
||||
```
|
||||
@@ -1,23 +1,23 @@
|
||||
module github.com/amnezia-vpn/amneziawg-windows-client
|
||||
|
||||
go 1.22.3
|
||||
go 1.24.4
|
||||
|
||||
require (
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.12
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.4-0.20240526104134-db18f2297e5e
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.18
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.9
|
||||
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
|
||||
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
|
||||
golang.org/x/crypto v0.21.0
|
||||
golang.org/x/sys v0.18.0
|
||||
golang.org/x/text v0.14.0
|
||||
golang.org/x/crypto v0.42.0
|
||||
golang.org/x/sys v0.36.0
|
||||
golang.org/x/text v0.29.0
|
||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/tevino/abool/v2 v2.1.0 // indirect
|
||||
golang.org/x/mod v0.8.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
golang.org/x/mod v0.28.0 // indirect
|
||||
golang.org/x/net v0.44.0 // indirect
|
||||
golang.org/x/sync v0.17.0 // indirect
|
||||
golang.org/x/tools v0.37.0 // indirect
|
||||
)
|
||||
|
||||
replace (
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.12 h1:CxIQETy5kZ0ip/dFBpmnDxAcS/KuIQaJkOxDv5OQhVI=
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.12/go.mod h1:d7WpNfzCRLy7ufGElJBYpD58WRmNjyLyt3IDHPY8AmM=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.4-0.20240526104134-db18f2297e5e h1:pLoZBHiMDKdGScjrcX6q/yIwm8JDzCVo805H33+8Crg=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.4-0.20240526104134-db18f2297e5e/go.mod h1:3lkvRI7XTPifPvnAyNoI8eLjSSpKXyrnUu7KlnWlCnA=
|
||||
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
|
||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||
github.com/tevino/abool/v2 v2.1.0 h1:7w+Vf9f/5gmKT4m4qkayb33/92M+Um45F2BkHOR+L/c=
|
||||
github.com/tevino/abool/v2 v2.1.0/go.mod h1:+Lmlqk6bHDWHqN1cbxqhwEAwMPXgc8I1SDEamtseuXY=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.18 h1:pUn7/P8qdGmHd6JmE3bCQXPblZs3vruWR98nLODQLJg=
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.18/go.mod h1:aMgOk9MuX0xI7b5TKAYp8pLM54RlXcOPzDvYw3YEO5A=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.9 h1:lz/aNZkkglUpBXub76TrTybnodrNxEoJwwJghFYcVhg=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.9/go.mod h1:BdfpKW9+fZdnGpne7h8uidaheypncIQ5vG7oerRDnaw=
|
||||
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
|
||||
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
|
||||
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
|
||||
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
|
||||
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
|
||||
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
||||
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
|
||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
|
||||
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=
|
||||
golang.zx2c4.com/wireguard/windows v0.0.0-20210224134948-620c54ef6199/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
|
||||
gvisor.dev/gvisor v0.0.0-20230927004350-cbd86285d259 h1:TbRPT0HtzFP3Cno1zZo7yPzEEnfu8EjLfl6IU9VfqkQ=
|
||||
gvisor.dev/gvisor v0.0.0-20230927004350-cbd86285d259/go.mod h1:AVgIgHMwK63XvmAzWG9vLQ41YnVHN0du0tEC46fI7yY=
|
||||
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 h1:ze1vwAdliUAr68RQ5NtufWaXaOg8WUO2OACzEV+TNdE=
|
||||
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489/go.mod h1:10sU+Uh5KKNv1+2x2A0Gvzt8FjD3ASIhorV3YsauXhk=
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
@echo off
|
||||
rem SPDX-License-Identifier: MIT
|
||||
rem Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved.
|
||||
|
||||
setlocal
|
||||
set PATHEXT=.exe
|
||||
set BUILDDIR=%~dp0
|
||||
cd /d %BUILDDIR% || exit /b 1
|
||||
|
||||
for /f "tokens=3" %%a in ('findstr /r "Number.*=.*[0-9.]*" ..\version\version.go') do set WIREGUARD_VERSION=%%a
|
||||
set WIREGUARD_VERSION=%WIREGUARD_VERSION:"=%
|
||||
|
||||
set WIX_CANDLE_FLAGS=-nologo -dWIREGUARD_VERSION="%WIREGUARD_VERSION%"
|
||||
set WIX_LIGHT_FLAGS=-nologo -spdb
|
||||
set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE39
|
||||
set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE61
|
||||
set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE03
|
||||
|
||||
if exist .deps\prepared goto :build
|
||||
:installdeps
|
||||
rmdir /s /q .deps 2> NUL
|
||||
mkdir .deps || goto :error
|
||||
cd .deps || goto :error
|
||||
call :download wix-binaries.zip https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip 6ac824e1642d6f7277d0ed7ea09411a508f6116ba6fae0aa5f2c7daa2ff43d31 || goto :error
|
||||
echo [+] Extracting wix-binaries.zip
|
||||
mkdir wix\bin || goto :error
|
||||
tar -xf wix-binaries.zip -C wix\bin || goto :error
|
||||
echo [+] Cleaning up wix-binaries.zip
|
||||
del wix-binaries.zip || goto :error
|
||||
copy /y NUL prepared > NUL || goto :error
|
||||
cd .. || goto :error
|
||||
|
||||
:build
|
||||
if exist ..\sign.bat call ..\sign.bat
|
||||
set PATH=%BUILDDIR%..\.deps\llvm-mingw-20231128-ucrt-x86_64\bin;%PATH%
|
||||
set WIX=%BUILDDIR%.deps\wix\
|
||||
set CFLAGS=-O3 -Wall -std=gnu11 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -municode -DUNICODE -D_UNICODE -DNDEBUG
|
||||
set LDFLAGS=-shared -s -Wl,--kill-at -Wl,--major-os-version=6 -Wl,--minor-os-version=1 -Wl,--major-subsystem-version=6 -Wl,--minor-subsystem-version=1 -Wl,--tsaware -Wl,--dynamicbase -Wl,--nxcompat -Wl,--export-all-symbols
|
||||
set LDLIBS=-lmsi -lole32 -lshlwapi -lshell32 -luuid -lntdll
|
||||
call :msi x86 i686 x86 || goto :error
|
||||
call :msi amd64 x86_64 x64 || goto :error
|
||||
call :msi arm64 aarch64 arm64 || goto :error
|
||||
if "%SigningProvider%"=="" goto :success
|
||||
if "%TimestampServer%"=="" goto :success
|
||||
echo [+] Signing
|
||||
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d "AmneziaWG Setup" "dist\amneziawg-*-windows7-%WIREGUARD_VERSION%.msi" || goto :error
|
||||
|
||||
:success
|
||||
echo [+] Success.
|
||||
exit /b 0
|
||||
|
||||
:download
|
||||
echo [+] Downloading %1
|
||||
curl -#fLo %1 %2 || exit /b 1
|
||||
echo [+] Verifying %1
|
||||
for /f %%a in ('CertUtil -hashfile %1 SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="%~3" exit /b 1
|
||||
goto :eof
|
||||
|
||||
:msi
|
||||
set CC=%~2-w64-mingw32-gcc
|
||||
if not exist "%~1" mkdir "%~1"
|
||||
echo [+] Compiling %1
|
||||
%CC% %CFLAGS% %LDFLAGS% -o "%~1\customactions.dll" customactions.c %LDLIBS% || exit /b 1
|
||||
if "%SigningProvider%"=="" goto :skipsign
|
||||
if "%TimestampServer%"=="" goto :skipsign
|
||||
echo [+] Signing %1
|
||||
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d "AmneziaWG Setup Custom Actions" "%~1\customactions.dll" || exit /b 1
|
||||
:skipsign
|
||||
"%WIX%bin\candle" %WIX_CANDLE_FLAGS% -dWIREGUARD_PLATFORM="%~1" -out "%~1\wireguard.wixobj" -arch %3 wireguard.wxs || exit /b %errorlevel%
|
||||
echo [+] Linking %1
|
||||
"%WIX%bin\light" %WIX_LIGHT_FLAGS% -out "dist\amneziawg-%~1-windows7-%WIREGUARD_VERSION%.msi" "%~1\wireguard.wixobj" || exit /b %errorlevel%
|
||||
goto :eof
|
||||
|
||||
:error
|
||||
echo [-] Failed with error #%errorlevel%.
|
||||
cmd /c exit %errorlevel%
|
||||
@@ -8,11 +8,16 @@ package l18n
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/amnezia-vpn/amneziawg-windows-client/services"
|
||||
"golang.org/x/sys/windows"
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message"
|
||||
)
|
||||
|
||||
const (
|
||||
LanguageUserKey = "Language"
|
||||
)
|
||||
|
||||
var (
|
||||
printer *message.Printer
|
||||
printerLock sync.Mutex
|
||||
@@ -35,6 +40,15 @@ func prn() *message.Printer {
|
||||
|
||||
// lang returns the user preferred UI language we have most confident translation in the default catalog available.
|
||||
func lang() (tag language.Tag) {
|
||||
keyString := services.UserKeyString(LanguageUserKey)
|
||||
parseTag, err := language.Parse(keyString)
|
||||
if err == nil {
|
||||
matchTag := message.MatchLanguage(keyString)
|
||||
if parseTag == matchTag {
|
||||
tag = parseTag
|
||||
return
|
||||
}
|
||||
}
|
||||
tag = language.English
|
||||
confidence := language.No
|
||||
languages, err := windows.GetUserPreferredUILanguages(windows.MUI_LANGUAGE_NAME)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
const userRegKey = `Software\AmneziaWG`
|
||||
|
||||
var userKey registry.Key
|
||||
|
||||
func openUserKey() (registry.Key, error) {
|
||||
if userKey != 0 {
|
||||
return userKey, nil
|
||||
}
|
||||
var err error
|
||||
userKey, err = registry.OpenKey(registry.CURRENT_USER, userRegKey, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return userKey, nil
|
||||
}
|
||||
|
||||
func createUserKey() (registry.Key, error) {
|
||||
closeUserKey()
|
||||
var err error
|
||||
userKey, _, err = registry.CreateKey(registry.CURRENT_USER, userRegKey, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return userKey, nil
|
||||
}
|
||||
|
||||
func closeUserKey() {
|
||||
if userKey == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
userKey.Close()
|
||||
userKey = 0
|
||||
}
|
||||
|
||||
func UserKeyString(name string) string {
|
||||
key, err := openUserKey()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
val, _, err := key.GetStringValue(name)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
func SetUserKeyString(name string, value string) error {
|
||||
key, err := createUserKey()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closeUserKey()
|
||||
err = key.SetStringValue(name, value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+6
-1
@@ -78,7 +78,7 @@ func newEditDialog(owner walk.Form, tunnel *manager.Tunnel) (*EditDialog, error)
|
||||
dlg.SetIcon(owner.Icon())
|
||||
dlg.SetTitle(title)
|
||||
dlg.SetLayout(layout)
|
||||
dlg.SetMinMaxSize(walk.Size{500, 400}, walk.Size{0, 0})
|
||||
dlg.SetMinMaxSize(walk.Size{500, 500}, walk.Size{0, 0})
|
||||
if icon, err := loadSystemIcon("imageres", -114, 32); err == nil {
|
||||
dlg.SetIcon(icon)
|
||||
}
|
||||
@@ -152,6 +152,7 @@ func newEditDialog(owner walk.Form, tunnel *manager.Tunnel) (*EditDialog, error)
|
||||
dlg.SetCancelButton(cancelButton)
|
||||
dlg.SetDefaultButton(dlg.saveButton)
|
||||
|
||||
dlg.syntaxEdit.TextChanged().Attach(dlg.onSyntaxEditTextChanged)
|
||||
dlg.syntaxEdit.PrivateKeyChanged().Attach(dlg.onSyntaxEditPrivateKeyChanged)
|
||||
dlg.syntaxEdit.BlockUntunneledTrafficStateChanged().Attach(dlg.onBlockUntunneledTrafficStateChanged)
|
||||
dlg.syntaxEdit.SetText(dlg.config.ToWgQuick())
|
||||
@@ -312,6 +313,10 @@ func (dlg *EditDialog) onSyntaxEditPrivateKeyChanged(privateKey string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (dlg *EditDialog) onSyntaxEditTextChanged() {
|
||||
dlg.saveButton.SetEnabled(dlg.syntaxEdit.HaveErrors())
|
||||
}
|
||||
|
||||
func (dlg *EditDialog) onSaveButtonClicked() {
|
||||
newName := dlg.nameEdit.Text()
|
||||
if newName == "" {
|
||||
|
||||
+142
-10
@@ -8,7 +8,12 @@
|
||||
|
||||
package syntax
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"strconv"
|
||||
"unsafe"
|
||||
|
||||
"github.com/amnezia-vpn/amneziawg-go/device"
|
||||
)
|
||||
|
||||
type highlight int
|
||||
|
||||
@@ -33,10 +38,18 @@ const (
|
||||
highlightJmax
|
||||
highlightS1
|
||||
highlightS2
|
||||
highlightS3
|
||||
highlightS4
|
||||
highlightH1
|
||||
highlightH2
|
||||
highlightH3
|
||||
highlightH4
|
||||
highlightI1
|
||||
highlightI2
|
||||
highlightI3
|
||||
highlightI4
|
||||
highlightI5
|
||||
highlightWarning
|
||||
highlightError
|
||||
)
|
||||
|
||||
@@ -258,6 +271,10 @@ func (s stringSpan) isValidUint(supportHex bool, min, max uint64) bool {
|
||||
return val <= max && val >= min
|
||||
}
|
||||
|
||||
func (s stringSpan) isValidUint32() bool {
|
||||
return s.isValidUint(false, 0, 4_294_967_295)
|
||||
}
|
||||
|
||||
func (s stringSpan) isValidPort() bool {
|
||||
return s.isValidUint(false, 0, 65535)
|
||||
}
|
||||
@@ -365,6 +382,24 @@ func (s stringSpan) isValidNetwork() bool {
|
||||
return s.isValidIPv4() || s.isValidIPv6()
|
||||
}
|
||||
|
||||
func (s stringSpan) isValidHField() bool {
|
||||
for i := 0; i < s.len; i++ {
|
||||
if *s.at(i) == '-' {
|
||||
first := stringSpan{s.s, i}
|
||||
second := stringSpan{s.at(i + 1), s.len - i - 1}
|
||||
if first.isValidUint32() && second.isValidUint32() {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
return s.isValidUint32()
|
||||
}
|
||||
|
||||
func (s stringSpan) isValidIField() bool {
|
||||
return s.len != 0
|
||||
}
|
||||
|
||||
type field int32
|
||||
|
||||
const (
|
||||
@@ -384,10 +419,17 @@ const (
|
||||
fieldJmax
|
||||
fieldS1
|
||||
fieldS2
|
||||
fieldS3
|
||||
fieldS4
|
||||
fieldH1
|
||||
fieldH2
|
||||
fieldH3
|
||||
fieldH4
|
||||
fieldI1
|
||||
fieldI2
|
||||
fieldI3
|
||||
fieldI4
|
||||
fieldI5
|
||||
fieldPeerSection
|
||||
fieldPublicKey
|
||||
fieldPresharedKey
|
||||
@@ -449,6 +491,10 @@ func (s stringSpan) field() field {
|
||||
return fieldS1
|
||||
case s.isCaselessSame("S2"):
|
||||
return fieldS2
|
||||
case s.isCaselessSame("S3"):
|
||||
return fieldS3
|
||||
case s.isCaselessSame("S4"):
|
||||
return fieldS4
|
||||
case s.isCaselessSame("H1"):
|
||||
return fieldH1
|
||||
case s.isCaselessSame("H2"):
|
||||
@@ -457,6 +503,16 @@ func (s stringSpan) field() field {
|
||||
return fieldH3
|
||||
case s.isCaselessSame("H4"):
|
||||
return fieldH4
|
||||
case s.isCaselessSame("I1"):
|
||||
return fieldI1
|
||||
case s.isCaselessSame("I2"):
|
||||
return fieldI2
|
||||
case s.isCaselessSame("I3"):
|
||||
return fieldI3
|
||||
case s.isCaselessSame("I4"):
|
||||
return fieldI4
|
||||
case s.isCaselessSame("I5"):
|
||||
return fieldI5
|
||||
}
|
||||
return fieldInvalid
|
||||
}
|
||||
@@ -578,23 +634,37 @@ func (hsa *highlightSpanArray) highlightValue(parent, s stringSpan, section fiel
|
||||
case fieldAddress, fieldDNS, fieldAllowedIPs:
|
||||
hsa.highlightMultivalue(parent, s, section)
|
||||
case fieldJc:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 128), highlightJc))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightJc))
|
||||
case fieldJmin:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 1280), highlightJmin))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightJmin))
|
||||
case fieldJmax:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 1280), highlightJmax))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightJmax))
|
||||
case fieldS1:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 150), highlightS1))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightS1))
|
||||
case fieldS2:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 150), highlightS2))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightS2))
|
||||
case fieldS3:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightS3))
|
||||
case fieldS4:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 65_535), highlightS4))
|
||||
case fieldH1:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 2_147_483_647), highlightH1))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidHField(), highlightH1))
|
||||
case fieldH2:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 2_147_483_647), highlightH2))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidHField(), highlightH2))
|
||||
case fieldH3:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 2_147_483_647), highlightH3))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidHField(), highlightH3))
|
||||
case fieldH4:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidUint(false, 0, 2_147_483_647), highlightH4))
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidHField(), highlightH4))
|
||||
case fieldI1:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidIField(), highlightI1))
|
||||
case fieldI2:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidIField(), highlightI2))
|
||||
case fieldI3:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidIField(), highlightI3))
|
||||
case fieldI4:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidIField(), highlightI4))
|
||||
case fieldI5:
|
||||
hsa.append(parent.s, s, validateHighlight(s.isValidIField(), highlightI5))
|
||||
default:
|
||||
hsa.append(parent.s, s, highlightError)
|
||||
}
|
||||
@@ -683,3 +753,65 @@ func highlightConfig(config string) []highlightSpan {
|
||||
}
|
||||
return ([]highlightSpan)(ret)
|
||||
}
|
||||
|
||||
func highlightASecConfig(cfg string, spans []highlightSpan) {
|
||||
const (
|
||||
maxMTU = 1500
|
||||
diffMTU = 80
|
||||
)
|
||||
|
||||
var (
|
||||
mtu = 0
|
||||
jc = 0
|
||||
jmin = 0
|
||||
jmax = 0
|
||||
)
|
||||
|
||||
var err error
|
||||
|
||||
for i := range spans {
|
||||
span := &spans[i]
|
||||
switch span.t {
|
||||
case highlightError:
|
||||
return
|
||||
case highlightMTU:
|
||||
if mtu, err = strconv.Atoi(cfg[span.s : span.s+span.len]); err != nil {
|
||||
return
|
||||
}
|
||||
case highlightJc:
|
||||
if jc, err = strconv.Atoi(cfg[span.s : span.s+span.len]); err != nil {
|
||||
return
|
||||
}
|
||||
case highlightJmin:
|
||||
if jmin, err = strconv.Atoi(cfg[span.s : span.s+span.len]); err != nil {
|
||||
return
|
||||
}
|
||||
case highlightJmax:
|
||||
if jmax, err = strconv.Atoi(cfg[span.s : span.s+span.len]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if mtu == 0 {
|
||||
mtu = device.DefaultMTU
|
||||
}
|
||||
|
||||
for i := range spans {
|
||||
span := &spans[i]
|
||||
switch span.t {
|
||||
case highlightJc:
|
||||
if jc > 128 {
|
||||
span.t = highlightWarning
|
||||
}
|
||||
case highlightJmin:
|
||||
if (jc != 0 || jmin != 0 || jmax != 0) && (jmin >= jmax || jmin >= mtu+diffMTU || jmin >= maxMTU) {
|
||||
span.t = highlightWarning
|
||||
}
|
||||
case highlightJmax:
|
||||
if (jc != 0 || jmin != 0 || jmax != 0) && (jmax <= jmin || jmax > mtu+diffMTU || jmax > maxMTU) {
|
||||
span.t = highlightWarning
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ type SyntaxEdit struct {
|
||||
irich *win.IRichEditOle
|
||||
idoc *win.ITextDocument
|
||||
lastBlockState BlockState
|
||||
haveErrors bool
|
||||
yheight int
|
||||
highlightGuard uint32
|
||||
textChangedPublisher walk.EventPublisher
|
||||
@@ -72,6 +73,10 @@ func (se *SyntaxEdit) SetText(text string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (se *SyntaxEdit) HaveErrors() bool {
|
||||
return se.haveErrors
|
||||
}
|
||||
|
||||
func (se *SyntaxEdit) TextChanged() *walk.Event {
|
||||
return se.textChangedPublisher.Event()
|
||||
}
|
||||
@@ -105,6 +110,23 @@ var stylemap = map[highlight]spanStyle{
|
||||
highlightComment: {color: win.RGB(0x53, 0x65, 0x79), effects: win.CFE_ITALIC},
|
||||
highlightDelimiter: {color: win.RGB(0x00, 0x00, 0x00)},
|
||||
highlightCmd: {color: win.RGB(0x63, 0x75, 0x89)},
|
||||
highlightJc: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightJmin: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightJmax: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightS1: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightS2: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightS3: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightS4: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightH1: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightH2: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightH3: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightH4: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightI1: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightI2: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightI3: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightI4: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightI5: {color: win.RGB(0x64, 0x38, 0x20)},
|
||||
highlightWarning: {color: win.RGB(0xC4, 0x1A, 0x16), effects: win.CFE_UNDERLINE},
|
||||
highlightError: {color: win.RGB(0xC4, 0x1A, 0x16), effects: win.CFE_UNDERLINE},
|
||||
}
|
||||
|
||||
@@ -191,6 +213,18 @@ done:
|
||||
}
|
||||
}
|
||||
|
||||
func (se *SyntaxEdit) evaluateHaveErrors(spans []highlightSpan) {
|
||||
for i := range spans {
|
||||
span := &spans[i]
|
||||
switch span.t {
|
||||
case highlightError:
|
||||
se.haveErrors = false
|
||||
return
|
||||
}
|
||||
}
|
||||
se.haveErrors = true
|
||||
}
|
||||
|
||||
func (se *SyntaxEdit) highlightText() error {
|
||||
if !atomic.CompareAndSwapUint32(&se.highlightGuard, 0, 1) {
|
||||
return nil
|
||||
@@ -220,7 +254,9 @@ func (se *SyntaxEdit) highlightText() error {
|
||||
cfg := strings.Replace(string(msg[:msgCount]), "\r", "\n", -1)
|
||||
|
||||
spans := highlightConfig(cfg)
|
||||
highlightASecConfig(cfg, spans)
|
||||
se.evaluateUntunneledBlocking(cfg, spans)
|
||||
se.evaluateHaveErrors(spans)
|
||||
|
||||
se.idoc.Undo(win.TomSuspend, nil)
|
||||
win.SendMessage(hWnd, win.EM_SETEVENTMASK, 0, 0)
|
||||
|
||||
@@ -69,6 +69,7 @@ func NewTunnelsPage() (*TunnelsPage, error) {
|
||||
vlayout.SetAlignment(walk.AlignHNearVCenter)
|
||||
vlayout.SetMargins(walk.Margins{})
|
||||
tp.currentTunnelContainer.SetLayout(vlayout)
|
||||
hlayout.SetStretchFactor(tp.currentTunnelContainer, 100)
|
||||
|
||||
if tp.fillerContainer, err = walk.NewComposite(tp); err != nil {
|
||||
return nil, err
|
||||
@@ -78,6 +79,7 @@ func NewTunnelsPage() (*TunnelsPage, error) {
|
||||
vlayout.SetAlignment(walk.AlignHCenterVCenter)
|
||||
vlayout.SetMargins(walk.Margins{})
|
||||
tp.fillerContainer.SetLayout(vlayout)
|
||||
hlayout.SetStretchFactor(tp.fillerContainer, 100)
|
||||
|
||||
fillerButtonContainer, _ := walk.NewComposite(tp.fillerContainer)
|
||||
hlayout = walk.NewHBoxLayout()
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
package updater
|
||||
|
||||
const (
|
||||
releasePublicKeyBase64 = "RWRNqGKtBXftKTKPpBPGDMe8jHLnFQ0EdRy8Wg0apV6vTDFLAODD83G4"
|
||||
updateServerHost = "download.wireguard.com"
|
||||
releasePublicKeyBase64 = "RWTIu7lL938k14FQAOYx3R4MaIKLv6CmaxBI3G8zV7tbjpmqFY38l2r3"
|
||||
updateServerHost = "updates.amnezia.org"
|
||||
updateServerPort = 443
|
||||
updateServerUseHttps = true
|
||||
latestVersionPath = "/windows-client/latest.sig"
|
||||
msiPath = "/windows-client/%s"
|
||||
msiArchPrefix = "wireguard-%s-"
|
||||
latestVersionPath = "/amneziawg/windows-client/latest.sig"
|
||||
msiPath = "/amneziawg/windows-client/%s"
|
||||
msiArchPrefix = "amneziawg-%s-"
|
||||
msiSuffix = ".msi"
|
||||
)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
officialCommonName = "WireGuard LLC"
|
||||
officialCommonName = "Privacy Technologies OU"
|
||||
evPolicyOid = "2.23.140.1.3"
|
||||
policyExtensionOid = "2.5.29.32"
|
||||
)
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@
|
||||
package version
|
||||
|
||||
const (
|
||||
Number = "1.0.0"
|
||||
Number = "2.0.2"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/updater/constants.go b/updater/constants.go
|
||||
index de2572e..6d9d2d8 100644
|
||||
--- a/updater/constants.go
|
||||
+++ b/updater/constants.go
|
||||
@@ -10,8 +10,8 @@ const (
|
||||
updateServerHost = "updates.amnezia.org"
|
||||
updateServerPort = 443
|
||||
updateServerUseHttps = true
|
||||
- latestVersionPath = "/amneziawg/windows-client/latest.sig"
|
||||
+ latestVersionPath = "/amneziawg/windows-client/latest-windows7.sig"
|
||||
msiPath = "/amneziawg/windows-client/%s"
|
||||
- msiArchPrefix = "amneziawg-%s-"
|
||||
+ msiArchPrefix = "amneziawg-%s-windows7-"
|
||||
msiSuffix = ".msi"
|
||||
)
|
||||
+4551
-3299
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user