github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/app/subscription/entries/nonnative/definitions/shadowsocks.jsont (about)

     1  {{if assertExists . "root_!kind" | not}} Unknown environment {{end}}
     2  {{if assertIsOneOf . "root_!kind" "json" | not}} This template only works for json input. {{end}}
     3  
     4  {{ $methodName := tryGet . "root_!json_method_!unquoted" "root_!json_protocol_!unquoted" "root_!json_cipher_!unquoted"}}
     5  {{if assertValueIsOneOf $methodName "chacha20-ietf-poly1305" "chacha20-poly1305" "aes-128-gcm" "aes-256-gcm" | not}}
     6      This template only works for ss. {{end}}
     7  
     8  {{ $server_address := tryGet . "root_!json_server" "root_!json_address" "root_!json_endpoint"}}
     9  {{ $server_port := tryGet . "root_!json_port" "root_!json_server_port" "root_!json_endpoint"}}
    10  {{if $server_address | splitAndGetAfterNth ":" 0 | len | gt 1}}
    11      {{ $server_addressport_unquoted := tryGet . "root_!json_endpoint_!unquoted"}}
    12      {{ $server_port = $server_addressport_unquoted | splitAndGetAfterNth ":" -1}}
    13  
    14      {{ $server_portWithSep := printf ":%v" $server_port}}
    15      {{ $server_address = $server_addressport_unquoted | stringCutSuffix $server_portWithSep | jsonEncode}}
    16  {{end}}
    17  
    18  {{ $name_annotation := tryGet . "root_!json_name_!unquoted" "root_!json_id_!unquoted" "root_!json_tag_!unquoted" "root_!json_remarks_!unquoted" "<default>"}}
    19  
    20  {{$password := tryGet . "root_!json_password" "root_!json_psk"}}
    21  
    22  {
    23      "protocol": "shadowsocks",
    24      "settings": {
    25          "address": {{$server_address}},
    26          "port": {{$server_port}},
    27          "method": {{$methodName | jsonEncode}},
    28          "password": {{$password}}
    29          },
    30      "metadata":{
    31  
    32          "TagName": {{print $name_annotation "_" $server_address | jsonEncode}}
    33  
    34      }
    35  }