bin: generate .json instead of .js and remove all comments in cli-init.js
This commit is contained in:
parent
27c39833cc
commit
caa47a0ccf
135
bin/cli-init.js
135
bin/cli-init.js
@ -18,107 +18,68 @@ function random(array, len) {
|
||||
|
||||
const key = random('abcdefghjklmnpqrstuvwxyz23456789!@#$%^&*()_+<>?:|{}-=[];,./ABCDEFGHJKLMNPQRSTUVWXYZ', 16);
|
||||
|
||||
const clientJs = `module.exports = {
|
||||
// local hostname or ip address
|
||||
// For client, act as a Socks5/Socks4/HTTP server.
|
||||
// For server, act as a blinksocks server.
|
||||
host: "localhost",
|
||||
// local port to be listen on
|
||||
port: 1080,
|
||||
// a list of blinksocks/shadowsocks server(client side only)
|
||||
servers: [
|
||||
const clientJs = `{
|
||||
"host": "localhost",
|
||||
"port": 1080,
|
||||
"servers": [
|
||||
{
|
||||
// allow to use this server or not
|
||||
enabled: true,
|
||||
// the transport layer, "tcp" or "udp"
|
||||
transport: "tcp",
|
||||
// server host name or ip address
|
||||
host: "example.com",
|
||||
// server port
|
||||
port: 4321,
|
||||
// a secret key for encryption/description
|
||||
key: "${key}",
|
||||
// presets to process data stream
|
||||
// DO NOT modify the first preset if you don't know what it is.
|
||||
// Take care the order of those presets, read the docs before changing them.
|
||||
presets: [
|
||||
"enabled": true,
|
||||
"transport": "tcp",
|
||||
"host": "example.com",
|
||||
"port": 4321,
|
||||
"key": "${key}",
|
||||
"presets": [
|
||||
{
|
||||
// preset name
|
||||
name: "ss-base",
|
||||
// preset parameters
|
||||
params: {}
|
||||
"name": "ss-base",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
name: "ss-aead-cipher",
|
||||
params: {
|
||||
method: "aes-256-gcm",
|
||||
info: "ss-subkey"
|
||||
"name": "ss-aead-cipher",
|
||||
"params": {
|
||||
"method": "aes-256-gcm",
|
||||
"info": "ss-subkey"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
// an ip list of DNS server
|
||||
dns: [],
|
||||
// DNS cache expiration time in seconds
|
||||
dns_expire: 3600,
|
||||
// close inactive connection after timeout seconds
|
||||
timeout: 600,
|
||||
// collect performance statistics
|
||||
profile: false,
|
||||
// hot-reload when this file changed
|
||||
watch: true,
|
||||
// log at the level, "error", "warn", "info", "verbose", "debug" or "silly"
|
||||
log_level: "info"
|
||||
};
|
||||
`;
|
||||
"dns": [],
|
||||
"dns_expire": 3600,
|
||||
"timeout": 600,
|
||||
"profile": false,
|
||||
"watch": false,
|
||||
"log_level": "info"
|
||||
}`;
|
||||
|
||||
const serverJs = `module.exports = {
|
||||
// local hostname or ip address
|
||||
// For client, act as a Socks5/Socks4/HTTP server.
|
||||
// For server, act as a blinksocks server.
|
||||
host: "0.0.0.0",
|
||||
// local port to be listen on
|
||||
port: 4321,
|
||||
// the transport layer, "tcp" or "udp"
|
||||
transport: "tcp",
|
||||
// a secret key for encryption/description
|
||||
key: "${key}",
|
||||
// presets to process data stream
|
||||
// DO NOT modify the first preset if you don't know what it is.
|
||||
// Take care the order of those presets, read the docs before changing them.
|
||||
presets: [
|
||||
const serverJs = `{
|
||||
"host": "0.0.0.0",
|
||||
"port": 4321,
|
||||
"transport": "tcp",
|
||||
"key": "${key}",
|
||||
"presets": [
|
||||
{
|
||||
// preset name
|
||||
name: "ss-base",
|
||||
// preset parameters
|
||||
params: {}
|
||||
"name": "ss-base",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
name: "ss-aead-cipher",
|
||||
params: {
|
||||
method: "aes-256-gcm",
|
||||
info: "ss-subkey"
|
||||
"name": "ss-aead-cipher",
|
||||
"params": {
|
||||
"method": "aes-256-gcm",
|
||||
"info": "ss-subkey"
|
||||
}
|
||||
}
|
||||
],
|
||||
// an ip list of DNS server
|
||||
dns: [],
|
||||
// DNS cache expiration time in seconds
|
||||
dns_expire: 3600,
|
||||
// redirect data to here once preset fail to process(server side only)
|
||||
// Should be formed with "host:port".
|
||||
redirect: "",
|
||||
// close inactive connection after timeout seconds
|
||||
timeout: 600,
|
||||
// collect performance statistics
|
||||
profile: false,
|
||||
// hot-reload when this file changed
|
||||
watch: true,
|
||||
// log at the level, "error", "warn", "info", "verbose", "debug" or "silly"
|
||||
log_level: "info"
|
||||
};
|
||||
`;
|
||||
"dns": [],
|
||||
"dns_expire": 3600,
|
||||
"redirect": "",
|
||||
"timeout": 600,
|
||||
"profile": false,
|
||||
"watch": false,
|
||||
"log_level": "info"
|
||||
}`;
|
||||
|
||||
fs.writeFileSync('blinksocks.client.js', clientJs);
|
||||
fs.writeFileSync('blinksocks.server.js', serverJs);
|
||||
fs.writeFileSync('blinksocks.client.json', clientJs);
|
||||
fs.writeFileSync('blinksocks.server.json', serverJs);
|
||||
|
||||
console.log('> Generated blinksocks.client.json and blinksocks.server.json');
|
||||
console.log('> For explanation to each option, please refer to docs/config/README.md');
|
||||
|
Loading…
Reference in New Issue
Block a user