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

add skywire-cli subcommands #1270

Merged
merged 7 commits into from
Jun 30, 2022
Merged

add skywire-cli subcommands #1270

merged 7 commits into from
Jun 30, 2022

Conversation

0pcom
Copy link
Collaborator

@0pcom 0pcom commented Jun 25, 2022

Did you run make format && make check?
yes

Fixes pull request review issue from skycoin/skybian#134 ; creating http endpoint for querying the hypervisor's public key
*re-implemented srvpk into skybian much more simply here

Changes:

  • Creates HTTP endpoint for skywire cli visor pk with skywire-cli hv srvpk
  • skywire-cli hv subcommands (see systray PR)
  • Minor restructuring of skywire-cli visor commands
  • fix api endpoints must return errors for remotevisors and vpnserverslist

How to test this PR:

Clone my fork, checkout srvpk branch and start a visor

git clone https://github.com/the-skycoin-project/skywire
cd skywire
git checkout srvpk
make run-source

start the http endpoint in a new terminal or tab
(ctrl+shift+t)
~~ ~~go run cmd/skywire-cli/skywire-cli.go hv srvpk~~ ~~

query the http endpoint at http://127.0.0.1:7998 in the browser
or in a new terminal or tab using curl
(ctrl+shift+t)
~~ ~~curl http://127.0.0.1:7998~~ ~~

The output should be the same as the following:
~~ ~~go run cmd/skywire-cli/skywire-cli.go visor pk~~ ~~
without the trailing newline

@0pcom 0pcom marked this pull request as ready for review June 25, 2022 19:18
cmd/skywire-cli/commands/hv/hvdmsg/hvdmsg.go Outdated Show resolved Hide resolved
client := rpcClient()
overview, err := client.Overview()
if err != nil {
log.Fatal("Failed to connect:", err)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe leave a message here to ask the user if the visor is running...Applies for some other commands as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

noted

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed more than just this instance with next commit

url = fmt.Sprintf("http://127.0.0.1:8000/pty/%s", overview.PubKey.Hex())
}
} else {
url = fmt.Sprintf("http://127.0.0.1:8000/pty/%s", pk)
Copy link
Member

Choose a reason for hiding this comment

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

Would the hostname need to be configurable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the circumstance for that is rare, but you are correct that the behavior does assume its running locally.

Configurable, Im not sure.

We could print the LAN ip address / have a flag flag that would print that.

cmd/skywire-cli/commands/hv/hvdmsg/hvdmsg.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvskychat/root.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/visor/shutdown.go Show resolved Hide resolved
cmd/skywire-cli/commands/visor/start.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/visor/start.go Show resolved Hide resolved
pkg/visor/api.go Outdated Show resolved Hide resolved
pkg/visor/api.go Outdated Show resolved Hide resolved
0pcom added 4 commits June 29, 2022 14:14
…ands. Remove hv srvpk subcommand. Limit hv skychat command to linux. Allow skywire-cli visor start as non root
…ands. Remove hv srvpk subcommand. Limit hv skychat command to linux. Allow skywire-cli visor start as non root
@0pcom
Copy link
Collaborator Author

0pcom commented Jun 29, 2022

I've fixed a lot of the typography in the skywire-cli subcommands & made capitalization consistent for subcommands

I've also done some minor rearrangements to just the files and folders containing some subcommands; to overall reduce the number of packages being imported & reduce some code.

Ive fixed the errors returned by the vpnservers and remotevisors api endpoints

removed the hv srvpk subcommand as I've re-implemented that to skybian.

@jdknives jdknives merged commit d083377 into skycoin:develop Jun 30, 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.

2 participants