lbry.go/dht/sample/getpeers/getpeers.go
Alex Grintsvayg 1f26aeeb5c add dht
2017-08-16 11:52:19 -04:00

23 lines
339 B
Go

package main
import (
"fmt"
"github.com/shiyanhui/dht"
"time"
)
func main() {
d := dht.New(nil)
go d.Run()
for {
// ubuntu-14.04.2-desktop-amd64.iso
peers, err := d.GetPeers("546cf15f724d19c4319cc17b179d7e035f89c1f4")
if err != nil {
time.Sleep(time.Second * 1)
continue
}
fmt.Println("Found peers:", peers)
}
}