-
Notifications
You must be signed in to change notification settings - Fork 45
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
skywire-cli vpn
subcommands + separate-systray
#1317
Conversation
skywire-cli config gen
flagsskywire-cli config gen
flags + skywire-cli vpn
subcommands
working when tested with the test deployment full test ; run a visor as public on test deployment and disable the public autoconnect and use package config path
In another terminal:
If running on test deployment, the only result is likely to be the locally running visor itself. If it's possible to test with two visors, after the second visor is running, start the vpn server to its public key
to complete the test
Next for this PR I will add my systray rework. The revised systray can co-exist with the current systray and should not affect mergability of this PR |
cmd/skywire-cli/commands/vpn/vvpn.go
Outdated
"github.com/skycoin/skywire/pkg/visor" | ||
"github.com/skycoin/skywire/cmd/skywire-cli/commands/visor" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesnt appear to be your issue, but please remove the commented import.
cmd/skywire-cli/commands/vpn/vvpn.go
Outdated
"github.com/spf13/cobra" | ||
"github.com/toqueteos/webbrowser" | ||
|
||
utilenv "github.com/skycoin/skywire-utilities/pkg/skyenv" | ||
skyenv "github.com/skycoin/skywire/pkg/skyenv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be a good move to get this to skywire-utilities
repo as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the skyenv is here just getting the default name of the app binary "vpn-client"
that could be redundantly defined in skywire-utilities to avoid the import in this instance, but considering that the vpn-client app itself s defined in skycoin/skywire I think it prudent to keep it here.
cmd/skywire-cli/commands/vpn/vvpn.go
Outdated
//"github.com/skycoin/skywire-utilities/pkg/cipher" | ||
|
||
|
||
) | ||
|
||
var timeout time.Duration | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format your code please.
cmd/skywire-cli/commands/vpn/vvpn.go
Outdated
@@ -2,33 +2,47 @@ package clivpn | |||
|
|||
import ( | |||
"encoding/json" | |||
"io/ioutil" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the file name intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my reasoning behind this naming scheme is to avoid making generic names for files or imports like "vpn.go" or "package vpn" as surely these exist somewhere else in the source already, and I would not want to pollute search results for such files and package names.
Is it your suggestion to change it?
"github.com/spf13/cobra" | ||
"github.com/toqueteos/webbrowser" | ||
|
||
utilenv "github.com/skycoin/skywire-utilities/pkg/skyenv" | ||
skyenv "github.com/skycoin/skywire/pkg/skyenv" | ||
"github.com/skycoin/skywire/pkg/visor/visorconfig" | ||
clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we are naming this import here? Is RPC not fine? I dont see us importing the stdlib rpc package here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is the file name intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was an attempt to avoid confusion with any other package named rpc and specify that this is the one that is associated with or provided by the cli subcommands
that same rpc client function was in a few different files
cmd/skywire-cli/commands/vpn/vvpn.go
Outdated
network.SUDPH, | ||
network.DMSG, | ||
} | ||
for _, transportType := range transportTypes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will almost necessarily fail for most transports here. Why are we trying to establish 4 transports? In my opinion, we should leave auto transport establishment to the router module as it has a substantially better view of current transports etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the currently available cli interface; the method I have used is the same as is used by skywire-cli tp add
- sans the for loop
Is what you described provided by some other cli command currently? if so, what?
cmd/skywire-visor/commands/root.go
Outdated
@@ -262,6 +262,7 @@ func runVisor(conf *visorconfig.V1) { | |||
conf.Hypervisors = append(conf.Hypervisors, pubkey) | |||
} | |||
} | |||
fmt.Printf("%+v\n", conf.Launcher.Apps[0].Args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats this doing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was for some debugging i was doing. supposed to have been removed.
perhaps it could panic if there were no apps in the config
pkg/visor/api.go
Outdated
@@ -36,11 +36,13 @@ type API interface { | |||
|
|||
Health() (*HealthInfo, error) | |||
Uptime() (float64, error) | |||
|
|||
// QueryUptime(pubkeys []string) (*Uptime, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was something I had mosty implemented - querying the uptime from the uptime tracker for arbitrary (remote visor) keys
there was just one small bug in it that i wanted mohammad to look at.
I think this is worthwhile to have, but my original reason for needing it should be addressed by the fixes to the production deployment. So it is no longer critical, but it is something I would make a cli command specifically for...
pkg/visor/api.go
Outdated
if v.tpM == nil { | ||
return ErrTrpMangerNotAvailable | ||
} | ||
v.conf.Launcher.Apps[0].Args = []string{"-srv", pubkey} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we know the first app is the VPN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code equivalent to what we do when we call the VPN start cli command typically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was mostly adapted from the adjacent functions and the skywire cli visor app start / stop
commands
I know it's the first app for myself but there are instances where it may not even exist and then this would cause panic. Will solve that.
pkg/visor/api.go
Outdated
} | ||
return serverAddrs, nil | ||
// serverAddrs := make([]string, len(vpnServers)) | ||
// for idx, server := range vpnServers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment
skywire-cli config gen
flags + skywire-cli vpn
subcommandsskywire-cli vpn
subcommands
…tead of hardcoding index ; make format check
skywire-cli vpn
subcommandsskywire-cli vpn
subcommands + separate-systray
…list by buildinfo.Version() instead of hardcoded version by default
…kywire-cli subcommands
Merging & will open a new PR with uncommented query filtering |
We need these flags to avoid users needing to edit the .json by hand, and to integrate with package / installer configuration scripts.
Did you run
make format && make check
?yes
Changes:
skywire cli config gen -y --autoconn
skywire cli config gen -z --ispublic
test: