mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-06-28 13:05:22 +03:00
fix: support multiple server ports for hysteria2 outbounds
This commit is contained in:
@@ -692,6 +692,11 @@ sing_box_cm_add_hysteria2_outbound() {
|
|||||||
local download_mbps="$9"
|
local download_mbps="$9"
|
||||||
local network="${10}"
|
local network="${10}"
|
||||||
|
|
||||||
|
local is_multi_port="false"
|
||||||
|
case "$server_port" in
|
||||||
|
*","*|*"-"*) is_multi_port="true" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "$config" | jq \
|
echo "$config" | jq \
|
||||||
--arg tag "$tag" \
|
--arg tag "$tag" \
|
||||||
--arg server_address "$server_address" \
|
--arg server_address "$server_address" \
|
||||||
@@ -702,14 +707,25 @@ sing_box_cm_add_hysteria2_outbound() {
|
|||||||
--arg upload_mbps "$upload_mbps" \
|
--arg upload_mbps "$upload_mbps" \
|
||||||
--arg download_mbps "$download_mbps" \
|
--arg download_mbps "$download_mbps" \
|
||||||
--arg network "$network" \
|
--arg network "$network" \
|
||||||
'.outbounds += [(
|
--argjson is_multi_port "$is_multi_port" \
|
||||||
|
'
|
||||||
|
def parse_port_entry:
|
||||||
|
if index("-") then split("-") | join(":")
|
||||||
|
else . + ":" + .
|
||||||
|
end;
|
||||||
|
|
||||||
|
.outbounds += [(
|
||||||
{
|
{
|
||||||
type: "hysteria2",
|
type: "hysteria2",
|
||||||
tag: $tag,
|
tag: $tag,
|
||||||
server: $server_address,
|
server: $server_address,
|
||||||
server_port: ($server_port | tonumber),
|
|
||||||
password: $password
|
password: $password
|
||||||
}
|
}
|
||||||
|
+ (if $is_multi_port then {
|
||||||
|
server_ports: ($server_port | split(",") | map(ltrimstr(" ") | rtrimstr(" ") | parse_port_entry))
|
||||||
|
} else {
|
||||||
|
server_port: ($server_port | tonumber)
|
||||||
|
} end)
|
||||||
+ (if $obfuscator_type != "" and $obfuscator_password != "" then {
|
+ (if $obfuscator_type != "" and $obfuscator_password != "" then {
|
||||||
obfs: {
|
obfs: {
|
||||||
type: $obfuscator_type,
|
type: $obfuscator_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user