-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.js
More file actions
109 lines (106 loc) · 3.79 KB
/
plugins.js
File metadata and controls
109 lines (106 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
'use strict';
const path = require('path');
const FireholPlugin = require('./plugins/firehol');
const SpamhausPlugin = require('./plugins/spamhaus');
const CloudflarePlugin = require('./plugins/cloudflare');
const AWSPlugin = require('./plugins/aws');
const GoogleCloudPlugin = require('./plugins/google_cloud');
const FastlyPlugin = require('./plugins/fastly');
// const example = require('ip_denylist_plugin_example');
// const udger = require('ip_denylist_plugin_udger');
// const udgerStale = require('ip_denylist_plugin_udger_stale');
const MaxmindLiteCityPlugin = require('./plugins/maxmind_lite_city');
const MaxmindLiteASNPlugin = require('./plugins/maxmind_lite_asn');
/**
* Create plugin wrapper for backward compatibility
* @param {BasePlugin} pluginInstance - Plugin instance
* @returns {Object} Plugin wrapper object
*/
function createPluginWrapper(pluginInstance) {
return {
name: pluginInstance.name,
abortOnFail: pluginInstance.abortOnFail,
async load() {
await pluginInstance.init();
const result = await pluginInstance.load();
await pluginInstance.validate(result);
return result;
},
getMetadata: () => pluginInstance.getMetadata(),
healthCheck: () => pluginInstance.healthCheck(),
cleanup: () => pluginInstance.cleanup()
};
}
module.exports = [
// {
// name: 'example',
// load() {
// return example(path.join(__dirname,'staging','example.data.txt'))
// },
// abortOnFail: false
// },
// {
// name: 'udger',
// load() {
// return udger(path.join(__dirname,'staging','udger.data.txt'))
// },
// abortOnFail: false
// },
// {
// name: 'udgerStale',
// load() {
// return udgerStale(path.join(__dirname,'staging','udger_stale.data.txt'))
// },
// abortOnFail: true
// },
// {
// name: 'maxmindLiteCity',
// load() {
// return maxmindLiteCity(path.join(__dirname,'staging','maxmind_lite_city.data.txt'))
// },
// abortOnFail: false
// },
// {
// name: 'maxmindLiteASN',
// load() {
// return maxmindLiteASN(path.join(__dirname,'staging','maxmind_lite_asn.data.txt'))
// },
// abortOnFail: false
// },
createPluginWrapper(new FireholPlugin({
outputFile: path.join(__dirname,'staging','firehol.data.txt'),
// listArray omitted - uses default lists from plugin
// Can override with: listArray: ['custom', 'urls']
abortOnFail: true
})),
createPluginWrapper(new SpamhausPlugin({
outputFile: path.join(__dirname,'staging','spamhaus.data.txt'),
// listArray omitted - uses default lists from plugin
// Can override with: listArray: ['custom', 'urls']
abortOnFail: false
})),
createPluginWrapper(new CloudflarePlugin({
outputFile: path.join(__dirname,'staging','cloudflare.data.txt'),
abortOnFail: false
})),
createPluginWrapper(new AWSPlugin({
outputFile: path.join(__dirname,'staging','aws.data.txt'),
abortOnFail: false
})),
createPluginWrapper(new GoogleCloudPlugin({
outputFile: path.join(__dirname,'staging','google_cloud.data.txt'),
abortOnFail: false
})),
createPluginWrapper(new FastlyPlugin({
outputFile: path.join(__dirname,'staging','fastly.data.txt'),
abortOnFail: false
})),
createPluginWrapper(new MaxmindLiteCityPlugin({
outputFile: path.join(__dirname,'staging','maxmind_lite_city.data.txt'),
abortOnFail: false
})),
createPluginWrapper(new MaxmindLiteASNPlugin({
outputFile: path.join(__dirname,'staging','maxmind_lite_asn.data.txt'),
abortOnFail: false
}))
];