{{- $GiB := 1073741824.0 -}} {{- $used := printf "%.2f" (divf (add (.UserInfo.Download | default 0 | float64) (.UserInfo.Upload | default 0 | float64)) $GiB) -}} {{- $traffic := (.UserInfo.Traffic | default 0 | float64) -}} {{- $total := printf "%.2f" (divf $traffic $GiB) -}} {{- $ExpiredAt := "" -}} {{- $expStr := printf "%v" .UserInfo.ExpiredAt -}} {{- if regexMatch `^[0-9]+$` $expStr -}} {{- $ts := $expStr | float64 -}} {{- $sec := ternary (divf $ts 1000.0) $ts (ge (len $expStr) 13) -}} {{- $ExpiredAt = (date "2006-01-02 15:04:05" (unixEpoch ($sec | int64))) -}} {{- else -}} {{- $ExpiredAt = $expStr -}} {{- end -}} {{- $sortFields := list "Sort" "Port" "Name" -}} {{- $sortConfig := dict "Sort" "asc" "Port" "asc" "Name" "asc" -}} {{- $byKey := dict -}} {{- range $p := .Proxies -}} {{- $keyParts := list -}} {{- range $field := $sortFields -}} {{- $order := index $sortConfig $field -}} {{- $val := default "" (printf "%v" (index $p $field)) -}} {{- if or (eq $field "Sort") (eq $field "Port") -}} {{- $val = printf "%08d" (int (default 0 (index $p $field))) -}} {{- end -}} {{- if eq $order "desc" -}} {{- $val = printf "~%s" $val -}} {{- end -}} {{- $keyParts = append $keyParts $val -}} {{- end -}} {{- $_ := set $byKey (join "|" $keyParts) $p -}} {{- end -}} {{- $sorted := list -}} {{- range $k := sortAlpha (keys $byKey) -}} {{- $sorted = append $sorted (index $byKey $k) -}} {{- end -}} {{- $supportSet := dict "shadowsocks" true "vmess" true "vless" true "trojan" true "hysteria2" true "hysteria" true "tuic" true "anytls" true -}} {{- $supportedProxies := list -}} {{- range $proxy := $sorted -}} {{- if hasKey $supportSet $proxy.Type -}} {{- $supportedProxies = append $supportedProxies $proxy -}} {{- end -}} {{- end -}} {{- $proxyNames := "" -}} {{- range $proxy := $supportedProxies -}} {{- if eq $proxyNames "" -}} {{- $proxyNames = printf "%q" $proxy.Name -}} {{- else -}} {{- $proxyNames = printf "%s, %q" $proxyNames $proxy.Name -}} {{- end -}} {{- end -}} # {{ .SiteName }}-{{ .SubscribeName }} # Traffic: {{ $used }} GiB/{{ $total }} GiB | Expires: {{ $ExpiredAt }} # Generated at: {{ now | date "2006-01-02 15:04:05" }} # 分流模板: 666OS/YYDS Pro_cn v2.0.6 # 节点来源: PPanel 动态用户节点 x-url-test: &url-test { type: url-test, url: "https://www.gstatic.com/generate_204", interval: 300, empty-fallback: REJECT, include-all: true, hidden: true, tolerance: 50 } x-load-balance: &load-balance { type: load-balance, url: "https://www.gstatic.com/generate_204", interval: 300, empty-fallback: REJECT, include-all: true, hidden: true, strategy: consistent-hashing } x-fallback: &fallback { type: fallback, url: "https://www.gstatic.com/generate_204", interval: 300, empty-fallback: REJECT } x-filter-hk: &filter-hk "^(?i)(?=.*(香港|港深|深港|沪港|广港|陆港|(?