diff --git a/examples/bandwidth_limiter/connection.json b/examples/bandwidth_limiter/connection.json new file mode 100644 index 00000000..fb39f24d --- /dev/null +++ b/examples/bandwidth_limiter/connection.json @@ -0,0 +1,57 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bandwidth-limiter", + "tag": "bandwidth-limiter", + "strategy": "connection", + "mode": "duplex", // download, upload + "connection_type": "hwid", // mux, ip + "speed": "1MB", // 100KB, 1GB, etc. + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + } + ], + "route": { + "final": "bandwidth-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bandwidth_limiter/global.json b/examples/bandwidth_limiter/global.json new file mode 100644 index 00000000..759d1f77 --- /dev/null +++ b/examples/bandwidth_limiter/global.json @@ -0,0 +1,56 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bandwidth-limiter", + "tag": "bandwidth-limiter", + "strategy": "global", + "mode": "duplex", // download, upload + "speed": "1MB", // 100KB, 1GB, etc. + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + } + ], + "route": { + "final": "bandwidth-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bandwidth_limiter/multi.json b/examples/bandwidth_limiter/multi.json new file mode 100644 index 00000000..f9665843 --- /dev/null +++ b/examples/bandwidth_limiter/multi.json @@ -0,0 +1,78 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bandwidth-limiter", + "tag": "duplex-bandwidth-limiter", + "strategy": "global", + "mode": "duplex", + "speed": "5MB", + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + }, + { + "type": "bandwidth-limiter", + "tag": "upload-bandwidth-limiter", + "strategy": "global", + "mode": "upload", + "speed": "3MB", + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "duplex-bandwidth-limiter" + } + }, + { + "type": "bandwidth-limiter", + "tag": "download-bandwidth-limiter", + "strategy": "global", + "mode": "download", + "speed": "3MB", + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "upload-bandwidth-limiter" + } + } + ], + "route": { + "final": "download-bandwidth-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bandwidth_limiter/users.json b/examples/bandwidth_limiter/users.json new file mode 100644 index 00000000..dbbef6c1 --- /dev/null +++ b/examples/bandwidth_limiter/users.json @@ -0,0 +1,70 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bandwidth-limiter", + "tag": "bandwidth-limiter", + "strategy": "users", + "users": [ + { + "name": "user1", + "strategy": "connection", // global + "mode": "duplex", // download, upload + "connection_type": "hwid", // mux, ip + "speed": "5MB", // 100KB, 1GB, etc. + }, + { + "name": "user2", + "strategy": "connection", // global + "mode": "duplex", // download, upload + "connection_type": "hwid", // mux, ip + "speed": "1MB", // 100KB, 1GB, etc. + }, + ], + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + } + ], + "route": { + "final": "bandwidth-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bond/client.json b/examples/bond/client.json new file mode 100644 index 00000000..adf5662b --- /dev/null +++ b/examples/bond/client.json @@ -0,0 +1,61 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "mixed", + "tag": "mixed-in", + "listen_port": 7897 + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bond", + "tag": "bond-out", + "outbounds": [ // sum of download_ratio and upload_ratio must be 100 + { + "outbound": { + "type": "vless", + "server": "0.0.0.0", + "server_port": 443, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "network": "tcp", + "bind_interface": "" + }, + "download_ratio": 50, + "upload_ratio": 50 + }, + { + "outbound": { + "type": "vless", + "server": "0.0.0.0", + "server_port": 444, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "network": "tcp", + "bind_interface": "" + }, + "download_ratio": 50, + "upload_ratio": 50 + } + ] + } + ], + "route": { + "final": "bond-out", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bond/client_multi.json b/examples/bond/client_multi.json new file mode 100644 index 00000000..f7a826ab --- /dev/null +++ b/examples/bond/client_multi.json @@ -0,0 +1,49 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "mixed", + "tag": "mixed-in", + "listen_port": 7897 + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bond", + "tag": "bond-out", + "outbounds": [ // sum of download_ratio and upload_ratio must be 100 + { + "outbound": { + "type": "vless", + "server": "0.0.0.0", + "server_port": 443, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "network": "tcp", + }, + "download_ratio": 20, + "upload_ratio": 20, + "count": 5 + } + ] + } + ], + "route": { + "final": "bond-out", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bond/client_split.json b/examples/bond/client_split.json new file mode 100644 index 00000000..e1f0b577 --- /dev/null +++ b/examples/bond/client_split.json @@ -0,0 +1,61 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "mixed", + "tag": "mixed-in", + "listen_port": 7897 + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "bond", + "tag": "bond-out", + "outbounds": [ // sum of download_ratio and upload_ratio must be 100 + { + "outbound": { + "type": "vless", + "server": "0.0.0.0", + "server_port": 443, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "network": "tcp", + "bind_interface": "" + }, + "download_ratio": 100, + "upload_ratio": 0 + }, + { + "outbound": { + "type": "vless", + "server": "0.0.0.0", + "server_port": 444, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "network": "tcp", + "bind_interface": "" + }, + "download_ratio": 0, + "upload_ratio": 100 + } + ] + } + ], + "route": { + "final": "bond-out", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/bond/server.json b/examples/bond/server.json new file mode 100644 index 00000000..f624391d --- /dev/null +++ b/examples/bond/server.json @@ -0,0 +1,54 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "bond", + "tag": "bond-in", + "inbounds": [ + { + "type": "vless", + "listen": "0.0.0.0", + "listen_port": 443, + "users": [ + { + "name": "user", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + }, + { + "type": "vless", + "listen": "0.0.0.0", + "listen_port": 444, + "users": [ + { + "name": "user", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ] + } + ] + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + ], + "route": { + "final": "direct", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/connection_limiter/connection.json b/examples/connection_limiter/connection.json new file mode 100644 index 00000000..0b274ffd --- /dev/null +++ b/examples/connection_limiter/connection.json @@ -0,0 +1,56 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ], + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "connection-limiter", + "tag": "connection-limiter", + "strategy": "connection", + "connection_type": "hwid", // mux, ip + "count": 5, + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + } + ], + "route": { + "final": "connection-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/connection_limiter/users.json b/examples/connection_limiter/users.json new file mode 100644 index 00000000..7ade7e20 --- /dev/null +++ b/examples/connection_limiter/users.json @@ -0,0 +1,68 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 5000, + "transport": { + "type": "http" + }, + "users": [ + { + "name": "user1", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "name": "user2", + "uuid": "6c8c7ffc-a909-4699-af34-e9d9bcb3e6d6" + } + ], + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "connection-limiter", + "tag": "connection-limiter", + "strategy": "users", + "users": [ + { + "name": "user1", + "strategy": "connection", + "connection_type": "hwid", // mux, ip + "count": 5, + }, + { + "name": "user2", + "strategy": "connection", + "connection_type": "hwid", // mux, ip + "count": 1, + }, + ], + "route": { // https://sing-box.sagernet.org/configuration/route/#structure + "rules": [], + "final": "direct" + } + } + ], + "route": { + "final": "connection-limiter", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} diff --git a/examples/failover/client.json b/examples/failover/client.json new file mode 100644 index 00000000..b4998f13 --- /dev/null +++ b/examples/failover/client.json @@ -0,0 +1,61 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "mixed", + "tag": "mixed-in", + "listen_port": 7897 + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "vless", + "tag": "vless-1-out", + "server": "example1.com", + "server_port": 443, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + }, + { + "type": "vless", + "tag": "vless-2-out", + "server": "example2.com", + "server_port": 443, + "uuid": "294fd6bc-4f89-43e7-9228-7900aba396af" + }, + { + "type": "vless", + "tag": "vless-3-out", + "server": "example3.com", + "server_port": 443, + "uuid": "257f20d0-294a-4f07-9f2c-9efee9a37400" + }, + { + "type": "failover", + "tag": "failover-out", + "outbounds": [ + "vless-1-out", + "vless-2-out", + "vless-3-out" + ] + } + ], + "route": { + "final": "failover-out", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} \ No newline at end of file diff --git a/examples/manager/manager.json b/examples/manager/manager.json new file mode 100644 index 00000000..d9320755 --- /dev/null +++ b/examples/manager/manager.json @@ -0,0 +1,70 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [], + "outbounds": [ + { + "type": "direct", + "tag": "direct-out" + }, + { + "type": "dns", + "tag": "dns-out" + } + ], + "route": { + "rules": [ + { + "protocol": "dns", + "outbound": "dns-out" + }, + { + "port": 53, + "outbound": "dns-out" + }, + ], + "final": "direct-out" + }, + "services": [ + { + "type": "manager", + "tag": "my-manager", + "database": { + "driver": "postgresql", + "dsn": "postgresql://postgres:postgres@localhost:5432/manager?sslmode=disable" + } + }, + { // http://127.0.0.1:8000 + // Username: admin + // Password: admin + "type": "admin-panel", + "tag": "my-admin-panel", + "listen_port": 8000, + "manager": "my-manager", + "database": { + "driver": "postgresql", + "dsn": "postgresql://postgres:postgres@localhost:5432/adminpanel?sslmode=disable" + } + }, + { + "type": "node-manager-server", // for connecting nodes + "listen_port": 7000, + "manager": "my-manager", + "tls": { // https://sing-box.sagernet.org/configuration/shared/tls/#inbound + "enabled": true, + "server_name": "example.com", + "certificate_path": "/path/to/fullchain.pem", + "key_path": "/path/to/privkey.pem" + }, + } + ] +} diff --git a/examples/manager/node.json b/examples/manager/node.json new file mode 100644 index 00000000..0b330b72 --- /dev/null +++ b/examples/manager/node.json @@ -0,0 +1,85 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "transport": { + "type": "http" + } + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct-out" + }, + { + "type": "dns", + "tag": "dns-out" + }, + { + "type": "bandwidth-limiter", + "tag": "bandwidth-limiter", + "strategy": "manager", + "route": { + "final": "direct-out" + } + }, + { + "type": "connection-limiter", + "tag": "connection-limiter", + "strategy": "manager", + "route": { + "final": "bandwidth-limiter" + } + }, + ], + "route": { + "rules": [ + { + "protocol": "dns", + "outbound": "dns-out" + }, + { + "port": 53, + "outbound": "dns-out" + } + ], + "final": "connection-limiter" + }, + "services": [ + { + "type": "node", + "tag": "my-node", + "uuid": "e6eceb84-ad66-474b-8641-142499db7c6e", + "manager": "node-manager", + "inbounds": ["vless-in"], + "bandwidth_limiters": ["bandwidth-limiter"], + "connection_limiters": ["connection-limiter"], + }, + { + "type": "node-manager-client", + "tag": "node-manager", + "server": "example.com", + "server_port": 7000, + "tls": { // https://sing-box.sagernet.org/configuration/shared/tls/#outbound + "enabled": true, + "server_name": "example.com", + "alpn": "h2" // h3 for QUIC + }, + } + ] +} diff --git a/examples/mkcp/client.json b/examples/mkcp/client.json new file mode 100644 index 00000000..faebd9bc --- /dev/null +++ b/examples/mkcp/client.json @@ -0,0 +1,43 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "mixed", + "tag": "mixed-in", + "listen_port": 7897 + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + }, + { + "type": "vless", + "tag": "vless-out", + "server": "example.com", + "server_port": 443, + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937", + "packet_encoding": "", + "transport": { + "type": "kcp", + "mtu": 1500 + } + } + ], + "route": { + "final": "vless-out", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +} \ No newline at end of file diff --git a/examples/mkcp/server.json b/examples/mkcp/server.json new file mode 100644 index 00000000..87ed4dac --- /dev/null +++ b/examples/mkcp/server.json @@ -0,0 +1,42 @@ +{ + "log": { + "level": "error" + }, + "dns": { + "servers": [ + { + "type": "local", + "tag": "default" + } + ] + }, + "inbounds": [ + { + "type": "vless", + "tag": "vless-in", + "listen": "0.0.0.0", + "listen_port": 443, + "users": [ + { + "name": "user", + "uuid": "9b65b7e1-04c8-4717-8f45-2aa61fd25937" + } + ], + "transport": { + "type": "kcp", + "mtu": 1500 + } + } + ], + "outbounds": [ + { + "type": "direct", + "tag": "direct" + } + ], + "route": { + "final": "direct", + "default_domain_resolver": "default", + "auto_detect_interface": true + } +}