diff --git a/cmd/skywire-cli/commands/vpn/vvpn.go b/cmd/skywire-cli/commands/vpn/vvpn.go index bc0db1213f..37bc182162 100644 --- a/cmd/skywire-cli/commands/vpn/vvpn.go +++ b/cmd/skywire-cli/commands/vpn/vvpn.go @@ -15,6 +15,7 @@ import ( clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc" "github.com/skycoin/skywire/cmd/skywire-cli/internal" "github.com/skycoin/skywire/pkg/app/appserver" + "github.com/skycoin/skywire/pkg/visor" "github.com/skycoin/skywire/pkg/visor/visorconfig" ) @@ -162,6 +163,10 @@ var vpnStartCmd = &cobra.Command{ startProcess = false internal.Catch(cmd.Flags(), w.Flush()) internal.PrintOutput(cmd.Flags(), "\nRunning!", fmt.Sprintln("\nRunning!")) + ip, err := visor.GetIP() + if err == nil { + internal.PrintOutput(cmd.Flags(), fmt.Sprintf("\nYour current IP: %s", ip), fmt.Sprintf("Your current IP: %s\n", ip)) + } } if state.Status == appserver.AppStatusErrored { startProcess = false diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 38a8e0b554..03f13f226b 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -1293,7 +1293,7 @@ func getPublicIP(v *Visor, service string) (string, error) { return pIP, fmt.Errorf("provided URL is invalid: %w", err) } - pIP, err = getIP() + pIP, err = GetIP() if err != nil { <-v.stunReady if v.stunClient.PublicIP != nil { @@ -1313,7 +1313,8 @@ type ipAPI struct { PublicIP string `json:"ip_address"` } -func getIP() (string, error) { +// GetIP used for getting current IP of visor +func GetIP() (string, error) { req, err := http.Get("http://ip.skycoin.com") if err != nil { return "", err