class DHTNodes extends Object
And a real Kademlia routing table, which stores node IDs only.
| Constructor and Description |
|---|
DHTNodes(I2PAppContext ctx,
NID me)Create a new DHTNodes instance. |
| Modifier and Type | Method and Description |
|---|---|
void | clear()Clear all known nodes and the routing table. |
List<NodeInfo> | findClosest(SHA1Hash h,
int numWant)Find the closest nodes to a given hash or node ID. |
NodeInfo | get(NID nid)Get a node by its ID. |
List<NID> | getExploreKeys()Get random keys to explore for DHT maintenance. |
NodeInfo | putIfAbsent(NodeInfo nInfo)Insert a node if absent. |
NodeInfo | remove(NID nid)Remove a node by its ID. |
void | renderStatusHTML(StringBuilder buf)Debug info, HTML formatted. |
int | size()Number of known nodes, not total net size. |
void | start()Start the DHT node manager. |
void | stop()Stop the DHT node manager. |
Collection<NodeInfo> | values()Get all known nodes. |
public DHTNodes(I2PAppContext ctx, NID me)
ctx - the I2P application contextme - our own node IDpublic void clear()
public List<NodeInfo> findClosest(SHA1Hash h, int numWant)
h - either an InfoHash or a NIDnumWant - the maximum number of nodes to returnpublic NodeInfo get(NID nid)
nid - the node ID to look uppublic List<NID> getExploreKeys()
public NodeInfo putIfAbsent(NodeInfo nInfo)
nInfo - the node info to insertpublic NodeInfo remove(NID nid)
nid - the node ID to removepublic void renderStatusHTML(StringBuilder buf)
buf - the buffer to append HTML topublic int size()
public void start()
public void stop()
public Collection<NodeInfo> values()