p2p/discover: support incomplete node URLs, add Resolve
This commit is contained in:
@ -36,7 +36,7 @@ func TestTable_pingReplace(t *testing.T) {
|
||||
transport := newPingRecorder()
|
||||
tab, _ := newTable(transport, NodeID{}, &net.UDPAddr{}, "")
|
||||
defer tab.Close()
|
||||
pingSender := newNode(MustHexID("a502af0f59b2aab7746995408c79e9ca312d2793cc997e44fc55eda62f0150bbb8c59a6f9269ba3a081518b62699ee807c7c19c20125ddfccca872608af9e370"), net.IP{}, 99, 99)
|
||||
pingSender := NewNode(MustHexID("a502af0f59b2aab7746995408c79e9ca312d2793cc997e44fc55eda62f0150bbb8c59a6f9269ba3a081518b62699ee807c7c19c20125ddfccca872608af9e370"), net.IP{}, 99, 99)
|
||||
|
||||
// fill up the sender's bucket.
|
||||
last := fillBucket(tab, 253)
|
||||
@ -287,7 +287,7 @@ func TestTable_Lookup(t *testing.T) {
|
||||
t.Fatalf("lookup on empty table returned %d results: %#v", len(results), results)
|
||||
}
|
||||
// seed table with initial node (otherwise lookup will terminate immediately)
|
||||
seed := newNode(lookupTestnet.dists[256][0], net.IP{}, 256, 0)
|
||||
seed := NewNode(lookupTestnet.dists[256][0], net.IP{}, 256, 0)
|
||||
tab.stuff([]*Node{seed})
|
||||
|
||||
results := tab.Lookup(lookupTestnet.target)
|
||||
@ -517,7 +517,7 @@ func (tn *preminedTestnet) findnode(toid NodeID, toaddr *net.UDPAddr, target Nod
|
||||
next := uint16(toaddr.Port) - 1
|
||||
var result []*Node
|
||||
for i, id := range tn.dists[toaddr.Port] {
|
||||
result = append(result, newNode(id, net.ParseIP("127.0.0.1"), next, uint16(i)))
|
||||
result = append(result, NewNode(id, net.ParseIP("127.0.0.1"), next, uint16(i)))
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user