35f98ce162
-Added travis support -updated travis to analyze code beneath the root. -refactored upload.go to fix travis errors. -gocyclo should ignore test files. $GOFILES needed to be adjusted. -fix rows.Close() ignoring error. Created func to handle so defer can be used when needed also. -fixed ignored errors. -fixed unit test that was not passing correctly to anonymous function. -fixed govet error for passing param inside go func. -removed returned error, in favor of logging instead. -added error logging for ignored error. -fixed potential race conditions. -removed unused append -fixed time usage to align with go standards. -removed unused variables -made changes for code review. -code comments for exported functions. -Documented bitmap.go and insert into contact list. -Documented dht, message, bootstrap -Fixed comment typos -Documented message,node, routing_table, testing in DHT package. -Documented server, client, prism, server and shared in peer and reflector packages. -Documented the stores in Store package. -made defer adjustments inline and deleted the separate function. -adjusted method in upload to take the only parameter it requires.
40 lines
608 B
Go
40 lines
608 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/lbryio/reflector.go/dht"
|
|
|
|
"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) {
|
|
conf := &dht.Config{
|
|
Address: "0.0.0.0:4460",
|
|
SeedNodes: []string{
|
|
"34.231.152.182:4460",
|
|
},
|
|
}
|
|
|
|
d, err := dht.New(conf)
|
|
checkErr(err)
|
|
|
|
err = d.Start()
|
|
checkErr(err)
|
|
defer d.Shutdown()
|
|
|
|
err = d.Ping("34.231.152.182:4470")
|
|
checkErr(err)
|
|
|
|
err = d.Announce(dht.RandomBitmapP())
|
|
checkErr(err)
|
|
|
|
d.PrintState()
|
|
}
|