add jack.lbry.tech as a known node for debugging

This commit is contained in:
Jack Robison 2018-07-13 11:24:11 -04:00
parent 76b0e15636
commit 63fe5cbdc8
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"log" "log"
"net/http" "net/http"
"math/big"
) )
type NodeRPC string type NodeRPC string
@ -73,6 +74,12 @@ func dhtCmd(cmd *cobra.Command, args []string) {
err = node.Connect(conn) err = node.Connect(conn)
checkErr(err) checkErr(err)
log.Println("started node") log.Println("started node")
node.AddKnownNode(
dht.Contact{
bits.FromHexP("62c8ad9fb40a16062e884a63cd81f47b94604446319663d1334e1734dcefc8874b348ec683225e4852017a846e07d94e"),
net.ParseIP("34.231.152.182"), 4444,
})
_, _, err = dht.FindContacts(&node.Node, nodeID.Sub(bits.FromBigP(big.NewInt(1))), false, nil)
rpcServer := dht.RunRPCServer(":1234", "/", node) rpcServer := dht.RunRPCServer(":1234", "/", node)
interruptChan := make(chan os.Signal, 1) interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt, syscall.SIGTERM, syscall.SIGINT) signal.Notify(interruptChan, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)

View file

@ -48,6 +48,10 @@ func (b *BootstrapNode) Add(c Contact) {
b.upsert(c) b.upsert(c)
} }
func (b *BootstrapNode) AddKnownNode(c Contact) {
b.Node.rt.Update(c)
}
// Connect connects to the given connection and starts any background threads necessary // Connect connects to the given connection and starts any background threads necessary
func (b *BootstrapNode) Connect(conn UDPConn) error { func (b *BootstrapNode) Connect(conn UDPConn) error {
err := b.Node.Connect(conn) err := b.Node.Connect(conn)