packages/hyprspace: inform about bootstrap peer count
This commit is contained in:
parent
04766e0a9e
commit
6c3cb00e25
1 changed files with 5 additions and 0 deletions
|
@ -38,6 +38,9 @@ func getExtraBootstrapNodes(addr ma.Multiaddr) (nodesList []string) {
|
|||
}
|
||||
resp, err := http.PostForm("http://"+ip4+":"+port+"/api/v0/swarm/addrs", url.Values{})
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
apiResponse, err := ioutil.ReadAll(resp.Body)
|
||||
|
@ -80,6 +83,7 @@ func CreateNode(ctx context.Context, inputKey []byte, port int, handler network.
|
|||
if err == nil {
|
||||
fmt.Println("[+] Getting additional peers from IPFS API")
|
||||
extraBootstrapNodes = getExtraBootstrapNodes(ipfsApiAddr)
|
||||
fmt.Printf("[+] %d additional addresses\n", len(extraBootstrapNodes))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +166,7 @@ func CreateNode(ctx context.Context, inputKey []byte, port int, handler network.
|
|||
if count < 1 {
|
||||
return node, dhtOut, errors.New("unable to bootstrap libp2p node")
|
||||
}
|
||||
fmt.Printf("[+] Connected to %d bootstrap peers\n", count)
|
||||
|
||||
return node, dhtOut, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue