diff --git a/gui/src/dialogs/settings/RoutingA.spec.ts b/gui/src/dialogs/settings/RoutingA.spec.ts index 9baffae0..859b86f2 100644 --- a/gui/src/dialogs/settings/RoutingA.spec.ts +++ b/gui/src/dialogs/settings/RoutingA.spec.ts @@ -18,6 +18,7 @@ import RoutingA from "./RoutingA.vue"; import RuleDialog from "./routingA/RuleDialog.vue"; import { template } from "./routingA/template"; import { russia } from "./routingA/russia"; +import { iran } from "./routingA/iran"; const api = vi.hoisted(() => ({ getRoutingA: vi.fn(), @@ -141,6 +142,21 @@ describe("RoutingA dialog", () => { expect((await textView(wrapper)).element.value).toBe(russia); }); + test("offers the Iran rule set as a confirmed replacement", async () => { + const wrapper = mountWithApp(RoutingA); + await flushPromises(); + await button(wrapper, en.routingA.templates.title).trigger("click"); + await flushPromises(); + const option = [...document.querySelectorAll(".v-list-item")].find((item) => + item.textContent?.includes(en.routingA.templates.iran), + ); + expect(option).toBeDefined(); + option!.dispatchEvent(new MouseEvent("click", { bubbles: true })); + await flushPromises(); + await respond(true); + expect((await textView(wrapper)).element.value).toBe(iran); + }); + test("loads, highlights and saves rules verbatim without confirming comments", async () => { const wrapper = mountWithApp(RoutingA); await flushPromises(); diff --git a/gui/src/dialogs/settings/routingA/iran.ts b/gui/src/dialogs/settings/routingA/iran.ts new file mode 100644 index 00000000..a7b92e1f --- /dev/null +++ b/gui/src/dialogs/settings/routingA/iran.ts @@ -0,0 +1,12 @@ +// Iranian sites and addresses go direct, everything else through the proxy. +// Only categories in the v2fly geosite.dat and geoip.dat: category-ir and ir. +export const iran = `default: proxy +# Route local hostnames and private IP addresses directly +domain(geosite:private) -> direct +ip(geoip:private) -> direct + +# Route Iranian domains directly +domain(geosite:category-ir) -> direct + +# Route Iranian IP addresses directly +ip(geoip:ir) -> direct`; diff --git a/gui/src/dialogs/settings/routingA/presets.spec.ts b/gui/src/dialogs/settings/routingA/presets.spec.ts index 6706a5d9..d7347754 100644 --- a/gui/src/dialogs/settings/routingA/presets.spec.ts +++ b/gui/src/dialogs/settings/routingA/presets.spec.ts @@ -19,6 +19,7 @@ describe("the rule templates", () => { "global", "minimal", "russia", + "iran", ]); }); test("Russian proxy exceptions precede the direct category", () => { @@ -29,4 +30,14 @@ describe("the rule templates", () => { ); expect(rules).toContain("default: proxy"); }); + test("the Iran rule set follows Russia in the menu and keeps the LAN direct", () => { + const keys = presets.map((p) => p.key); + expect(keys.indexOf("iran")).toBe(keys.indexOf("russia") + 1); + const rules = presets.find((p) => p.key === "iran")!.code; + expect(rules.startsWith("default: proxy\n")).toBe(true); + expect(rules).toContain("domain(geosite:private) -> direct"); + expect(rules).toContain("ip(geoip:private) -> direct"); + expect(rules).toContain("domain(geosite:category-ir) -> direct"); + expect(rules).toContain("ip(geoip:ir) -> direct"); + }); }); diff --git a/gui/src/dialogs/settings/routingA/presets.ts b/gui/src/dialogs/settings/routingA/presets.ts index 4c2759ff..730ef088 100644 --- a/gui/src/dialogs/settings/routingA/presets.ts +++ b/gui/src/dialogs/settings/routingA/presets.ts @@ -1,5 +1,6 @@ import { template } from "./template"; import { russia } from "./russia"; +import { iran } from "./iran"; // Rule sets for the Templates menu: one that starts with `default:` replaces // the rules, the others are inserted. Outbounds are only proxy, direct and @@ -37,6 +38,7 @@ domain(geosite:category-social-media-!cn, geosite:category-ai-!cn)->proxy ${telegramRanges}`, }, { key: "russia", code: russia }, + { key: "iran", code: iran }, { key: "ads", code: "domain(geosite:category-ads-all)->block" }, { key: "streaming", diff --git a/gui/src/docs/en/routing.md b/gui/src/docs/en/routing.md index 3c5307d8..52b54c06 100644 --- a/gui/src/docs/en/routing.md +++ b/gui/src/docs/en/routing.md @@ -48,6 +48,8 @@ The Russia template sends `geosite:category-ru` directly, except for its listed Russian IP addresses (`geoip:ru`) and private hostnames and IP addresses (`geosite:private`, `geoip:private`) also go directly; the proxy exceptions take precedence. +The Iran template sends private hostnames and IP addresses (`geosite:private`, `geoip:private`), Iranian domains (`geosite:category-ir`) and Iranian IP addresses (`geoip:ir`) directly; everything else uses the proxy. It requires a `geosite.dat` containing `category-ir`. + Saving reloads a running core with the new rules; when the core rejects them, v2rayA puts the previous rules back and shows the core's error, which names the offending text. A stopped core takes the rules on its next start. ## Custom inbounds diff --git a/gui/src/docs/fa/routing.md b/gui/src/docs/fa/routing.md index b883cfc9..85e3cacf 100644 --- a/gui/src/docs/fa/routing.md +++ b/gui/src/docs/fa/routing.md @@ -48,6 +48,8 @@ domain(domain: corp.example) -> office نشانی‌های IP روسیه (`geoip:ru`) و نام‌ها و نشانی‌های IP شبکهٔ محلی (`geosite:private`، `geoip:private`) نیز مستقیم متصل می‌شوند؛ استثناهای پروکسی اولویت دارند. +الگوی ایران نام‌ها و نشانی‌های IP شبکهٔ محلی (`geosite:private`، `geoip:private`)، دامنه‌های ایران (`geosite:category-ir`) و نشانی‌های IP ایران (`geoip:ir`) را مستقیم می‌فرستد؛ بقیهٔ ترافیک از پروکسی می‌گذرد. فایل `geosite.dat` باید شامل `category-ir` باشد. + ذخیره کردن، هستهٔ در حال اجرا را با قوانین جدید دوباره بارگذاری می‌کند؛ اگر هسته آن‌ها را رد کند، v2rayA قوانین قبلی را برمی‌گرداند و خطای هسته را نشان می‌دهد که متن مشکل‌دار را مشخص می‌کند. هستهٔ متوقف‌شده قوانین را در راه‌اندازی بعدی دریافت می‌کند. ## ورودی‌های سفارشی diff --git a/gui/src/docs/ko/routing.md b/gui/src/docs/ko/routing.md index 6a50fb2e..40c8d699 100644 --- a/gui/src/docs/ko/routing.md +++ b/gui/src/docs/ko/routing.md @@ -48,6 +48,8 @@ Loyalsoldier 빌드에만 있는 이름(`gfw`, `apple-cn`, `google-cn`, `geoip:t 러시아 IP 주소(`geoip:ru`)와 로컬 호스트 이름 및 IP 주소(`geosite:private`, `geoip:private`)도 직접 연결하며, 프록시 예외 규칙이 우선합니다. +이란 템플릿은 로컬 호스트 이름과 IP 주소(`geosite:private`, `geoip:private`), 이란 도메인(`geosite:category-ir`), 이란 IP 주소(`geoip:ir`)를 직접 연결하고 나머지 트래픽은 프록시를 사용합니다. `category-ir`가 포함된 `geosite.dat`가 필요합니다. + 저장하면 실행 중인 코어가 새 규칙을 다시 불러옵니다. 코어가 규칙을 거부하면 v2rayA는 이전 규칙으로 되돌리고 문제가 된 텍스트가 명시된 코어 오류를 표시합니다. 중지된 코어는 다음 시작 시 규칙을 적용합니다. ## 사용자 지정 인바운드 diff --git a/gui/src/docs/pt/routing.md b/gui/src/docs/pt/routing.md index 6e5f61ff..bfc67c3c 100644 --- a/gui/src/docs/pt/routing.md +++ b/gui/src/docs/pt/routing.md @@ -48,6 +48,8 @@ O modelo para a Rússia encaminha `geosite:category-ru` diretamente, exceto pelo Os endereços IP russos (`geoip:ru`) e os nomes e endereços IP privados (`geosite:private`, `geoip:private`) também usam conexão direta; as exceções de proxy têm prioridade. +O modelo para o Irã encaminha diretamente os nomes e endereços IP privados (`geosite:private`, `geoip:private`), os domínios iranianos (`geosite:category-ir`) e os endereços IP iranianos (`geoip:ir`); todo o restante usa o proxy. Ele requer um `geosite.dat` com `category-ir`. + Salvar recarrega um núcleo em execução com as novas regras; quando o núcleo as rejeita, o v2rayA restaura as regras anteriores e mostra o erro do núcleo, que indica o texto problemático. Um núcleo parado adota as regras na próxima inicialização. ## Entradas personalizadas diff --git a/gui/src/docs/ru/routing.md b/gui/src/docs/ru/routing.md index da7031a8..d247c9ca 100644 --- a/gui/src/docs/ru/routing.md +++ b/gui/src/docs/ru/routing.md @@ -48,6 +48,8 @@ domain(domain: corp.example) -> office Российские IP-адреса (`geoip:ru`), локальные имена и IP-адреса (`geosite:private`, `geoip:private`) тоже направляются напрямую; домены-исключения имеют приоритет и идут через прокси. +Шаблон для Ирана направляет напрямую локальные имена и IP-адреса (`geosite:private`, `geoip:private`), иранские домены (`geosite:category-ir`) и иранские IP-адреса (`geoip:ir`); остальной трафик идёт через прокси. Для него нужен `geosite.dat` с категорией `category-ir`. + При сохранении работающее ядро перезагружается с новыми правилами; если ядро их отклоняет, v2rayA возвращает предыдущие правила и показывает ошибку ядра с указанием некорректного текста. Остановленное ядро применяет правила при следующем запуске. ## Пользовательские входящие порты diff --git a/gui/src/docs/zh/routing.md b/gui/src/docs/zh/routing.md index ac893b01..72054a4c 100644 --- a/gui/src/docs/zh/routing.md +++ b/gui/src/docs/zh/routing.md @@ -48,6 +48,8 @@ domain(domain: corp.example) -> office 俄罗斯 IP 地址(`geoip:ru`)以及局域网域名和 IP 地址(`geosite:private`、`geoip:private`)也直连;代理例外规则优先。 +伊朗模板让局域网域名和 IP 地址(`geosite:private`、`geoip:private`)、伊朗域名(`geosite:category-ir`)以及伊朗 IP 地址(`geoip:ir`)直连;其余流量走代理。此模板需要包含 `category-ir` 的 `geosite.dat`。 + 保存后运行中的内核以新规则重新加载;内核拒绝规则时 v2rayA 恢复原规则并显示内核的错误,错误信息指出出错的内容。已停止的内核在下次启动时读取新规则。 ## 自定义入站 diff --git a/gui/src/locales/en.js b/gui/src/locales/en.js index a68a0b23..d210e031 100644 --- a/gui/src/locales/en.js +++ b/gui/src/locales/en.js @@ -513,6 +513,7 @@ export default { "Only common foreign services through the proxy, everything else direct", russia: "Russian sites direct, listed exceptions and the rest through the proxy", + iran: "Iranian sites direct, everything else through the proxy", ads: "Block advertising domains", streaming: "Streaming through the proxy (Netflix, Disney, HBO, Prime Video, YouTube, Spotify, TikTok)", diff --git a/gui/src/locales/fa-ir.js b/gui/src/locales/fa-ir.js index 89375da7..a3bc0a98 100644 --- a/gui/src/locales/fa-ir.js +++ b/gui/src/locales/fa-ir.js @@ -507,6 +507,7 @@ export default { global: "همه از پروکسی، شبکهٔ محلی مستقیم", minimal: "فقط سرویس‌های خارجی رایج از پروکسی، بقیه مستقیم", russia: "سایت‌های روسیه مستقیم، استثناها و بقیه از پروکسی", + iran: "سایت‌های ایران مستقیم، بقیه از پروکسی", ads: "مسدود کردن دامنه‌های تبلیغاتی", streaming: "پخش ویدئو و موسیقی از پروکسی (Netflix، Disney، HBO، Prime Video، YouTube، Spotify، TikTok)", diff --git a/gui/src/locales/ko.js b/gui/src/locales/ko.js index e0f253d0..92e2afda 100644 --- a/gui/src/locales/ko.js +++ b/gui/src/locales/ko.js @@ -505,6 +505,7 @@ export default { global: "모두 프록시, LAN은 직접 연결", minimal: "자주 쓰는 해외 서비스만 프록시, 나머지는 직접 연결", russia: "러시아 사이트는 직접 연결, 예외와 나머지는 프록시", + iran: "이란 사이트는 직접 연결, 나머지는 프록시", ads: "광고 도메인 차단", streaming: "스트리밍은 프록시 (Netflix, Disney, HBO, Prime Video, YouTube, Spotify, TikTok)", diff --git a/gui/src/locales/pt-br.js b/gui/src/locales/pt-br.js index 4a2764aa..5440aa8f 100644 --- a/gui/src/locales/pt-br.js +++ b/gui/src/locales/pt-br.js @@ -518,6 +518,7 @@ export default { global: "Tudo pelo proxy, rede local direto", minimal: "Só os serviços estrangeiros comuns pelo proxy, o resto direto", russia: "Sites russos direto, exceções e o restante pelo proxy", + iran: "Sites iranianos direto, o restante pelo proxy", ads: "Bloquear domínios de publicidade", streaming: "Streaming pelo proxy (Netflix, Disney, HBO, Prime Video, YouTube, Spotify, TikTok)", diff --git a/gui/src/locales/ru.js b/gui/src/locales/ru.js index cd728611..88e42007 100644 --- a/gui/src/locales/ru.js +++ b/gui/src/locales/ru.js @@ -513,6 +513,7 @@ export default { minimal: "Только распространённые зарубежные сервисы через прокси, остальное напрямую", russia: "Российские сайты напрямую, исключения и остальное через прокси", + iran: "Иранские сайты напрямую, остальное через прокси", ads: "Блокировать рекламные домены", streaming: "Стриминг через прокси (Netflix, Disney, HBO, Prime Video, YouTube, Spotify, TikTok)", diff --git a/gui/src/locales/zh.js b/gui/src/locales/zh.js index 0891457d..cf88bbe3 100644 --- a/gui/src/locales/zh.js +++ b/gui/src/locales/zh.js @@ -494,6 +494,7 @@ export default { global: "全部走代理,仅局域网直连", minimal: "只让常用海外服务走代理,其余直连", russia: "俄罗斯站点直连,例外及其余流量走代理", + iran: "伊朗站点直连,其余流量走代理", ads: "拦截广告域名", streaming: "流媒体走代理(Netflix、Disney、HBO、Prime Video、YouTube、Spotify、TikTok)",