new ServicesBitfield(bufopt, optsopt)
Service features bitfield (MSB 0).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
buf |
Buffer |
<optional> |
A 8-byte bitfield buffer (will be created if
not provided or will be copied if |
opts |
Object |
<optional> |
Options |
Example
var ServicesBitfield = require("bitmessage").structs.ServicesBitfield;
var services = ServicesBitfield().set(ServicesBitfield.NODE_NETWORK);
console.log(services.get(ServicesBitfield.NODE_NETWORK)); // true
console.log(services.get(15)); // false
Members
(static, constant) NODE_GATEWAY :number
Bit index indicating node which can work as a WebSocket gateway for web/mobile clients (proposal feature).
Type:
- number
(static, constant) NODE_MOBILE :number
Bit index indicating web/mobile client with limited network capabilities (proposal feature).
Type:
- number
(static, constant) NODE_NETWORK :number
Bit index indicating normal network node.
Type:
- number
- Source:
buffer :Buffer
The contents of the bitfield.
Type:
- Buffer
- Source:
Methods
get(index) → {boolean}
Returns a boolean indicating whether the bit is set.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Bit index (MSB 0) |
- Source:
Returns:
- Type
- boolean
set(index) → {Object}
Set the given bit(s) to 1
.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Array.<number> | Bit(s) index (MSB 0) |
- Source:
Returns:
Returns self so methods can be chained.
- Type
- Object