Liking cljdoc? Tell your friends :D

dht-cljc.core


bootstrap-nodesclj/s

A list of BitTorrent DHT bootstrap nodes.

A list of BitTorrent DHT bootstrap nodes.
sourceraw docstring

fifteen-minutes-overdue!clj/s

(fifteen-minutes-overdue!)

Gets the time, in milliseconds, 15 minutes ago. This is the default used in the BEP_0005 spec for overdue nodes. Useful for 'get-by-overdue

Gets the time, in milliseconds, 15 minutes ago. This is the default used
in the BEP_0005 spec for overdue nodes. Useful for 'get-by-overdue
sourceraw docstring

generate-tableclj/s

(generate-table client-infohash & [max-bucket-count])

Generates a blank routing table ready to be filled with addresses

:router - The vector of clients. See 'insert for client format :client-infohash - The infohash for the currently running node :splits - The depth of the client-infohash bucket :max-bucket-count - The maximum good nodes in a bucket before a split. Default 8 per the spec

Generates a blank routing table ready to be filled with addresses

:router - The vector of clients. See 'insert for client format
:client-infohash - The infohash for the currently running node
:splits - The depth of the client-infohash bucket
:max-bucket-count - The maximum good nodes in a bucket before a split.
                    Default 8 per the spec
sourceraw docstring

get-by-depthclj/s

(get-by-depth table)
(get-by-depth {:keys [router splits] :as table} d)

Gets the list of clients at a specific depth. If depth is absent or

= 'splits, the client's bucket is returned.

Gets the list of clients at a specific depth. If depth is absent or
>= 'splits, the client's bucket is returned.
sourceraw docstring

get-by-overdueclj/s

(get-by-overdue {:keys [router] :as table} expired-before)

Find all nodes in a table that are past the given 'expired-before param, in milliseconds

Find all nodes in a table that are past the given 'expired-before param,
in milliseconds
sourceraw docstring

get-nearest-peersclj/s

(get-nearest-peers {:keys [client-infohash] :as table} infohash)

Finds the nearest peers to a given infohash in the routing table. The peer list is then sorted by distance, ascending, from the infohash.

Finds the nearest peers to a given infohash in the routing table. The peer
list is then sorted by distance, ascending, from the infohash.
sourceraw docstring

insertclj/s

(insert table last-seen remote-infohash ip port)

Inserts the given node into the router, respecting full and dividing buckets. Refer to BEP_0005 for more information.

table - The table whose router we want to update last-seen - (optional) timestamp since this node was last seen remote-infohash - The infohash of the node we want to insert, in bytes ip, port - The IP and port of the node

Returns the updated table

Inserts the given node into the router, respecting full and dividing buckets.
Refer to BEP_0005 for more information.

  table - The table whose router we want to update
  last-seen - (optional) timestamp since this node was last seen
  remote-infohash - The infohash of the node we want to insert, in bytes
  ip, port - The IP and port of the node

Returns the updated table
sourceraw docstring

pruneclj/s

(prune {:keys [router max-bucket-count] :as table} & infohashes)

Removes listed infohashes from the router, combining buckets as needed

Removes listed infohashes from the router, combining buckets as needed
sourceraw docstring

refreshclj/s

(refresh {:keys [router] :as table} & responses)

Refreshes the table's nodes with new :last-seen timestamps. Accepts a variadic number of responses. Each response is a tuple of the infohash and the new timestamp, or [infohash timestamp]

Refreshes the table's nodes with new :last-seen timestamps.
Accepts a variadic number of responses. Each response is a tuple of the
infohash and the new timestamp, or [infohash timestamp]
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close