From 0bf9a807c57dfd85af860893e79080913518b4f7 Mon Sep 17 00:00:00 2001 From: reonokiy Date: Wed, 19 Feb 2025 19:25:04 +0800 Subject: [PATCH] init --- .gitignore | 2 + docker-compose.yaml | 16 +++++ templates/mihomo.override.yaml | 22 ++++++ templates/singbox.json | 128 +++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 .gitignore create mode 100644 docker-compose.yaml create mode 100644 templates/mihomo.override.yaml create mode 100644 templates/singbox.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcff16b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +singbox.json +!templates/singbox.json diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..983776b --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +services: + sing-box: + image: ghcr.io/sagernet/sing-box:v1.12.0-alpha.9 + restart: always + container_name: sing-box + ports: + - 443:443 + - 127.0.0.1:10800:8080 + volumes: + - ./singbox.json:/etc/sing-box/config.json:ro + command: -D /var/lib/sing-box -c /etc/sing-box/config.json run + + warp: + image: ghcr.io/aleskxyz/warp-svc:v1.5.0 + restart: always + container_name: warp diff --git a/templates/mihomo.override.yaml b/templates/mihomo.override.yaml new file mode 100644 index 0000000..b164ba3 --- /dev/null +++ b/templates/mihomo.override.yaml @@ -0,0 +1,22 @@ ++proxies: + - name: selfhost+direct + type: ss + server: 127.0.0.1 + port: 443 + password: "{{ op://servers/self_proxy/ss_server_password }}:{{ op://servers/self_proxy/ss_direct_user_password }}" + cipher: 2022-blake3-aes-256-gcm + udp: true + smux: + enabled: true + padding: true + + - name: selfhost+warp + type: ss + server: 127.0.0.1 + port: 443 + password: "{{ op://servers/self_proxy/ss_server_password }}:{{ op://servers/self_proxy/ss_warp_user_password }}" + cipher: 2022-blake3-aes-256-gcm + udp: true + smux: + enabled: true + padding: true diff --git a/templates/singbox.json b/templates/singbox.json new file mode 100644 index 0000000..913d5f4 --- /dev/null +++ b/templates/singbox.json @@ -0,0 +1,128 @@ +{ + "log": { + "disabled": false, + "level": "debug", + "timestamp": true + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "dns:local" + }, + { + "type": "h3", + "tag": "dns:cloudflare", + "server": "1.1.1.1", + "server_port": 443 + } + ], + "rules": [ + { + "auth_user": "direct", + "action": "route", + "server": "dns:cloudflare" + }, + { + "auth_user": "warp", + "action": "route", + "server": "dns:cloudflare" + } + ] + }, + "ntp": { + "enabled": true, + "server": "pool.ntp.org", + "server_port": 123, + "interval": "60m" + }, + "endpoints": [], + "inbounds": [ + { + "type": "mixed", + "tag": "in:mixed", + "listen": "::", + "listen_port": 8080, + "users": [ + { + "username": "direct", + "password": "password" + }, + { + "username": "warp", + "password": "password" + } + ], + "set_system_proxy": false + }, + { + "type": "shadowsocks", + "tag": "in:ss", + "listen": "::", + "listen_port": 443, + "method": "2022-blake3-aes-256-gcm", + "password": "{{ op://servers/self_proxy/ss_server_password }}", + "users": [ + { + "name": "direct", + "password": "{{ op://servers/self_proxy/ss_direct_user_password }}" + }, + { + "name": "warp", + "password": "{{ op://servers/self_proxy/ss_warp_user_password }}" + } + ], + "multiplex": { + "enabled": true, + "padding": true + } + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "out:direct" + }, + { + "type": "socks", + "tag": "out:warp", + "server": "warp", + "server_port": 1080, + "version": "5" + } + ], + "route": { + "rules": [ + { + "inbound": [ + "in:ss", + "in:mixed" + ], + "auth_user": "direct", + "action": "route", + "outbound": "out:direct" + }, + { + "inbound": [ + "in:ss", + "in:mixed" + ], + "auth_user": "warp", + "action": "route", + "outbound": "out:warp" + }, + { + "ip_is_private": true, + "outbound": [ + "out:direct", + "out:warp" + ], + "action": "reject" + } + ], + "default_domain_resolver": { + "server": "dns:local" + }, + "final": "out:direct" + } +}