Constructor
new PeerList(options)
Create peer list.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Methods
add(peer)
Add peer to list.
Parameters:
Name | Type | Description |
---|---|---|
peer |
Peer |
- Source:
destroy()
Destroy peer list (kills peers).
- Source:
find(id) → {Peer}
Get peer by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Peer
get(hostname) → {Peer}
Get peer by hostname.
Parameters:
Name | Type | Description |
---|---|---|
hostname |
String |
- Source:
Returns:
- Type
- Peer
has(hostname) → {Boolean}
Test whether a peer exists.
Parameters:
Name | Type | Description |
---|---|---|
hostname |
String |
- Source:
Returns:
- Type
- Boolean
head() → {Peer}
Get the list head.
- Source:
Returns:
- Type
- Peer
remove(peer)
Remove peer from list.
Parameters:
Name | Type | Description |
---|---|---|
peer |
Peer |
- Source:
size() → {Number}
Get list size.
- Source:
Returns:
- Type
- Number
tail() → {Peer}
Get the list tail.
- Source:
Returns:
- Type
- Peer