From b6bec0fc511b525e05078488f8796c32ec587d0a Mon Sep 17 00:00:00 2001 From: Andrey Petelin Date: Fri, 3 Oct 2025 13:45:00 +0500 Subject: [PATCH] refactor: rename VLESS-specific functions to generic outbound transport and TLS setters --- podkop/files/usr/lib/sing_box_config_facade.sh | 6 +++--- .../files/usr/lib/sing_box_config_manager.sh | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/podkop/files/usr/lib/sing_box_config_facade.sh b/podkop/files/usr/lib/sing_box_config_facade.sh index 28606db..f087bb6 100644 --- a/podkop/files/usr/lib/sing_box_config_facade.sh +++ b/podkop/files/usr/lib/sing_box_config_facade.sh @@ -87,11 +87,11 @@ sing_box_cf_add_proxy_outbound() { ws_host=$(url_get_query_param "$url" "host") ws_early_data=$(url_get_query_param "$url" "ed") - config=$(sing_box_cm_set_vless_ws_transport "$config" "$tag" "$ws_path" "$ws_host" "$ws_early_data") + config=$(sing_box_cm_set_ws_transport_for_outbound "$config" "$tag" "$ws_path" "$ws_host" "$ws_early_data") ;; grpc) # TODO(ampetelin): Add handling of optional gRPC parameters; example links are needed. - config=$(sing_box_cm_set_vless_grpc_transport "$config" "$tag") + config=$(sing_box_cm_set_grpc_transport_for_outbound "$config" "$tag") ;; *) log "Unknown transport '$transport' detected." "error" @@ -111,7 +111,7 @@ sing_box_cf_add_proxy_outbound() { short_id=$(url_get_query_param "$url" "sid") config=$( - sing_box_cm_set_vless_tls \ + sing_box_cm_set_tls_for_outbound \ "$config" \ "$tag" \ "$sni" \ diff --git a/podkop/files/usr/lib/sing_box_config_manager.sh b/podkop/files/usr/lib/sing_box_config_manager.sh index 989111e..10da87a 100644 --- a/podkop/files/usr/lib/sing_box_config_manager.sh +++ b/podkop/files/usr/lib/sing_box_config_manager.sh @@ -622,7 +622,7 @@ sing_box_cm_add_vless_outbound() { } ####################################### -# Set gRPC transport settings for a VLESS outbound in a sing-box JSON configuration. +# Set gRPC transport settings for an outbound in a sing-box JSON configuration. # Arguments: # config: JSON configuration (string) # tag: string, identifier of the outbound to modify @@ -633,9 +633,9 @@ sing_box_cm_add_vless_outbound() { # Outputs: # Writes updated JSON configuration to stdout # Example: -# CONFIG=$(sing_box_cm_set_vless_grpc_transport "$CONFIG" "vless-tls-grpc-out") +# CONFIG=$(sing_box_cm_set_grpc_transport_for_outbound "$CONFIG" "vless-tls-grpc-out") ####################################### -sing_box_cm_set_vless_grpc_transport() { +sing_box_cm_set_grpc_transport_for_outbound() { local config="$1" local tag="$2" local service_name="$3" @@ -667,7 +667,7 @@ sing_box_cm_set_vless_grpc_transport() { } ####################################### -# Set WebSocket transport settings for a VLESS outbound in a sing-box JSON configuration. +# Set WebSocket transport settings for an outbound in a sing-box JSON configuration. # Arguments: # config: JSON configuration (string) # tag: string, identifier of the outbound to modify @@ -678,9 +678,9 @@ sing_box_cm_set_vless_grpc_transport() { # Outputs: # Writes updated JSON configuration to stdout # Example: -# CONFIG=$(sing_box_cm_set_vless_ws_transport "$CONFIG" "vless-tls-ws-out" "/path" "example.com") +# CONFIG=$(sing_box_cm_set_ws_transport_for_outbound "$CONFIG" "vless-tls-ws-out" "/path" "example.com") ####################################### -sing_box_cm_set_vless_ws_transport() { +sing_box_cm_set_ws_transport_for_outbound() { local config="$1" local tag="$2" local path="$3" @@ -717,7 +717,7 @@ sing_box_cm_set_vless_ws_transport() { } ####################################### -# Set TLS settings for a VLESS outbound in a sing-box JSON configuration. +# Set TLS settings for an outbound in a sing-box JSON configuration. # Arguments: # config: JSON configuration (string) # tag: string, identifier of the outbound to modify @@ -731,11 +731,11 @@ sing_box_cm_set_vless_ws_transport() { # Writes updated JSON configuration to stdout # Example: # CONFIG=$( -# sing_box_cm_set_vless_tls "$CONFIG" "vless-reality-out" "example.com" false null "chrome" \ +# sing_box_cm_set_tls_for_outbound "$CONFIG" "vless-reality-out" "example.com" false null "chrome" \ # "jNXHt1yRo0vDuchQlIP6Z0ZvjT3KtzVI-T4E7RoLJS0" "0123456789abcdef" # ) ####################################### -sing_box_cm_set_vless_tls() { +sing_box_cm_set_tls_for_outbound() { local config="$1" local tag="$2" local server_name="$3"