diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index fc5365a99..df00ebac0 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -180,11 +180,6 @@ var genConfigCmd = &cobra.Command{ } } - // Check os to set bin_path address - if selectedOS == "windows" { - conf.Launcher.BinPath = "C:\\Program Files\\Skywire" - } - // Read in old config (if any) and obtain old hypervisors. if replaceHypervisors { if oldConf, ok := readOldConfig(mLog, output, true); ok { diff --git a/internal/gui/gui.go b/internal/gui/gui.go index 111fe2c70..b1b0fb3ac 100644 --- a/internal/gui/gui.go +++ b/internal/gui/gui.go @@ -4,7 +4,6 @@ package gui import ( - "context" "embed" "fmt" "io" @@ -20,7 +19,6 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/toqueteos/webbrowser" - "github.com/skycoin/skywire/pkg/servicedisc" "github.com/skycoin/skywire/pkg/skyenv" "github.com/skycoin/skywire/pkg/visor/visorconfig" ) @@ -193,25 +191,25 @@ func handleVPNLinkButton(conf *visorconfig.V1) { } // GetAvailPublicVPNServers gets all available public VPN server from service discovery URL -func GetAvailPublicVPNServers(conf *visorconfig.V1) []string { - sdClient := servicedisc.NewClient(log, servicedisc.Config{ - Type: servicedisc.ServiceTypeVPN, - PK: conf.PK, - SK: conf.SK, - DiscAddr: conf.Launcher.ServiceDisc, - }) - //ctx, _ := context.WithTimeout(context.Background(), 7*time.Second) - vpnServers, err := sdClient.Services(context.Background(), 0) - if err != nil { - log.Error("Error getting public vpn servers: ", err) - return nil - } - serverAddrs := make([]string, len(vpnServers)) - for idx, server := range vpnServers { - serverAddrs[idx] = server.Addr.PubKey().String() - } - return serverAddrs -} +// func GetAvailPublicVPNServers(conf *visorconfig.V1) []string { +// sdClient := servicedisc.NewClient(log, servicedisc.Config{ +// Type: servicedisc.ServiceTypeVPN, +// PK: conf.PK, +// SK: conf.SK, +// DiscAddr: conf.Launcher.ServiceDisc, +// }) +// //ctx, _ := context.WithTimeout(context.Background(), 7*time.Second) +// vpnServers, err := sdClient.Services(context.Background(), 0) +// if err != nil { +// log.Error("Error getting public vpn servers: ", err) +// return nil +// } +// serverAddrs := make([]string, len(vpnServers)) +// for idx, server := range vpnServers { +// serverAddrs[idx] = server.Addr.PubKey().String() +// } +// return serverAddrs +// } func initUninstallBtn() { if !checkIsPackage() { diff --git a/pkg/visor/api.go b/pkg/visor/api.go index fbfc69c7f..a1f63e3e6 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -3,6 +3,7 @@ package visor import ( "context" "encoding/hex" + "errors" "fmt" "io" "os" @@ -316,6 +317,10 @@ func (v *Visor) StartApp(appName string) error { if err != nil { return err } + + if v.GetVPNClientAddress() == "" { + return errors.New("VPN server pub key is missing") + } } return v.appL.StartApp(appName, nil, envs) @@ -807,3 +812,17 @@ func (v *Visor) GetPersistentTransports() ([]transport.PersistentTransports, err func (v *Visor) SetPublicAutoconnect(pAc bool) error { return v.conf.UpdatePublicAutoconnect(pAc) } + +// GetVPNClientAddress get PK address of server set on vpn-client +func (v *Visor) GetVPNClientAddress() string { + for _, v := range v.conf.Launcher.Apps { + if v.Name == skyenv.VPNClientName { + for index := range v.Args { + if v.Args[index] == "-srv" { + return v.Args[index+1] + } + } + } + } + return "" +} diff --git a/scripts/win_installer/script.ps1 b/scripts/win_installer/script.ps1 index 13ab29adc..da988d36d 100644 --- a/scripts/win_installer/script.ps1 +++ b/scripts/win_installer/script.ps1 @@ -1,5 +1,6 @@ echo "Building Systray Windows Binaries..." if (Test-Path ".\skywire.msi") { Remove-Item ".\skywire.msi" -Recurse -Force} +if (Test-Path ".\wintun.zip") { Remove-Item ".\wintun.zip" -Recurse -Force} make build-systray-windows > $null echo "Build Complete!" echo "Setting go-msi configuration..." @@ -12,6 +13,11 @@ mv ..\..\apps\vpn-client .\build\amd64\apps\vpn-client.exe rm ..\..\setup-node.exe rm -r -fo ..\..\apps cp skywire.bat .\build\amd64\skywire.bat +curl "https://www.wintun.net/builds/wintun-0.14.1.zip" -o wintun.zip +tar -xf wintun.zip +cp .\wintun\bin\amd64\wintun.dll .\build\amd64\wintun.dll +rm -r -fo wintun +rm wintun.zip echo "Configuration complete!" echo "Building msi..." go-msi make --msi skywire.msi --version 0.5.1 --arch amd64 diff --git a/scripts/win_installer/skywire.bat b/scripts/win_installer/skywire.bat index 21f415633..cf42da824 100644 --- a/scripts/win_installer/skywire.bat +++ b/scripts/win_installer/skywire.bat @@ -1,9 +1,14 @@ @Echo Off %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit cd /d "%~dp0" -if not exist "apps\" ( - mkdir apps - move vpn-client.exe apps +if exist vpn-client.exe ( + if not exist "apps\" ( + mkdir apps + ) + move /Y vpn-client.exe apps +) +if exist "wintun.dll" ( + move /Y wintun.dll "C:\Windows\System32" ) if not exist "%HOMEPATH%\skywire-config.json" ( skywire-cli config gen -biro "%HOMEPATH%\skywire-config.json" --os windows --disable-apps skychat,skysocks,skysocks-client,vpn-server diff --git a/scripts/win_installer/wix.json b/scripts/win_installer/wix.json index ef667d0a2..6feef61d8 100644 --- a/scripts/win_installer/wix.json +++ b/scripts/win_installer/wix.json @@ -9,7 +9,8 @@ "build/amd64/skywire-visor.exe", "build/amd64/apps/vpn-client.exe", "build/amd64/skywire.bat", - "ico.ico" + "ico.ico", + "build/amd64/wintun.dll" ] }, "env": {