وثائق واجهة العُقد soga-client-v1
مقدمة
يحصل العميل عبر هذه الواجهة على إعدادات اتصال العُقد وقواعد التوجيه، ولا يطلب رابط الاشتراك.
للاصطلاحات العامة مثل ترويسات الطلب وتنسيق الاستجابة ومعالجة الأخطاء راجع وثائق soga-client-v1 API.
الحصول على إعدادات العُقد GET <base_url>/api/v1/servers
تتطلب تسجيل الدخول
بيانات المصادقة في العُقد (uuid وpassword وغيرهما) هي بيانات مصادقة المستخدم الحالي، وبعد استدعاء subscription/reset تُعيد هذه الواجهة بيانات المصادقة الجديدة
عندما يكون الاشتراك غير متاح (لم يُشترَ، أو منتهٍ، أو محظور) تكون servers قائمة فارغة
البيانات المُعادة
{
"success": true,
"data": {
"servers": [ // node list, in the order the client displays them
{
"id": 1, // unique, stays the same after the node is modified
"name": "Hong Kong 01",
"type": "vless", // protocol, options: shadowsocks vmess vless trojan anytls hysteria2 mieru socks
"address": "hk01.website.com", // domain or IP, IPv6 without square brackets
"port": 443,
"settings": {}, // protocol settings, vary by type, see settings
"transport": null, // transport layer, null means plain TCP, see transport
"tls": null // null means disabled, see tls
}
],
"router": {} // routing rules, see router
}
}settings
shadowsocks
القيم الممكنة لـ transport: null ws، وtls اختياري فقط عندما يكون transport هو ws، ويُستخدم منه server_name فقط
{
"method": "2022-blake3-aes-128-gcm", // options: aes-128-gcm aes-256-gcm chacha20-poly1305 chacha20-ietf-poly1305 2022-blake3-aes-128-gcm 2022-blake3-aes-256-gcm
"password": "MTIzNDU2Nzg5MGFiY2RlZg==:YWJjZGVmMDEyMzQ1Njc4OQ==",
"obfs": { // simple-obfs obfuscation, null means not used, cannot be used together with transport
"mode": "http", // options: http tls
"host": "www.bing.com"
}
}عندما يكون method هو 2022-blake3-* تكون password بصيغة مفتاح الخادم:مفتاح المستخدم، وكل جزء بترميز Base64 القياسي، وطوله بعد فك الترميز 16 بايت في aes-128 و32 بايت في aes-256
عندما يكون transport هو ws فهو يعادل وضع websocket في v2ray-plugin، دون استخدام تعدد الإرسال
vmess
القيم الممكنة لـ transport: null ws grpc xhttp، وtls اختياري، ولا يُدعم reality
{
"uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}تُدعم مصادقة AEAD فقط، أي أن alterId يساوي 0
vless
القيم الممكنة لـ transport: null ws grpc xhttp، وtls اختياري
{
"uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"flow": "xtls-rprx-vision", // null means not used, options: xtls-rprx-vision
"encryption": null // null means not used, format: mlkem768x25519plus.native.0rtt.<public key>
}flow متاح فقط عندما يكون transport هو null ويكون أحد tls وencryption على الأقل غير null
trojan
القيم الممكنة لـ transport: null ws grpc xhttp، وtls إلزامي
{
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}anytls
transport يكون null، وtls إلزامي
{
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"idle_session_check_interval": 30, // interval for checking idle sessions, in seconds, null means the client default is used
"idle_session_timeout": 30, // time after which idle sessions are closed, in seconds, null means the client default is used
"min_idle_session": null // number of idle sessions to keep, null means the client default is used
}hysteria2
transport يكون null، وtls إلزامي، ويُستخدم منه server_name وinsecure فقط
{
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"obfs_password": null, // salamander obfuscation password, null means no obfuscation
"ports": "443,20000-30000", // port list for port hopping, null means not used, when set the node's port is not used
"hop_interval": 30, // port hopping interval, in seconds, minimum 5, 30 when null
"up_mbps": null, // uplink bandwidth, null means unspecified
"down_mbps": 200 // downlink bandwidth, null means unspecified
}mieru
transport وtls كلاهما null
{
"username": "user1", // 1 to 64 bytes
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"network": "tcp", // options: tcp udp
"ports": null // same format as ports in hysteria2, null means only the node's port is used
}socks
transport يكون null، وtls اختياري، ولا يُدعم reality
{
"username": "user1", // null means no authentication is required
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}transport
ws
{
"type": "ws",
"path": "/ws",
"host": "cdn.website.com" // Host request header, null means unspecified
}grpc
{
"type": "grpc",
"service_name": "GunService"
}xhttp
{
"type": "xhttp",
"path": "/xhttp",
"host": null, // when null, tls.server_name is used
"mode": "auto", // options: auto packet-up stream-up stream-one
"headers": { // additional request headers, null means none, Host in it has no effect
"User-Agent": "Mozilla/5.0"
},
"no_grpc_header": false, // do not send the gRPC request header
"x_padding_bytes": { // range of the padding length, null means the client default is used
"from": 100,
"to": 1000
},
"sc_max_each_post_bytes": null, // range of the maximum bytes per uplink request, same format as x_padding_bytes
"sc_min_posts_interval_ms": null, // range of the minimum interval between uplink requests, in milliseconds, same format as x_padding_bytes
"uplink_http_method": null, // POST when null
"download": { // separate connection for the downlink, null means uplink and downlink use the same address, cannot be used together with stream-one
"address": "dl.website.com",
"port": 443,
"path": null, // when null, the outer path is used
"host": null, // when null, the outer host is used
"headers": null, // when null, the outer headers are used
"tls": null // same format as the node's tls, null means disabled
}
}عندما يكون mode هو auto، تتصل العُقد التي تستخدم Reality بوضع stream-one (وبوضع stream-up عند ضبط download)، وتتصل بقية العُقد بوضع packet-up
tls
{
"server_name": "www.website.com", // SNI
"insecure": false, // do not verify the server certificate
"alpn": ["h2", "http/1.1"], // [] means unspecified, when transport is grpc or xhttp the client always uses h2
"ech": { // null means disabled
"config": null // Base64-encoded ECHConfigList, when null the client queries it from DNS
},
"reality": { // null means standard TLS, when not null insecure, alpn and ech have no effect
"public_key": "7xhH4b_VkliBxGulljcyPOH-bYUA2dl-XAdZAsfhk04", // 32 bytes, URL-safe Base64 (without padding) or hex
"short_id": "6ba85179e30d4fc2", // hex, up to 16 characters, may be an empty string
"spider_x": null // null means unspecified
}
}router
{
"domain_resolve": true, // when a domain matches no rule, resolve it to an IP and match once more
"rules": [ // matched in order, later rules are not checked after a match
{
"target": "direct", // where matched connections go, options: proxy (the node selected by the user) direct (direct connection) reject (reject the connection)
"domain": ["www.website.com"], // full domain
"domain_suffix": ["website.com"], // matches website.com and all its subdomains
"domain_keyword": ["website"], // keyword contained in the domain
"domain_regex": ["^ad[0-9]+\\."], // case-insensitive
"geosite": ["cn"], // domain category
"port": ["443", "8000-9000"], // destination port or port range
"network": ["tcp"] // options: tcp udp
},
{
"target": "direct",
"ip": ["203.0.113.0/24", "2001:db8::/32"],
"geoip": ["cn"] // country code
}
]
}جميع الحقول عدا target شروط مطابقة، ويمكن حذف الشروط غير المستخدمة
شروط النطاق (domain domain_suffix domain_keyword domain_regex geosite) يكفي فيها مطابقة أي قيمة واحدة منها، وكذلك شروط IP (ip geoip)
عندما تتضمن القاعدة الواحدة شروط نطاق أو شروط IP مع port وnetwork، يجب أن تتحقق جميعها
لا يمكن أن تجمع القاعدة الواحدة بين شروط النطاق وشروط IP
الاتصالات التي لا تطابق أي قاعدة تمرّ عبر العقدة التي اختارها المستخدم
عناوين الشبكة الداخلية وعناوين العُقد نفسها تتصل مباشرة دائمًا، ولا حاجة إلى كتابة قواعد لها
اصطلاحات التوافق
يتجاهل العميل الحقول التي لا يعرفها، باستثناء حقول القواعد
إذا لم يعرف العميل type العقدة أو transport.type أو قيمة أخرى من القيم الممكنة، أو كانت تركيبة transport وtls لا تستوفي متطلبات ذلك البروتوكول، يتجاهل العميل تلك العقدة، ولا تتأثر بقية العُقد
إذا لم يعرف العميل target القاعدة أو أحد حقول الشروط، أو لم تتضمن القاعدة أي شرط، يتجاهل العميل تلك القاعدة، ولا تتأثر بقية القواعد
مثال
{
"success": true,
"data": {
"servers": [
{
"id": 1,
"name": "Hong Kong 01",
"type": "vless",
"address": "hk01.website.com",
"port": 443,
"settings": {
"uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"flow": "xtls-rprx-vision",
"encryption": null
},
"transport": null,
"tls": {
"server_name": "www.website.com",
"insecure": false,
"alpn": [],
"ech": null,
"reality": {
"public_key": "7xhH4b_VkliBxGulljcyPOH-bYUA2dl-XAdZAsfhk04",
"short_id": "6ba85179e30d4fc2",
"spider_x": null
}
}
},
{
"id": 2,
"name": "Japan 01",
"type": "vmess",
"address": "jp01.website.com",
"port": 443,
"settings": {
"uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
},
"transport": {
"type": "ws",
"path": "/ws",
"host": "jp01.website.com"
},
"tls": {
"server_name": "jp01.website.com",
"insecure": false,
"alpn": [],
"ech": null,
"reality": null
}
},
{
"id": 3,
"name": "United States 01",
"type": "shadowsocks",
"address": "203.0.113.10",
"port": 8388,
"settings": {
"method": "2022-blake3-aes-128-gcm",
"password": "MTIzNDU2Nzg5MGFiY2RlZg==:YWJjZGVmMDEyMzQ1Njc4OQ==",
"obfs": null
},
"transport": null,
"tls": null
},
{
"id": 4,
"name": "Singapore 01",
"type": "hysteria2",
"address": "sg01.website.com",
"port": 443,
"settings": {
"password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"obfs_password": null,
"ports": "443,20000-30000",
"hop_interval": 30,
"up_mbps": null,
"down_mbps": 200
},
"transport": null,
"tls": {
"server_name": "sg01.website.com",
"insecure": false,
"alpn": [],
"ech": null,
"reality": null
}
},
{
"id": 5,
"name": "Taiwan 01",
"type": "vless",
"address": "tw01.website.com",
"port": 443,
"settings": {
"uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
"flow": null,
"encryption": null
},
"transport": {
"type": "xhttp",
"path": "/xhttp",
"host": null,
"mode": "auto",
"headers": null,
"no_grpc_header": false,
"x_padding_bytes": null,
"sc_max_each_post_bytes": null,
"sc_min_posts_interval_ms": null,
"uplink_http_method": null,
"download": null
},
"tls": {
"server_name": "tw01.website.com",
"insecure": false,
"alpn": [],
"ech": null,
"reality": null
}
}
],
"router": {
"domain_resolve": true,
"rules": [
{
"target": "reject",
"domain_keyword": ["adservice"]
},
{
"target": "direct",
"domain_suffix": ["cn"],
"geosite": ["cn"]
},
{
"target": "direct",
"geoip": ["cn"]
}
]
}
}
}