1 const LOGGER
= require('@calzoneman/jsli')('GlobalBanDB');
9 return this.db
.runTransaction(tx
=> {
10 return tx
.table('global_bans').select();
12 LOGGER
.error('Failed to list global IP bans: %s', error
.stack
);
17 addGlobalIPBan(ip
, reason
) {
18 return this.db
.runTransaction(tx
=> {
19 return tx
.table('global_bans')
20 .insert({ ip
, reason
})
22 if (error
.code
=== 'ER_DUP_ENTRY') {
23 return tx
.table('global_bans')
31 LOGGER
.error('Failed to add global IP ban for IP %s: %s', ip
, error
.stack
);
36 removeGlobalIPBan(ip
) {
37 return this.db
.runTransaction(tx
=> {
38 return tx
.table('global_bans')
42 LOGGER
.error('Failed to remove global IP ban for IP %s: %s', ip
, error
.stack
);
48 export { GlobalBanDB
};