Constructor
new HostEntry(addr, src)
Create a host entry.
Parameters:
Name | Type | Description |
---|---|---|
addr |
NetAddress | |
src |
NetAddress |
Properties:
Name | Type | Description |
---|---|---|
addr |
NetAddress | host address. |
src |
NetAddress | the first address we discovered this entry from. |
used |
Boolean | is it in the used set. |
refCount |
Number | Reference count in new buckets. |
attempts |
Number | connection attempts since last successful one. |
lastSuccess |
Number | last success timestamp. |
lastAttempt |
Number | last attempt timestamp. |
- Source:
Methods
(static) fromJSON(json, network) → {HostEntry}
Instantiate host entry from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | |
network |
Network |
- Source:
Returns:
- Type
- HostEntry
(static) fromOptions(addr, src) → {HostEntry}
Instantiate host entry from options.
Parameters:
Name | Type | Description |
---|---|---|
addr |
NetAddress | |
src |
NetAddress |
- Source:
Returns:
- Type
- HostEntry
chance(now) → {Number}
Get host priority.
Parameters:
Name | Type | Description |
---|---|---|
now |
Number |
- Source:
Returns:
- Type
- Number
(private) fromJSON(json, network) → {HostEntry}
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | |
network |
Network |
- Source:
Returns:
- Type
- HostEntry
(private) fromOptions(addr, src) → {HostEntry}
Inject properties from options.
Parameters:
Name | Type | Description |
---|---|---|
addr |
NetAddress | |
src |
NetAddress |
- Source:
Returns:
- Type
- HostEntry
inspect() → {Object}
Inspect host address.
- Source:
Returns:
- Type
- Object
key() → {String}
Get key suitable for a hash table (hostname).
- Source:
Returns:
- Type
- String
toJSON() → {Object}
Convert host entry to json-friendly object.
- Source:
Returns:
- Type
- Object