mirror of
https://github.com/amnezia-vpn/amneziawg-windows-client.git
synced 2026-07-03 14:05:10 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54fa022e2c | |||
| 7c15281ef5 | |||
| 0d4a326a42 | |||
| c7feda5200 | |||
| 9b0947bab2 | |||
| 07aa1d2256 | |||
| fdcd8ebc7a | |||
| 32ca5b77bc | |||
| 3f898ed0f5 |
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.16
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.8
|
||||
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.39.0
|
||||
golang.org/x/sys v0.33.0
|
||||
golang.org/x/text v0.26.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.25.0 // indirect
|
||||
golang.org/x/net v0.41.0 // indirect
|
||||
golang.org/x/sync v0.15.0 // indirect
|
||||
golang.org/x/tools v0.33.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 h1:D2T689FS6pFge+EA49fLXToEgQGO0VrQfLE3Sjmx52w=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.4/go.mod h1:yYNGWzB5ec+cpTIo4khP0EW/dm02B4XEPLW1j2gnGsA=
|
||||
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.16 h1:XY6HOq/xtqH8ZXMncRWkjFs85EKdN10NLNnw23kTpE0=
|
||||
github.com/amnezia-vpn/amneziawg-go v0.2.16/go.mod h1:nRkPpIzjCxMW8pZKXTRkpqAQVlmFJdVOGkeQSC7wbms=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.8 h1:6WX4cL6H3gAdR9v9WEpsK3GKObXWLTiM3vUKZg1+K50=
|
||||
github.com/amnezia-vpn/amneziawg-windows v0.1.8/go.mod h1:SVT5UeQz5bQLYqCfggffKZRoMCo0o1kQtoquzZLauJ8=
|
||||
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.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
|
||||
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
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.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
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.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
|
||||
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
|
||||
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=
|
||||
|
||||
+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 == "" {
|
||||
|
||||
+138
-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
|
||||
)
|
||||
|
||||
@@ -365,6 +378,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.isValidUint(false, 0, 2_147_483_647) && second.isValidUint(false, 0, 2_147_483_647) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
return s.isValidUint(false, 0, 2_147_483_647)
|
||||
}
|
||||
|
||||
func (s stringSpan) isValidIField() bool {
|
||||
return s.len != 0
|
||||
}
|
||||
|
||||
type field int32
|
||||
|
||||
const (
|
||||
@@ -384,10 +415,17 @@ const (
|
||||
fieldJmax
|
||||
fieldS1
|
||||
fieldS2
|
||||
fieldS3
|
||||
fieldS4
|
||||
fieldH1
|
||||
fieldH2
|
||||
fieldH3
|
||||
fieldH4
|
||||
fieldI1
|
||||
fieldI2
|
||||
fieldI3
|
||||
fieldI4
|
||||
fieldI5
|
||||
fieldPeerSection
|
||||
fieldPublicKey
|
||||
fieldPresharedKey
|
||||
@@ -449,6 +487,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 +499,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 +630,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 +749,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()
|
||||
|
||||
+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.1"
|
||||
Number = "1.0.2"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user