update 2024-03-08 20:27:51

This commit is contained in:
github-actions[bot] 2024-03-08 20:27:51 +08:00
parent 072e3f4814
commit ddfbde6fa7
8 changed files with 44 additions and 36 deletions

View File

@ -131,6 +131,13 @@ function stream_quic(server) {
return null;
}
export function port_array(i) {
if (type(i) === 'array') {
return map(i, v => int(v));
}
return [int(i)];
};
export function stream_settings(server, protocol, tag) {
const security = server[protocol + "_tls"];
let tlsSettings = null;

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
export function http_outbound(server, tag) {
const stream_settings_object = stream_settings(server, "http", tag);
@ -20,13 +20,13 @@ export function http_outbound(server, tag) {
protocol: "http",
tag: tag,
settings: {
servers: [
{
servers: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
users: users
}
]
};
})
},
streamSettings: stream_settings_result
},

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
export function shadowsocks_outbound(server, tag) {
const stream_settings_object = stream_settings(server, "shadowsocks", tag);
@ -11,16 +11,16 @@ export function shadowsocks_outbound(server, tag) {
protocol: "shadowsocks",
tag: tag,
settings: {
servers: [
{
servers: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
email: server["username"],
password: server["password"],
method: server["shadowsocks_security"],
uot: server["shadowsocks_udp_over_tcp"] == '1'
}
]
};
})
},
streamSettings: stream_settings_result
},

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
export function socks_outbound(server, tag) {
const stream_settings_object = stream_settings(server, "socks", tag);
@ -20,13 +20,13 @@ export function socks_outbound(server, tag) {
protocol: "socks",
tag: tag,
settings: {
servers: [
{
servers: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
users: users
}
]
})
},
streamSettings: stream_settings_result
},

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
import { fallbacks, tls_inbound_settings } from "../common/tls.mjs";
function trojan_inbound_user(k) {
@ -19,14 +19,14 @@ export function trojan_outbound(server, tag) {
protocol: "trojan",
tag: tag,
settings: {
servers: [
{
servers: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
email: server["username"],
password: server["password"]
}
]
};
})
},
streamSettings: stream_settings_result
},

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
import { fallbacks, reality_inbound_settings, tls_inbound_settings } from "../common/tls.mjs";
function vless_inbound_user(k, flow) {
@ -29,10 +29,10 @@ export function vless_outbound(server, tag) {
protocol: "vless",
tag: tag,
settings: {
vnext: [
{
vnext: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
users: [
{
email: server["username"],
@ -42,7 +42,7 @@ export function vless_outbound(server, tag) {
}
]
}
]
})
},
streamSettings: stream_settings_result
},

View File

@ -1,6 +1,6 @@
"use strict";
import { stream_settings } from "../common/stream.mjs";
import { port_array, stream_settings } from "../common/stream.mjs";
export function vmess_outbound(server, tag) {
const stream_settings_object = stream_settings(server, "vmess", tag);
@ -11,10 +11,10 @@ export function vmess_outbound(server, tag) {
protocol: "vmess",
tag: tag,
settings: {
vnext: [
{
vnext: map(port_array(server["server_port"]), function (v) {
return {
address: server["server"],
port: int(server["server_port"]),
port: v,
users: [
{
email: server["username"],
@ -23,8 +23,8 @@ export function vmess_outbound(server, tag) {
security: server["vmess_security"]
}
]
}
]
};
})
},
streamSettings: stream_settings_result
},

View File

@ -184,6 +184,7 @@ return view.extend({
ss.addremove = true;
ss.tab('general', _('General Settings'));
ss.nodescriptions = true;
o = ss.taboption('general', form.Value, "alias", _("Alias (optional)"));
o.optional = true;
@ -192,15 +193,15 @@ return view.extend({
o.datatype = 'host';
o.rmempty = false;
o = ss.taboption('general', form.Value, 'server_port', _('Server Port'));
o = ss.taboption('general', form.DynamicList, 'server_port', _('Server Port'));
o.datatype = 'port';
o.rmempty = false;
o.modalonly = true;
o = ss.taboption('general', form.Value, 'username', _('Email / Username'), _('Optional; username for SOCKS / HTTP outbound, email for other outbound.'));
o.modalonly = true;
o = ss.taboption('general', form.Value, 'password', _('UserId / Password'), _('Fill user_id for vmess / VLESS, or password for other outbound (also supports <a href="https://github.com/XTLS/Xray-core/issues/158">Xray UUID Mapping</a>)'));
o.modalonly = true;
o.rmempty = false;
ss.tab('resolving', _("Server Hostname Resolving"));