| import os, json |
|
|
| UUID = os.environ.get('KEY') |
|
|
| conf = json.dumps({ |
| "log": { |
| "level": "info", |
| "timestamp": True |
| }, |
| "inbounds": [ |
| { |
| "type": "vless", |
| "tag": "vless-in", |
| "listen": "::", |
| "listen_port": 7860, |
| "users": [ |
| { |
| "name": "user1", |
| "uuid": UUID |
| } |
| ], |
| "transport": { |
| "type": "ws", |
| "path": "/ws" |
| } |
| } |
| ], |
| "outbounds": [ |
| { |
| "type": "direct", |
| "tag": "direct" |
| } |
| ] |
| }) |
|
|
| print(conf) |
|
|
| with open("/etc/sing-box/config.json", "w", encoding="utf-8") as f: |
| f.write(conf) |
|
|
| os.system("sing-box run -c /etc/sing-box/config.json") |