Для провайдеров
Как RayRay загружает список серверов по ссылке, которую вы даёте пользователям, и что он понимает в ответе. Если чего-то не хватает, пишите на support@rayray.channel.
Запрос
- Обычный GET на адрес
https://илиhttp://без пробелов. Кеш не используется: каждое обновление доходит до вашего сервера. Cookies хранятся только в памяти, пока приложение запущено. - Заголовки по https:
User-Agent: RayRay/<версия> (iOS)илиRayRay/<версия> (Android)— номер версии приложения и система;x-hwid— 16 шестнадцатеричных символов, постоянный для устройства;x-device-os: iOSилиAndroid,x-ver-os(например18.6.2или15),x-device-model(напримерiPhone15,2илиSM-S911B).
- По http заголовков
x-нет, а User-Agent — толькоRayRay/<версия>: без шифрования их прочитал бы любой по пути. Если http-ссылка переадресует на https, их тоже нет. - Переадресации выполняются. При переходе на другой хост все заголовки
x-снимаются. С https на http приложение не переходит: при добавлении ссылки пользователь видит «Ошибка сервера», при обновлении остаётся прежний список. - Таймаут — 20 секунд без данных или 60 секунд всего. Успешный ответ — только код 2xx. При добавлении ссылки на 403 и 410 пользователь видит «Доступ истёк», на другие коды — «Ошибка сервера». Если не удалось обновление, на карточке — «Не обновлено», прежний список остаётся.
- Лимит устройств: если в ответе есть заголовок
x-hwid-max-devices-reached: true(с любым кодом) или пришёл код 403 и в первых 4 КБ ответа есть «device limit» илиHWID_LIMIT(регистр не важен), ответ не читается как список. При добавлении ссылки пользователь видит «Лимит устройств», при обновлении то же видно на карточке, прежний список остаётся. Один заголовокx-hwid-limitотказом не считается. - Ответ — не больше 10 МБ. Из списка берутся первые 1000 серверов.
- Обновление: когда пользователь открывает приложение и с прошлого обновления прошло больше интервала (
profile-update-interval, без него — 24 часа; если пользователь выключил «Автообновление» — интервал, который он выбрал сам), и вручную кнопкой ↻. В фоне приложение список не обновляет.
Формат ответа
- Ссылки, по одной в строке, как есть или целиком в base64 (обычном или URL-safe, с
=на конце или без):vless://,vmess://(и старый вид с JSON в base64),trojan://,ss://(SIP002 и старый вид),socks://иsocks5://,hysteria2://иhy2://. Имя сервера — после#. - Xray JSON — один полный конфиг или массив конфигов. Каждый конфиг — один сервер в списке, имя берётся из
remarks. Свои outbounds (любые протоколы Xray), балансировщики, observatory и routing сохраняются. Inbounds, log, stats и env задаёт приложение. В policy оно задаёт connIdle на каждом уровне, убирает bufferSize и включает счётчики. Секции api, reverse, metrics, geodata и transport удаляются. Lua-скриптscriptв routing и dns удаляется. Секция dns используется, пока у пользователя включено «DNS из JSON» (по умолчанию оно включено). - Clash / Mihomo YAML (ключ
proxies:) и sing-box JSON: берутся vless, vmess, trojan, shadowsocks и hysteria2. Группы и правила не читаются. - Пустой список принимается, только если по
subscription-userinfoдоступ истёк или трафик закончился. Иначе при добавлении пользователь видит «Сервера не получены».
Не поддерживаются: плагины Shadowsocks (obfs, v2ray-plugin), транспорты h2 и quic, http в ссылках и sing-box (в Clash network: http работает), trojan без TLS, hysteria2 с insecure=1 или pinSHA256, ссылки tuic, wireguard, hysteria (v1) и anytls, зашифрованные списки. WireGuard, Hysteria и другие протоколы Xray работают в полном Xray JSON.
Полный JSON от панели
Если по основному адресу пришли не полные конфиги Xray (ссылки, Clash или sing-box), приложение пробует <адрес>/json, затем <адрес>/v2ray-json, с теми же заголовками и параметрами запроса. Если там полные конфиги Xray, в списке будут они: так работают балансировщики вроде «Auto». Найденный адрес запоминается: дальше приложение обновляет список по нему и берёт заголовки из его ответа. Если в этом ответе нет subscription-userinfo, приложение отдельно запрашивает основной адрес, с теми же заголовками, и берёт трафик и срок из его ответа. Если в ответе нет ни одного из заголовков ниже, остальные остаются прежними. Если он ответит 4xx или не полными конфигами, приложение вернётся к основному адресу.
Заголовки ответа
Названия заголовков — без учёта регистра.
profile-title— имя провайдера, текстом илиbase64:…. Без него — имя файла изcontent-disposition, потом адрес сайта.subscription-userinfo: upload=…; download=…; total=…; expire=…— байты и время окончания в секундах Unix.total=0— без лимита,expire=0— бессрочно. На карточке провайдера видно, сколько осталось трафика и дней.profile-update-interval— интервал обновления, целое число часов, от 1.announce— объявление на карточке провайдера, текстом илиbase64:….support-urlиprofile-web-page-url— две кнопки-значка на карточке провайдера: облачко чата и глобус. Толькоhttp://илиhttps://, ссылки t.me работают. Без заголовка значок неактивен.routing— профиль маршрутизации, см. ниже.
Профиль маршрутизации
Значение заголовка routing — JSON как есть или в base64. Ключи без учёта регистра:
Name,GlobalProxy;DirectSites,DirectIp,ProxySites,ProxyIp,BlockSites,BlockIp— массивы или строки через запятую;DomainStrategy— AsIs, IPIfNonMatch или IPOnDemand;RemoteDNSIP,DomesticDNSIP— только IP-адреса;DnsHosts;RouteOrder, напримерblock-proxy-direct;GeoipUrl,GeositeUrl— толькоhttps://. Без них базы скачиваются из проекта runetfreedom/russia-v2ray-rules-dat.
Если все шесть списков пусты, а GlobalProxy не false, профиль не применяется целиком, вместе с DNS и остальными ключами. Профиль включается сам для серверов этого провайдера; пользователь может выключить его на странице «Маршрутизация». Он действует на серверы из ссылок, а у серверов из полного Xray JSON остаётся их собственный routing.
Кнопка «Добавить в RayRay»
rayray://add/<ссылка> открывает окно добавления с этой ссылкой, пользователь нажимает «Добавить». Ссылку можно передать как есть или закодировать: rayray://add/https%3A%2F%2Fexample.com%2Fsub. QR-код может содержать адрес, ссылки на серверы или rayray://add/.
For providers
How RayRay downloads the server list from the link you give your users, and what it understands in the answer. If something is missing, write to support@rayray.channel.
Request
- A plain GET to an
https://orhttp://address without spaces. No cache: every update reaches your server. Cookies are kept only in memory while the app is running. - Headers over https:
User-Agent: RayRay/<version> (iOS)orRayRay/<version> (Android)— the app version and system;x-hwid— 16 hex characters, fixed for the device;x-device-os: iOSorAndroid,x-ver-os(for example18.6.2or15),x-device-model(for exampleiPhone15,2orSM-S911B).
- Over http there are no
x-headers, and the User-Agent is justRayRay/<version>: without encryption anyone on the way could read them. An http link that redirects to https sends none either. - Redirects are followed. A redirect to another host drops every
x-header. A redirect from https to http is not followed: when adding the link, the user sees “Server error”; on an update the previous list stays. - Timeout: 20 seconds without data or 60 seconds in total. Only a 2xx code counts as success. When adding the link, on 403 and 410 the user sees “Access expired”, on other codes “Server error”. If a later update fails, the card shows “Not updated” and the previous list stays.
- Device limit: if the answer has the
x-hwid-max-devices-reached: trueheader (with any code), or the code is 403 and the first 4 KB of the answer contain “device limit” orHWID_LIMIT(in any case), the answer is not read as a list. When adding the link, the user sees “Device limit”; on an update the card shows the same and the previous list stays. Thex-hwid-limitheader alone is not taken as a refusal. - The answer may be up to 10 MB. The first 1000 servers are kept.
- Updates: when the user opens the app and more than the interval has passed (
profile-update-interval, 24 hours without it; if the user turned off “Auto-update”, the interval they chose), and by hand with ↻. The app does not update the list in the background.
Answer format
- Links, one per line, plain or the whole list in base64 (standard or URL-safe, with or without
=padding):vless://,vmess://(including the old base64 JSON form),trojan://,ss://(SIP002 and the old form),socks://andsocks5://,hysteria2://andhy2://. The server name goes after#. - Xray JSON — one full config or an array of configs. Each config is one server in the list, named from
remarks. Its outbounds (any Xray protocol), balancers, observatory and routing are kept. The app sets inbounds, log, stats and env. In policy it sets connIdle on every level, removes bufferSize and turns on the counters. The api, reverse, metrics, geodata and transport sections are removed. A Luascriptin routing and dns is removed. The dns section is used while “DNS from JSON” is on (it is on by default). - Clash / Mihomo YAML (a
proxies:key) and sing-box JSON: vless, vmess, trojan, shadowsocks and hysteria2 are kept. Groups and rules are not read. - An empty list is accepted only if
subscription-userinfosays access has expired or the traffic is used up. Otherwise, when adding, the user sees “No servers received”.
Not supported: Shadowsocks plugins (obfs, v2ray-plugin), the h2 and quic transports, http in links and sing-box (Clash network: http works), trojan without TLS, hysteria2 with insecure=1 or pinSHA256, tuic, wireguard, hysteria (v1) and anytls links, encrypted lists. WireGuard, Hysteria and other Xray protocols work inside full Xray JSON.
Full JSON from the panel
If the main address returns anything but full Xray configs (links, Clash or sing-box), the app tries <address>/json, then <address>/v2ray-json, with the same headers and query. If either returns full Xray configs, the list uses them, so balancers such as “Auto” work. The address that worked is remembered: later updates use it and read the headers from its answer. If that answer has no subscription-userinfo, the app also requests the main address, with the same headers, and reads the traffic and expiry from its answer. If the answer has none of the headers below, the others stay as they were. If it answers 4xx or without full configs, the app goes back to the main address.
Response headers
Header names are case-insensitive.
profile-title— the provider’s name, plain orbase64:…. Without it, the file name fromcontent-disposition, then the site address.subscription-userinfo: upload=…; download=…; total=…; expire=…— bytes, and the end time in Unix seconds.total=0means no limit,expire=0means no end date. The provider card shows the traffic and days left.profile-update-interval— the update interval in whole hours, at least 1.announce— an announcement on the provider card, plain orbase64:….support-urlandprofile-web-page-url— two icon buttons on the provider card: a chat bubble and a globe. Onlyhttp://orhttps://; t.me links work. Without the header the icon is dimmed.routing— a routing profile, see below.
Routing profile
The routing header holds JSON, plain or in base64. Keys are case-insensitive:
Name,GlobalProxy;DirectSites,DirectIp,ProxySites,ProxyIp,BlockSites,BlockIp— arrays or comma-separated strings;DomainStrategy— AsIs, IPIfNonMatch or IPOnDemand;RemoteDNSIP,DomesticDNSIP— IP addresses only;DnsHosts;RouteOrder, for exampleblock-proxy-direct;GeoipUrl,GeositeUrl—https://only. Without them the databases come from the runetfreedom/russia-v2ray-rules-dat project.
If all six lists are empty and GlobalProxy is not false, the whole profile is ignored, DNS and the other keys included. The profile turns on by itself for this provider’s servers; the user can turn it off on the “Routing” page. It applies to servers from links; servers from full Xray JSON keep their own routing.
“Add to RayRay” button
rayray://add/<link> opens the add panel with that link filled in, and the user taps “Add”. The link can go as is or percent-encoded: rayray://add/https%3A%2F%2Fexample.com%2Fsub. A QR code can hold the address, server links or a rayray://add/ link.