#!/bin/bash
export LC_ALL=C
BIN=/opt/proxy-lab/bin/sing-box
$BIN schema > /tmp/sb_schema.json 2>/dev/null
echo "schema bytes: $(wc -c </tmp/sb_schema.json)"
python3 - <<'PY'
import json
s=json.load(open('/tmp/sb_schema.json'))
def walk(node,path=""):
    if isinstance(node,dict):
        for k,v in node.items():
            if k.lower() in ("ech","echconfiglist","ech_config"):
                print("FOUND",path+"/"+k,":",json.dumps(v)[:500])
            walk(v,path+"/"+k)
    elif isinstance(node,list):
        for i,v in enumerate(node):
            walk(v,path+f"[{i}]")
walk(s)
PY
echo "---- raw grep ----"
grep -o '.\{0,120\}ech.\{0,200\}' /tmp/sb_schema.json | head -5
