Now an error will be thrown if a required field of a proxy is missing

This commit is contained in:
Peng-YM 2022-06-20 01:33:24 +08:00
parent 83504d42c4
commit 4945826f2d
4 changed files with 13 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -34,6 +34,9 @@ function shadowsocks(proxy) {
append(`,password=${proxy.password}`);
// obfs
if (needTls(proxy)) {
proxy.tls = true;
}
if (isPresent(proxy, 'plugin')) {
if (proxy.plugin === 'obfs') {
const opts = proxy['plugin-opts'];
@ -187,6 +190,9 @@ function vmess(proxy) {
append(`,password=${proxy.uuid}`);
// obfs
if (needTls(proxy)) {
proxy.tls = true;
}
if (isPresent(proxy, 'network')) {
if (proxy.network === 'ws') {
if (proxy.tls) append(`,obfs=wss`);

View File

@ -7,6 +7,9 @@ export class Result {
}
append(data) {
if (typeof data === 'undefined') {
throw new Error('required field is missing');
}
this.output.push(data);
}

File diff suppressed because one or more lines are too long