Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPN Control Buttons in Systray #1124

Merged
merged 34 commits into from
Apr 11, 2022
Merged

VPN Control Buttons in Systray #1124

merged 34 commits into from
Apr 11, 2022

Conversation

mrpalide
Copy link
Contributor

@mrpalide mrpalide commented Mar 4, 2022

Did you run make format && make check? Yes

Fixes #860

Changes:

  • Add VPN control button on systray:
    • VPN connection status
    • Select server from list
    • Connect/Disconnect button
  • Remove transport cache and get it before create route

How to test this PR:

  • Needs to install systray dependencies, follow instruction on the docs
  • make build-systray [or make build-systray-windows for Windows]
  • Run visor
    • note: In Windows machine visor should run as administrator to make routes for VPN client. But in *nix machine, please set cap_net_admin by sudo setcap 'cap_net_admin+p' ./apps/vpn-client command and run visor normal (without root permission).
  • Run VPN server on test env, and choose it from list and use/test other buttons

@mrpalide mrpalide changed the base branch from master to develop March 4, 2022 01:04
@mrpalide mrpalide changed the title VPN Control Buttons in Systray [WIP] VPN Control Buttons in Systray Mar 8, 2022
@mrpalide mrpalide changed the title [WIP] VPN Control Buttons in Systray VPN Control Buttons in Systray Mar 8, 2022
@ersonp
Copy link
Contributor

ersonp commented Mar 8, 2022

Getting this on windows, yet to test on linux

2022/03/08 18:30:24 [DESKTOP-J9DSNEK/iZzZ4H97Dz-000004] "GET http://localhost:8000/api/health HTTP/1.1" from [::1]:50461 - 404 19B in 352.3µs

internal/gui/gui.go Outdated Show resolved Hide resolved
internal/gui/gui.go Outdated Show resolved Hide resolved
@ersonp
Copy link
Contributor

ersonp commented Mar 8, 2022

 panic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                           
 [signal 0xc0000005 code=0x0 addr=0x0 pc=0xf1eda4]                                                                                                                                                                                                                                                                                                                                                                                                                   
 goroutine 203 [running]:                                                                                                                                                                                                          
 github.com/skycoin/skywire/internal/gui.stopVisor()                                                                                                                                                                                       
 D:/Code/go/skywire/internal/gui/gui.go:448 +0x44                                                                                                                                                                          
 github.com/skycoin/skywire/internal/gui.Stop()                                                                                                                                                                                            
 D:/Code/go/skywire/internal/gui/gui.go:122 +0x32                                                                                                                                                                          
 github.com/skycoin/skywire/internal/gui.handleUserInteraction(0xdd1ee6, 0xc000289b00)                                                                                                                                                     
 D:/Code/go/skywire/internal/gui/gui.go:413 +0x13b                                                                                                                                                                         
 created by github.com/skycoin/skywire/internal/gui.GetOnGUIReady.func1                                                                                                                                                                    
 D:/Code/go/skywire/internal/gui/gui.go:91 +0x125    

On using Quit from systray

@ersonp
Copy link
Contributor

ersonp commented Mar 8, 2022

make build-systray-windows builds apps without .exe extensions so it gives file does not exist error. Apps build from make build-windows work.

[2022-03-08T19:42:03+05:30] INFO [visor]: Changing vpn-client PK to "03af84a974e3f89a50c0f7f3e13507bc814127e37d3736cebaea59fa003a726dd5"
[2022-03-08T19:42:03+05:30] INFO [visor:config]: Flushing config to file. config_version="v1.1.1" filepath=".\skywire-config.json"
[2022-03-08T19:42:03+05:30] INFO [visor]: Updated vpn-client PK
[2022-03-08T19:42:03+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="509.5µs" _method="SetAppPK" _received="7:42PM" input=&{AppName:vpn-client PK:03af84a974e3f89a50c0f7f3e13507bc814127e37d3736cebaea59fa003a726dd5}
[2022-03-08T19:42:04+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="606.4224ms" _method="StartApp" _received="7:42PM" error="exec: "D:\\Code\\go\\skywire\\apps\\vpn-client": file does not exist" input=0xc00024bce0
[2022-03-08T19:42:05+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="0s" _method="GetAppConnectionsSummary" _received="7:42PM" error="no such app" input=0xc0003468b0 output=&[]

with apps built from make build-systray-windows

[2022-03-08T19:45:25+05:30] INFO [visor]: Changing vpn-client PK to "03af84a974e3f89a50c0f7f3e13507bc814127e37d3736cebaea59fa003a726dd5"
[2022-03-08T19:45:25+05:30] INFO [visor:config]: Flushing config to file. config_version="v1.1.1" filepath=".\skywire-config.json"
[2022-03-08T19:45:25+05:30] INFO [visor]: Updated vpn-client PK
[2022-03-08T19:45:25+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="1.026ms" _method="SetAppPK" _received="7:45PM" input=&{AppName:vpn-client PK:03af84a974e3f89a50c0f7f3e13507bc814127e37d3736cebaea59fa003a726dd5}
[2022-03-08T19:45:25+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="387.5145ms" _method="StartApp" _received="7:45PM" input=0xc000284000
[2022-03-08T19:45:26+05:30] INFO (STDOUT) [proc:vpn-client:470c362d9ea04a8eba51fd7195423bbe]: Connecting to VPN server 03af84a974e3f89a50c0f7f3e13507bc814127e37d3736cebaea59fa003a726dd5
[2022-03-08T19:45:26+05:30] INFO [proc_manager]: Accepted proc conn. hello="{"proc_key":"470c362d9ea04a8eba51fd7195423bbe","egress_net":"tcp","egress_addr":"127.0.0.1:58648","event_subs":{"tcp_close":true,"tcp_dial":true}}" remote=127.0.0.1:58650

with apps built from make build-windows

@ersonp
Copy link
Contributor

ersonp commented Mar 9, 2022

Running the systray on ubuntu linux has some issues

sudo ./skywire-visor -c skywire-config.json --systray

Running it with sudo doesn't give any error logs but nothing can be seen on systray. But on shutdown this warning is seen

[2022-03-09T14:01:48+05:30] INFO [2/12] [visor:shutdown:cli.listener]: Module stopped cleanly. elapsed=4.710203ms
[2022-03-09T14:01:48+05:30] INFO [1/12] [visor:shutdown:event_broadcaster]: Shutting down module...
[2022-03-09T14:01:48+05:30] INFO [1/12] [visor:shutdown:event_broadcaster]: Module stopped cleanly. elapsed=4.559321ms
[2022-03-09T14:01:48+05:30] INFO [visor:shutdown]: Shutdown complete. Goodbye!

(skywire-visor:7398): libayatana-appindicator-WARNING **: 14:01:48.575: Unable to send signal for NewStatus: The connection is closed

And when run without sudo

./skywire-visor -c skywire-config.json --systray

The this log is seen and the visor is stuck in the loop even after stopping the visor with Ctrl+C

[2022-03-09T14:05:03+05:30] INFO [1/12] [visor:shutdown:cli.listener]: Shutting down module...
2022/03/09 14:05:03 rpc.Serve: accept:accept tcp 127.0.0.1:3435: use of closed network connection
[2022-03-09T14:05:03+05:30] INFO [1/12] [visor:shutdown:cli.listener]: Module stopped cleanly. elapsed=53.279µs
[2022-03-09T14:05:03+05:30] INFO [visor:shutdown]: Shutdown complete. Goodbye!
[2022-03-09T14:05:04+05:30] INFO [systray:rpc_client]: Waiting for RPC get ready...
[2022-03-09T14:05:06+05:30] INFO [systray:rpc_client]: Waiting for RPC get ready...
[2022-03-09T14:05:08+05:30] INFO [systray:rpc_client]: Waiting for RPC get ready...

@0pcom
Copy link
Collaborator

0pcom commented Mar 9, 2022

instead of the icon being defined in /opt/skywire/icon.png for linux, I think it should be set to:
/usr/share/icons/hicolor/48x48/apps/skywire.png

that is where it currently is in the packages.

@0pcom
Copy link
Collaborator

0pcom commented Mar 9, 2022

image

The icon briefly appears in the systray and then disappears when this crashes

on archlinux / endeavourOS

internal/gui/gui.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ersonp ersonp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on Linux and Windows.

@0pcom
Copy link
Collaborator

0pcom commented Apr 11, 2022

Works for mac

image

@0pcom 0pcom self-requested a review April 11, 2022 17:48
@ersonp ersonp merged commit 0750b34 into skycoin:develop Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Systray App
3 participants