mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-01-27 12:50:37 +03:00
feat: add optional default_interface parameter and include it in route when provided
This commit is contained in:
@@ -644,12 +644,12 @@ sing_box_cm_add_trojan_outbound() {
|
|||||||
local network="$6"
|
local network="$6"
|
||||||
|
|
||||||
echo "$config" | jq \
|
echo "$config" | jq \
|
||||||
--arg tag "$tag" \
|
--arg tag "$tag" \
|
||||||
--arg server_address "$server_address" \
|
--arg server_address "$server_address" \
|
||||||
--arg server_port "$server_port" \
|
--arg server_port "$server_port" \
|
||||||
--arg password "$password" \
|
--arg password "$password" \
|
||||||
--arg network "$network" \
|
--arg network "$network" \
|
||||||
'.outbounds += [(
|
'.outbounds += [(
|
||||||
{
|
{
|
||||||
type: "trojan",
|
type: "trojan",
|
||||||
tag: $tag,
|
tag: $tag,
|
||||||
@@ -969,6 +969,7 @@ sing_box_cm_add_selector_outbound() {
|
|||||||
# final: string, final outbound tag for unmatched traffic
|
# final: string, final outbound tag for unmatched traffic
|
||||||
# auto_detect_interface: boolean, enable or disable automatic interface detection
|
# auto_detect_interface: boolean, enable or disable automatic interface detection
|
||||||
# default_domain_resolver: string, default DNS resolver for domain-based routing
|
# default_domain_resolver: string, default DNS resolver for domain-based routing
|
||||||
|
# default_interface: string, default network interface to use when auto detection is disabled
|
||||||
# Outputs:
|
# Outputs:
|
||||||
# Writes updated JSON configuration to stdout
|
# Writes updated JSON configuration to stdout
|
||||||
# Example:
|
# Example:
|
||||||
@@ -979,18 +980,22 @@ sing_box_cm_configure_route() {
|
|||||||
local final="$2"
|
local final="$2"
|
||||||
local auto_detect_interface="$3"
|
local auto_detect_interface="$3"
|
||||||
local default_domain_resolver="$4"
|
local default_domain_resolver="$4"
|
||||||
|
local default_interface="$5"
|
||||||
|
|
||||||
echo "$config" | jq \
|
echo "$config" | jq \
|
||||||
--arg final "$final" \
|
--arg final "$final" \
|
||||||
--argjson auto_detect_interface "$auto_detect_interface" \
|
--argjson auto_detect_interface "$auto_detect_interface" \
|
||||||
--arg default_domain_resolver "$default_domain_resolver" \
|
--arg default_domain_resolver "$default_domain_resolver" \
|
||||||
|
--arg default_interface "$default_interface" \
|
||||||
'.route = {
|
'.route = {
|
||||||
rules: (.route.rules // []),
|
rules: (.route.rules // []),
|
||||||
rule_set: (.route.rule_set // []),
|
rule_set: (.route.rule_set // []),
|
||||||
final: $final,
|
final: $final,
|
||||||
auto_detect_interface: $auto_detect_interface,
|
auto_detect_interface: $auto_detect_interface,
|
||||||
default_domain_resolver: $default_domain_resolver
|
default_domain_resolver: $default_domain_resolver
|
||||||
}'
|
}
|
||||||
|
+ (if $default_interface != "" then { default_interface: $default_interface } else {} end)
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
|||||||
Reference in New Issue
Block a user