Skip to content

Commit

Permalink
feat: add setban
Browse files Browse the repository at this point in the history
  • Loading branch information
gridcat committed Jul 6, 2021
1 parent 03fefbf commit 3b54fc1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/RPC/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,24 @@ export class Network extends RPCBase {
public async ping(): Promise<null> {
return this.call('ping');
}

/**
* add or remove an IP/Subnet from the banned list.
*
* @param {string} subnet - The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)
* @param {('add' | 'remove')} command - 'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list
* @param {number} [banTime] - time in seconds how long (or until when if [absolute] is set) the IP is banned
* (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)
* @param {number | false} [absolute] - Defaults to false. If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT).
* @returns {Promise<null>}
* @memberof Network
*/
public async setBan(
subnet: string,
command: 'add' | 'remove',
banTime?: number,
absolute?: number | false,
): Promise<null> {
return this.call('setban', subnet, command, banTime, absolute);
}
}

0 comments on commit 3b54fc1

Please sign in to comment.