From f5a629afcf0fdf1478574216863b6e51dc5f993e Mon Sep 17 00:00:00 2001 From: Andrey Petelin Date: Thu, 2 Oct 2025 17:48:08 +0500 Subject: [PATCH] feat: add optional domain_resolver parameter to interface outbound config function --- podkop/files/usr/lib/sing_box_config_manager.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/podkop/files/usr/lib/sing_box_config_manager.sh b/podkop/files/usr/lib/sing_box_config_manager.sh index 61fcfb7..989111e 100644 --- a/podkop/files/usr/lib/sing_box_config_manager.sh +++ b/podkop/files/usr/lib/sing_box_config_manager.sh @@ -788,6 +788,7 @@ sing_box_cm_set_vless_tls() { # config: JSON configuration (string) # tag: string, identifier for the outbound # interface: string, network interface to bind the outbound +# domain_resolver: string, tag of the domain resolver to be used for this outbound (optional) # Outputs: # Writes updated JSON configuration to stdout # Example: @@ -797,15 +798,20 @@ sing_box_cm_add_interface_outbound() { local config="$1" local tag="$2" local interface="$3" + local domain_resolver="$4" echo "$config" | jq \ --arg tag "$tag" \ --arg interface "$interface" \ - '.outbounds += [{ - type: "direct", - tag: $tag, - bind_interface: $interface - }]' + --arg domain_resolver "$domain_resolver" \ + '.outbounds += [ + { + type: "direct", + tag: $tag, + bind_interface: $interface + } + + (if $domain_resolver != "" then {domain_resolver: $domain_resolver} else {} end) + ]' } #######################################