vpn-split 21.0.19 → 21.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/hostile.backend.js +108 -104
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +4 -2
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/models.js +174 -164
- package/lib-prod/package.json +1 -1
- package/lib-prod/start.backend.js +23 -0
- package/lib-prod/vpn-split.backend.js +695 -663
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,130 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS,
|
|
68
|
-
ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE,
|
|
69
|
-
ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH,
|
|
70
|
-
ENV_VSCODE_PLUGIN_BUILD_PROD,
|
|
71
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER,
|
|
72
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_NAME,
|
|
73
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME,
|
|
74
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL,
|
|
75
|
-
ENV_VSCODE_PLUGIN_BUILD_SSR,
|
|
76
|
-
ENV_VSCODE_PLUGIN_BUILD_WATCH,
|
|
77
|
-
ENV_VSCODE_PLUGIN_BUILD_WEBSQL,
|
|
78
|
-
ENV_VSCODE_PLUGIN_CONTAINER_END,
|
|
79
|
-
ENV_VSCODE_PLUGIN_CONTAINER_ONLY,
|
|
80
|
-
ENV_VSCODE_PLUGIN_CONTAINER_SKIP,
|
|
81
|
-
ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED,
|
|
82
|
-
ENV_VSCODE_PLUGIN_CONTAINER_START,
|
|
83
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK,
|
|
84
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS,
|
|
85
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS,
|
|
86
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP,
|
|
87
|
-
ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER,
|
|
88
|
-
ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER,
|
|
89
|
-
ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB,
|
|
90
|
-
ENV_VSCODE_PLUGIN_INIT_BRANDING,
|
|
91
|
-
ENV_VSCODE_PLUGIN_INIT_STRUCT,
|
|
92
|
-
ENV_VSCODE_PLUGIN_IS_CI_PROCESS,
|
|
93
|
-
ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND,
|
|
94
|
-
ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER,
|
|
95
|
-
ENV_VSCODE_PLUGIN_PURPOSE,
|
|
96
|
-
ENV_VSCODE_PLUGIN_RECURSIVE_ACTION,
|
|
97
|
-
ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME,
|
|
98
|
-
ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG,
|
|
99
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS,
|
|
100
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES,
|
|
101
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY,
|
|
102
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE,
|
|
103
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY,
|
|
104
|
-
ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME,
|
|
105
|
-
ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER,
|
|
106
|
-
ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY,
|
|
107
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS,
|
|
108
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES,
|
|
109
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS,
|
|
110
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE,
|
|
111
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS,
|
|
112
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE,
|
|
113
|
-
ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY,
|
|
114
|
-
ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE,
|
|
115
|
-
ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE,
|
|
116
|
-
ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL,
|
|
117
|
-
ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION,
|
|
118
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS,
|
|
119
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING,
|
|
120
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY,
|
|
121
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH,
|
|
122
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION,
|
|
123
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES,
|
|
124
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH,
|
|
125
|
-
ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP,
|
|
126
|
-
ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT,
|
|
127
|
-
ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN,
|
|
128
|
-
ENV_VSCODE_PLUGIN_WEBSITE_TITLE,
|
|
129
|
-
ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN
|
|
130
|
-
};
|
|
1
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
2
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN = 'vpn-split.example.domain.com';
|
|
3
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_TITLE = 'Vpn Split';
|
|
4
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT = 'vscode-plugin';
|
|
5
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME = '__';
|
|
6
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_ONLY = undefined;
|
|
7
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_END = undefined;
|
|
8
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_START = undefined;
|
|
9
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED = undefined;
|
|
10
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP = undefined;
|
|
11
|
+
export const ENV_VSCODE_PLUGIN_INIT_BRANDING = undefined;
|
|
12
|
+
export const ENV_VSCODE_PLUGIN_INIT_STRUCT = undefined;
|
|
13
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER = undefined;
|
|
14
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_NAME = undefined;
|
|
15
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME = undefined;
|
|
16
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL = undefined;
|
|
17
|
+
export const ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS = undefined;
|
|
18
|
+
export const ENV_VSCODE_PLUGIN_BUILD_SSR = undefined;
|
|
19
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WEBSQL = undefined;
|
|
20
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PROD = undefined;
|
|
21
|
+
export const ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH = undefined;
|
|
22
|
+
export const ENV_VSCODE_PLUGIN_BUILD_BASE_HREF = undefined;
|
|
23
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WATCH = undefined;
|
|
24
|
+
export const ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE = undefined;
|
|
25
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = undefined;
|
|
26
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = undefined;
|
|
27
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY = undefined;
|
|
28
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES = undefined;
|
|
29
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY = undefined;
|
|
30
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE = undefined;
|
|
31
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS = undefined;
|
|
32
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY = undefined;
|
|
33
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS = undefined;
|
|
34
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE = undefined;
|
|
35
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE = undefined;
|
|
36
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS = undefined;
|
|
37
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS = undefined;
|
|
38
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = undefined;
|
|
39
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION = undefined;
|
|
40
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE = undefined;
|
|
41
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER = undefined;
|
|
42
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY = undefined;
|
|
43
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = undefined;
|
|
44
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE = undefined;
|
|
45
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG = undefined;
|
|
46
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME = undefined;
|
|
47
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP = undefined;
|
|
48
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH = undefined;
|
|
49
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY = undefined;
|
|
50
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH = undefined;
|
|
51
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION = undefined;
|
|
52
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES = undefined;
|
|
53
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING = undefined;
|
|
54
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS = undefined;
|
|
55
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK = undefined;
|
|
56
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS = undefined;
|
|
57
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS = undefined;
|
|
58
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP = undefined;
|
|
59
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN = undefined;
|
|
60
|
+
export const ENV_VSCODE_PLUGIN_PURPOSE = undefined;
|
|
61
|
+
export const ENV_VSCODE_PLUGIN_RECURSIVE_ACTION = undefined;
|
|
62
|
+
export const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = undefined;
|
|
63
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
package/lib-prod/env/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from './env.angular-node-app';
|
|
2
|
+
export * from './env.docs-webapp';
|
|
3
|
+
export * from './env.electron-app';
|
|
4
|
+
export * from './env.mobile-app';
|
|
5
|
+
export * from './env.npm-lib-and-cli-tool';
|
|
6
|
+
export * from './env.vscode-plugin';
|
|
@@ -1,113 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import * as hostile from 'hostile';
|
|
3
|
+
import { chalk, net } from 'tnp-core/lib-prod';
|
|
4
|
+
//#endregion
|
|
5
|
+
export class Hostile {
|
|
6
|
+
/**
|
|
7
|
+
* Display all current ip records
|
|
8
|
+
*/
|
|
9
|
+
list() {
|
|
10
|
+
var lines;
|
|
11
|
+
try {
|
|
12
|
+
lines = hostile.get(false);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
return this.error(err);
|
|
16
|
+
}
|
|
17
|
+
lines.forEach(item => {
|
|
18
|
+
if (item.length > 1) {
|
|
19
|
+
console.log(item[0], chalk.green(item[1]));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.log(item);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Set a new host
|
|
28
|
+
* @param {string} ip
|
|
29
|
+
* @param {string} host
|
|
30
|
+
*/
|
|
31
|
+
set(ip, host) {
|
|
32
|
+
if (!ip || !host) {
|
|
33
|
+
return this.error('Invalid syntax: hostile set <ip> <host>');
|
|
34
|
+
}
|
|
35
|
+
if (ip === 'local' || ip === 'localhost') {
|
|
36
|
+
ip = '127.0.0.1';
|
|
37
|
+
}
|
|
38
|
+
else if (!net.isIP(ip)) {
|
|
39
|
+
return this.error('Invalid IP address');
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
hostile.set(ip, host);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return this.error('Error: ' + err.message + '. Are you running as root?');
|
|
46
|
+
}
|
|
47
|
+
console.log(chalk.green('Added ' + host));
|
|
30
48
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Remove a host
|
|
51
|
+
* @param {string} host
|
|
52
|
+
*/
|
|
53
|
+
remove(host) {
|
|
54
|
+
var lines;
|
|
55
|
+
try {
|
|
56
|
+
lines = hostile.get(false);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
return this.error(err);
|
|
60
|
+
}
|
|
61
|
+
lines.forEach(item => {
|
|
62
|
+
if (item[1] === host) {
|
|
63
|
+
try {
|
|
64
|
+
hostile.remove(item[0], host);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return this.error('Error: ' + err.message + '. Are you running as root?');
|
|
68
|
+
}
|
|
69
|
+
console.log(chalk.green('Removed ' + host));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
35
72
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Load hosts given a file
|
|
75
|
+
* @param {string} filePath
|
|
76
|
+
*/
|
|
77
|
+
load(filePath) {
|
|
78
|
+
var lines = this.parseFile(filePath);
|
|
79
|
+
lines.forEach(item => {
|
|
80
|
+
this.set(item[0], item[1]);
|
|
81
|
+
});
|
|
82
|
+
console.log(chalk.green('\nAdded %d hosts!'), lines.length);
|
|
40
83
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} catch (err) {
|
|
52
|
-
return this.error(err);
|
|
84
|
+
/**
|
|
85
|
+
* Remove hosts given a file
|
|
86
|
+
* @param {string} filePath
|
|
87
|
+
*/
|
|
88
|
+
unload(filePath) {
|
|
89
|
+
var lines = this.parseFile(filePath);
|
|
90
|
+
lines.forEach(item => {
|
|
91
|
+
this.remove(item[1]);
|
|
92
|
+
});
|
|
93
|
+
console.log(chalk.green('Removed %d hosts!'), lines.length);
|
|
53
94
|
}
|
|
54
|
-
|
|
55
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Get all the lines of the file as array of arrays [[IP, host]]
|
|
97
|
+
* @param {string} filePath
|
|
98
|
+
*/
|
|
99
|
+
parseFile(filePath) {
|
|
100
|
+
var lines;
|
|
56
101
|
try {
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
102
|
+
lines = hostile.getFile(filePath, false);
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return this.error(err);
|
|
62
106
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var lines = this.parseFile(filePath);
|
|
73
|
-
lines.forEach((item) => {
|
|
74
|
-
this.set(item[0], item[1]);
|
|
75
|
-
});
|
|
76
|
-
console.log(chalk.green("\nAdded %d hosts!"), lines.length);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Remove hosts given a file
|
|
80
|
-
* @param {string} filePath
|
|
81
|
-
*/
|
|
82
|
-
unload(filePath) {
|
|
83
|
-
var lines = this.parseFile(filePath);
|
|
84
|
-
lines.forEach((item) => {
|
|
85
|
-
this.remove(item[1]);
|
|
86
|
-
});
|
|
87
|
-
console.log(chalk.green("Removed %d hosts!"), lines.length);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get all the lines of the file as array of arrays [[IP, host]]
|
|
91
|
-
* @param {string} filePath
|
|
92
|
-
*/
|
|
93
|
-
parseFile(filePath) {
|
|
94
|
-
var lines;
|
|
95
|
-
try {
|
|
96
|
-
lines = hostile.getFile(filePath, false);
|
|
97
|
-
} catch (err) {
|
|
98
|
-
return this.error(err);
|
|
107
|
+
return lines;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Print an error and exit the program
|
|
111
|
+
* @param {string} message
|
|
112
|
+
*/
|
|
113
|
+
error(err) {
|
|
114
|
+
console.error(chalk.red(err.message || err));
|
|
115
|
+
process.exit(-1);
|
|
99
116
|
}
|
|
100
|
-
return lines;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Print an error and exit the program
|
|
104
|
-
* @param {string} message
|
|
105
|
-
*/
|
|
106
|
-
error(err) {
|
|
107
|
-
console.error(chalk.red(err.message || err));
|
|
108
|
-
process.exit(-1);
|
|
109
|
-
}
|
|
110
117
|
}
|
|
111
|
-
export {
|
|
112
|
-
Hostile
|
|
113
|
-
};
|
package/lib-prod/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export * from './migrations_index._auto-generated_';
|