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

auto-peering visors to the hypervisor (skybian) #1309

Merged
merged 22 commits into from
Aug 8, 2022
Merged

Conversation

0pcom
Copy link
Collaborator

@0pcom 0pcom commented Jul 13, 2022

attempt to make visors re-peer to a new hypervisor when a new hypervisor is present at a predetermined static ip

Fixes #1312

this PR ports the existing auto-peering functionality from skybian to the skywire source code / binaries and attempts to extend this system to re-peer visors to the hypervisor when a connection is lost

testing requires a hypervisor running the following:

skywire-cli visor pk -w

The srvpk endpoint may be used instead of the above command

run the visor from source as follows:

go run cmd/skywire-cli/skywire-cli.go config gen -brn | sudo go run cmd/skywire-visor/skywire-visor.go -l "go run cmd/skywire-cli/skywire-cli.go hv pk -i 192.168.0.100" -mn

replace the ip address in the above command example with that of the running machine.

@0pcom
Copy link
Collaborator Author

0pcom commented Jul 15, 2022

to test without using the default http endpoint for the public key (or any)
one can create a file that contains the public key of a running hypervisor for which re-peering will be attempted

echo -n "024034dd09cbff03787db740124496ce8fdbe0cac2a51e20366cb59be10b665506" | tee skywiretest.txt

then invoke the visor as follows:

 sudo go run cmd/skywire-visor/skywire-visor.go -pml "cat '/home/user/skywiretest.txt'"

as you run this visor in the foreground, turn the (remote) hypervisor off and on to observe that the command string provided as an argument to the -l flag is executed on redial attempts to the hypervisor.

To further test, one can edit the file to contain a different public key while this is happening, save the file, and it should then attempt to redial with the new public key.

this needs to be made versatile enough to handle a list of remote hypervisor public keys. Ideally, the http endpoint would output the keys in the same format that they are read, to require minimal parsing.

@0pcom 0pcom marked this pull request as ready for review July 15, 2022 16:06
cmd/skywire-cli/commands/config/gen.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Outdated Show resolved Hide resolved
cmd/skywire-visor/commands/root.go Outdated Show resolved Hide resolved
cmd/skywire-visor/commands/root.go Show resolved Hide resolved
cmd/skywire-visor/commands/root.go Outdated Show resolved Hide resolved
pkg/visor/rpc_client_serve.go Show resolved Hide resolved
pkg/visor/rpc_client_serve.go Show resolved Hide resolved
@0pcom 0pcom changed the title auto-peering visors to the hypervisor (skybian) [WIP] auto-peering visors to the hypervisor (skybian) Jul 25, 2022
cmd/skywire-cli/commands/hv/hvpk.go Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Outdated Show resolved Hide resolved
cmd/skywire-cli/commands/hv/hvpk.go Show resolved Hide resolved
cmd/skywire-visor/commands/root.go Outdated Show resolved Hide resolved
}
if autopeer {
log.Infof("autopeering...")
var hvkey string
Copy link
Member

Choose a reason for hiding this comment

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

Still left...

pkg/visor/remote_hypervisor.go Show resolved Hide resolved
pkg/visor/rpc_client_serve.go Outdated Show resolved Hide resolved
pkg/visor/rpc_client_serve.go Outdated Show resolved Hide resolved
@0pcom 0pcom merged commit f0de5ef into develop Aug 8, 2022
@0pcom 0pcom deleted the feature/autopeering branch August 8, 2022 16:28
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