reflector.go/cmd/dht.go

33 lines
523 B
Go
Raw Normal View History

package cmd
import (
2018-04-05 17:35:57 +02:00
"time"
"github.com/lbryio/reflector.go/dht"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
var cmd = &cobra.Command{
Use: "dht",
Short: "Run interactive dht node",
Run: dhtCmd,
}
RootCmd.AddCommand(cmd)
}
func dhtCmd(cmd *cobra.Command, args []string) {
dht, err := dht.New(&dht.Config{
Address: "127.0.0.1:21216",
SeedNodes: []string{"127.0.0.1:21215"},
2018-04-05 17:35:57 +02:00
PrintState: 30 * time.Second,
})
if err != nil {
log.Fatal(err)
}
2018-03-29 03:05:27 +02:00
dht.Start()
}