diff --git a/String-example.md b/String-example.md index a07395f..d694504 100644 --- a/String-example.md +++ b/String-example.md @@ -1,68 +1,76 @@ -# Shadowsocks -Тут всё просто - -## Shadowsocks-old +## Shadowsocks ``` -ss://YWVzLTI1Ni1nY206RmJwUDJnSStPczJKK1kzdkVhTnVuOUZ2ZjJZYUhNUlN1L1BBdEVqMks1VT0@example.com:80?type=tcp#example-ss-old +ss://MjAyMi1ibGFrZTMtYWVzLTI1Ni1nY206ZG1DbHkvWmgxNVd3OStzK0dGWGlGVElrcHc3Yy9xQ0lTYUJyYWk3V2hoWT0@127.0.0.1:25144?type=tcp#shadowsocks-no-client +ss://MjAyMi1ibGFrZTMtYWVzLTI1Ni1nY206S3FiWXZiNkhwb1RmTUt0N2VGcUZQSmJNNXBXaHlFU0ZKTXY2dEp1Ym1Fdz06dzRNMEx5RU9OTGQ5SWlkSGc0endTbzN2R3h4NS9aQ3hId0FpaWlxck5hcz0@127.0.0.1:26627?type=tcp#shadowsocks-client +ss://2022-blake3-aes-256-gcm:dmCly/Zh15Ww9+s+GFXiFTIkpw7c/qCISaBrai7WhhY=@127.0.0.1:27214?type=tcp#shadowsocks-plain-user ``` -## Shadowsocks-2022 +## VLESS ``` -ss://2022-blake3-aes-128-gcm:5NgF%2B9eM8h4OnrTbHp%2B8UA%3D%3D%3Am8tbs5aKLYG7dN9f3xsiKA%3D%3D@example.com:80#example-ss2022 +# tcp +vless://94792286-7bbe-4f33-8b36-18d1bbf70723@127.0.0.1:34520?type=tcp&encryption=none&security=none#vless-tcp-none +vless://e95163dc-905e-480a-afe5-20b146288679@127.0.0.1:16399?type=tcp&encryption=none&security=reality&pbk=tqhSkeDR6jsqC-BYCnZWBrdL33g705ba8tV5-ZboWTM&fp=chrome&sni=google.com&sid=f6&spx=%2F#vless-tcp-reality +vless://2e9e8288-060e-4da2-8b9f-a1c81826feb7@127.0.0.1:19316?type=tcp&encryption=none&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#vless-tcp-tls +vless://0235c833-dc29-4202-8a7b-1bbba5b516a2@127.0.0.1:22993?type=tcp&encryption=none&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#vless-tcp-tls-insecure +vless://17776137-e747-4268-a84d-99fd798accac@127.0.0.1:48076?type=tcp&encryption=none&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com&ech=AFP%2BDQBPAAAgACDJXiKG5eoCHfd1MbMxgccxgrbGisBPPe3bz1KVIETUXQAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAAAAAA%3D%3D#vless-tcp-tls-ech + +# mKCP +vless://72e201d7-7841-4a32-b266-4aa3eb776d51@127.0.0.1:17270?type=kcp&encryption=none&headerType=none&seed=AirziWi4ng&security=none#vless-mKCP + +# WebSocket +vless://d86daef7-565b-4ecd-a9ee-bac847ad38e6@127.0.0.1:12928?type=ws&encryption=none&path=%2Fwspath&host=google.com&security=none#vless-websocket-none +vless://fe0f0941-09a9-4e46-bc69-e00190d7bb9c@127.0.0.1:10156?type=ws&encryption=none&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#vless-websocket-tls +vless://599e8659-e2ef-47d9-bf72-2f9b4b673474@127.0.0.1:36567?type=ws&encryption=none&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#vless-websocket-tls-insecure +vless://4d21ce62-8723-4c4d-93e3-d586b107aa40@127.0.0.1:51394?type=ws&encryption=none&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com&ech=AF3%2BDQBZAAAgACD7fjrtDMlcigKXFBKoLn6UDB9%2BWR6HBZpY96DlBiD%2BIwAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D#vless-websocket-tls-ech + +# gRPC +vless://974b39e3-f7bf-42b9-933c-16699c635e77@127.0.0.1:15633?type=grpc&encryption=none&serviceName=TunService&authority=&security=none#vless-gRPC-none +vless://651e7eca-5152-46f1-baf2-d502e0af7b27@127.0.0.1:28535?type=grpc&encryption=none&serviceName=TunService&authority=authority&security=reality&pbk=nhZ7NiKfcqESa5ZeBFfsq9o18W-OWOAHLln9UmuVXSk&fp=chrome&sni=google.com&sid=11cbaeaa&spx=%2F#vless-gRPC-reality +vless://af1f8b5f-26c9-4fe8-8ce7-6d6366c5c9ce@127.0.0.1:47904?type=grpc&encryption=none&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#vless-gRPC-tls +vless://95f2c4bb-abcb-47ba-bfad-e181c03e4659@127.0.0.1:34530?type=grpc&encryption=none&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#vless-gRPC-tls-insecure +vless://bd39490f-9a4f-49b2-96b6-824190cf89e9@127.0.0.1:27779?type=grpc&encryption=none&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com&ech=AF3%2BDQBZAAAgACBc%2FiNdo4QkTt9eQCQgkOiJVSfA9G6UWAyipaBFtBD%2FVQAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D#vless-gRPC-tls-ech + +# HTTPUpgrade +vless://2b98f144-847f-42f7-8798-e1a32d27bdc7@127.0.0.1:47154?type=httpupgrade&encryption=none&path=%2Fhttpupgradepath&host=google.com&security=none#vless-httpupgrade-none +vless://76dbd0ff-1a35-4f0c-a9ba-3c5890b7dea6@127.0.0.1:50639?type=httpupgrade&encryption=none&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#vless-httpupgrade-tls +vless://6d229881-50ed-4f3f-995d-bd3e725fdbff@127.0.0.1:57616?type=httpupgrade&encryption=none&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#vless-httpupgrade-tls-insecure +vless://1897e9e4-6f5d-4a85-9512-9192e76c3f04@127.0.0.1:38658?type=httpupgrade&encryption=none&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com&ech=AF3%2BDQBZAAAgACCmXTMzlrdcCk2FyINAWKZ4DBxq4%2BCgmJ69v%2BmH4EMlEQAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D#vless-httpupgrade-tls-ech + +# XHTTP +vless://c2841505-ec32-4b8d-b6dd-3e19d648c321@127.0.0.1:45507?type=xhttp&encryption=none&path=%2Fxhttppath&host=xhttp&mode=auto&security=none#vless-xhttp ``` +## Trojan ``` -ss://MjAyMi1ibGFrZTMtYWVzLTEyOC1nY206Y21lZklCdDhwMTJaZm1QWUplMnNCNThRd3R3NXNKeVpUV0Z6ZENKV2taOD06eEJHZUxiMWNPTjFIeE9CenF6UlN0VFdhUUh6YWM2cFhRVFNZd2dVV2R1RT0@example.com:81?type=tcp#example-ss2022 -``` -Может быть без `?type=tcp` +# tcp +trojan://04agAQapcl@127.0.0.1:33641?type=tcp&security=none#trojan-tcp-none +trojan://cME3ZlUrYF@127.0.0.1:43772?type=tcp&security=reality&pbk=DckTwU6p6pTX9QxFXOi6vH4Vzt_RCE1vMCnj2c6hvjw&fp=chrome&sni=google.com&sid=221a80cf94&spx=%2F#trojan-tcp-reality +trojan://EJjpAj02lg@127.0.0.1:11381?type=tcp&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#trojan-tcp-tls +trojan://ZP2Ik5sxN3@127.0.0.1:16247?type=tcp&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#trojan-tcp-tls-insecure +trojan://90caP481ay@127.0.0.1:59708?type=tcp&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&ech=AF3%2BDQBZAAAgACC2y%2BAe4dqthLNpfvmtE6g%2BnaJ%2FciK6P%2BREbRLkR%2Fg%2FEgAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D&sni=google.com#trojan-tcp-tls-ech -# VLESS +# mKCP +trojan://N5v7iIOe9G@127.0.0.1:36319?type=kcp&headerType=none&seed=P91wFIfjzZ&security=none#trojan-mKCP -## Reality -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?type=tcp&security=reality&pbk=ARQzddtXPJZHinwkPbgVpah9uwPTuzdjU9GpbUkQJkc&fp=chrome&sni=sni.server.com&sid=6cabf01472a3&spx=%2F&flow=xtls-rprx-vision#vless-reality -``` +# WebSocket +trojan://G3cE9phv1g@127.0.0.1:57370?type=ws&path=%2Fwspath&host=google.com&security=none#trojan-websocket-none +trojan://FBok41WczO@127.0.0.1:59919?type=ws&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#trojan-websocket-tls +trojan://bhwvndUBPA@127.0.0.1:22969?type=ws&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#trojan-websocket-tls-insecur +trojan://pwiduqFUWO@127.0.0.1:46765?type=ws&path=%2Fwspath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&ech=AF3%2BDQBZAAAgACCFcQYEtwrFOidJJLYHvSiN%2BljRgaAIrNHoVnio3uXAOwAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D&sni=google.com#trojan-websocket-tls-ech -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@123.123.123.123:2082?security=reality&sni=sni.server.com&alpn=h2,http/1.1&allowInsecure=1&fp=chrome&pbk=ARQzddtXPJZHinwkPbgVpah9uwPTuzdjU9GpbUkQJkc&sid=6cabf01472a3&type=grpc&encryption=none#vless-reality-strange -``` +# gRPC +trojan://WMR7qkKhsV@127.0.0.1:27897?type=grpc&serviceName=TunService&authority=authority&security=none#trojan-gRPC-none +trojan://KVuRNsu6KG@127.0.0.1:46077?type=grpc&serviceName=TunService&authority=authority&security=reality&pbk=Xn59i4gum3ppCICS6-_NuywrhHIVVAH54b2mjd5CFkE&fp=chrome&sni=google.com&sid=e5be&spx=%2F#trojan-gRPC-reality +trojan://7BJtbywy8h@127.0.0.1:10627?type=grpc&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#trojan-gRPC-tls +trojan://TI3PakvtP4@127.0.0.1:10435?type=grpc&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#trojan-gRPC-tls-insecure +trojan://mbzoVKL27h@127.0.0.1:38681?type=grpc&serviceName=TunService&authority=authority&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&ech=AF3%2BDQBZAAAgACCq72Ru3VbFlDpKttl3LccmInu8R2oAsCr8wzyxB0vZZQAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D&sni=google.com#trojan-gRPC-tls-ech -## TLS -1. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?type=tcp&security=tls&fp=&alpn=h3%2Ch2%2Chttp%2F1.1#vless-tls -``` +# HTTPUpgrade +trojan://uc44gBwOKQ@127.0.0.1:29085?type=httpupgrade&path=%2Fhttpupgradepath&host=google.com&security=none#trojan-httpupgrade-none +trojan://MhNxbcVB14@127.0.0.1:32700?type=httpupgrade&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=google.com#trojan-httpupgrade-tls +trojan://7SOQFUpLob@127.0.0.1:28474?type=httpupgrade&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&allowInsecure=1&sni=google.com#trojan-httpupgrade-tls-insecure +trojan://ou8pLSyx9N@127.0.0.1:17737?type=httpupgrade&path=%2Fhttpupgradepath&host=google.com&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&ech=AF3%2BDQBZAAAgACB%2FlkIkit%2BblFzE7PtbYDVF3NXK8olXJ5a7YwY%2Biy9QQwAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAApnb29nbGUuY29tAAA%3D&sni=google.com#trojan-httpupgrade-tls-ech -2. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?security=tls&sni=sni.server.com&fp=chrome&type=tcp&flow=xtls-rprx-vision&encryption=none#vless-tls-withot-alpn -``` -3. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443/?type=ws&encryption=none&path=%2Fwebsocket&security=tls&sni=sni.server.com&fp=chrome#vless-tls-ws -``` - -4. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?security=tls&sni=sni.server.com&type=ws&path=/?ed%3D2560&host=sni.server.com&encryption=none#vless-tls-ws-2 -``` - -5. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?security=tls&sni=sni.server.com&fp=chrome&type=ws&path=/websocket&encryption=none#vless-tls-ws-3 -``` - -6. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443/?type=ws&encryption=none&path=%2Fwebsocket&security=tls&sni=sni.server.com&fp=chrome#vless-tls-ws-4 -``` - -7. -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@sub.example.com:443?type=ws&path=%2Fdir%2Fpath&host=sub.example.com&security=tls#configname -``` - -## No security -``` -vless://8100b6eb-3fd1-4e73-8ccf-b4ac961232d6@example.com:443?type=tcp&security=none#vless-tls-no-encrypt +# XHTTP +trojan://VEetltxLtw@127.0.0.1:59072?type=xhttp&path=%2Fxhttppath&host=google.com&mode=auto&security=none#trojan-xhttp ``` \ No newline at end of file diff --git a/luci-app-podkop/po/ru/podkop.po b/luci-app-podkop/po/ru/podkop.po index cbe4deb..0567231 100644 --- a/luci-app-podkop/po/ru/podkop.po +++ b/luci-app-podkop/po/ru/podkop.po @@ -606,7 +606,7 @@ msgid "does not work in browser" msgstr "не работает в браузере" msgid "works on router" -msgstr "не работает в браузере" +msgstr "работает на роутере" msgid "does not work on router" msgstr "не работает на роутере" diff --git a/podkop/files/usr/lib/sing_box_config_facade.sh b/podkop/files/usr/lib/sing_box_config_facade.sh index 28606db..bdff029 100644 --- a/podkop/files/usr/lib/sing_box_config_facade.sh +++ b/podkop/files/usr/lib/sing_box_config_facade.sh @@ -76,57 +76,8 @@ sing_box_cf_add_proxy_outbound() { packet_encoding=$(url_get_query_param "$url" "packetEncoding") config=$(sing_box_cm_add_vless_outbound "$config" "$tag" "$host" "$port" "$uuid" "$flow" "" "$packet_encoding") - - local transport - transport=$(url_get_query_param "$url" "type") - case "$transport" in - tcp | raw) ;; - ws) - local ws_path ws_host ws_early_data - ws_path=$(url_get_query_param "$url" "path") - 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") - ;; - grpc) - # TODO(ampetelin): Add handling of optional gRPC parameters; example links are needed. - config=$(sing_box_cm_set_vless_grpc_transport "$config" "$tag") - ;; - *) - log "Unknown transport '$transport' detected." "error" - ;; - esac - - local security - security=$(url_get_query_param "$url" "security") - case "$security" in - tls | reality) - local sni insecure alpn fingerprint public_key short_id - sni=$(url_get_query_param "$url" "sni") - insecure=$(url_get_query_param "$url" "allowInsecure") - alpn=$(comma_string_to_json_array "$(url_get_query_param "$url" "alpn")") - fingerprint=$(url_get_query_param "$url" "fp") - public_key=$(url_get_query_param "$url" "pbk") - short_id=$(url_get_query_param "$url" "sid") - - config=$( - sing_box_cm_set_vless_tls \ - "$config" \ - "$tag" \ - "$sni" \ - "$([ "$insecure" == "1" ] && echo true)" \ - "$([ "$alpn" == "[]" ] && echo null || echo "$alpn")" \ - "$fingerprint" \ - "$public_key" \ - "$short_id" - ) - ;; - none) ;; - *) - log "Unknown security '$security' detected." "error" - ;; - esac + config=$(_add_outbound_security "$config" "$tag" "$url") + config=$(_add_outbound_transport "$config" "$tag" "$url") ;; ss) local userinfo tag host port method password udp_over_tcp @@ -158,6 +109,17 @@ sing_box_cf_add_proxy_outbound() { "$([ "$udp_over_tcp" == "1" ] && echo 2)" # if udp_over_tcp is enabled, enable version 2 ) ;; + trojan) + local tag host port password + tag=$(get_outbound_tag_by_section "$section") + host=$(url_get_host "$url") + port=$(url_get_port "$url") + password=$(url_get_userinfo "$url") + + config=$(sing_box_cm_add_trojan_outbound "$config" "$tag" "$host" "$port" "$password") + config=$(_add_outbound_security "$config" "$tag" "$url") + config=$(_add_outbound_transport "$config" "$tag" "$url") + ;; *) log "Unsupported proxy $scheme type" exit 1 @@ -167,6 +129,75 @@ sing_box_cf_add_proxy_outbound() { echo "$config" } +_add_outbound_security() { + local config="$1" + local outbound_tag="$2" + local url="$3" + + local security + security=$(url_get_query_param "$url" "security") + case "$security" in + tls | reality) + local sni insecure alpn fingerprint public_key short_id + sni=$(url_get_query_param "$url" "sni") + insecure=$(url_get_query_param "$url" "allowInsecure") + alpn=$(comma_string_to_json_array "$(url_get_query_param "$url" "alpn")") + fingerprint=$(url_get_query_param "$url" "fp") + public_key=$(url_get_query_param "$url" "pbk") + short_id=$(url_get_query_param "$url" "sid") + + config=$( + sing_box_cm_set_tls_for_outbound \ + "$config" \ + "$outbound_tag" \ + "$sni" \ + "$([ "$insecure" == "1" ] && echo true)" \ + "$([ "$alpn" == "[]" ] && echo null || echo "$alpn")" \ + "$fingerprint" \ + "$public_key" \ + "$short_id" + ) + ;; + none) ;; + *) + log "Unknown security '$security' detected." "error" + ;; + esac + + echo "$config" +} + +_add_outbound_transport() { + local config="$1" + local outbound_tag="$2" + local url="$3" + + local transport + transport=$(url_get_query_param "$url" "type") + case "$transport" in + tcp | raw) ;; + ws) + local ws_path ws_host ws_early_data + ws_path=$(url_get_query_param "$url" "path") + ws_host=$(url_get_query_param "$url" "host") + ws_early_data=$(url_get_query_param "$url" "ed") + + config=$( + sing_box_cm_set_ws_transport_for_outbound "$config" "$outbound_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_grpc_transport_for_outbound "$config" "$outbound_tag") + ;; + *) + log "Unknown transport '$transport' detected." "error" + ;; + esac + + echo "$config" +} + sing_box_cf_add_json_outbound() { local config="$1" local section="$2" diff --git a/podkop/files/usr/lib/sing_box_config_manager.sh b/podkop/files/usr/lib/sing_box_config_manager.sh index 989111e..33f8703 100644 --- a/podkop/files/usr/lib/sing_box_config_manager.sh +++ b/podkop/files/usr/lib/sing_box_config_manager.sh @@ -622,7 +622,47 @@ sing_box_cm_add_vless_outbound() { } ####################################### -# Set gRPC transport settings for a VLESS outbound in a sing-box JSON configuration. +# Add a Trojan outbound to the outbounds section of a sing-box JSON configuration. +# Arguments: +# config: string, JSON configuration +# tag: string, identifier for the outbound +# server_address: string, IP address or hostname of the Trojan server +# server_port: number, port of the Trojan server +# password: string, password for authentication +# network: string, optional network type (e.g., "tcp") +# Outputs: +# Writes updated JSON configuration to stdout +# Example: +# CONFIG=$(sing_box_cm_add_trojan_outbound "$CONFIG" "trojan-out" "example.com" 443 "supersecretpassword" "tcp") +####################################### +sing_box_cm_add_trojan_outbound() { + local config="$1" + local tag="$2" + local server_address="$3" + local server_port="$4" + local password="$5" + local network="$6" + + echo "$config" | jq \ + --arg tag "$tag" \ + --arg server_address "$server_address" \ + --arg server_port "$server_port" \ + --arg password "$password" \ + --arg network "$network" \ + '.outbounds += [( + { + type: "trojan", + tag: $tag, + server: $server_address, + server_port: ($server_port | tonumber), + password: $password + } + + (if $network != "" then {network: $network} else {} end) + )]' +} + +####################################### +# 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 +673,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 +707,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 +718,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 +757,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 +771,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"