zapret-kvn/xray_fluent/service_presets.py

404 lines
10 KiB
Python

from __future__ import annotations
from dataclasses import dataclass
from qfluentwidgets import FluentIcon as FIF
@dataclass(frozen=True, slots=True)
class ServicePreset:
id: str
name: str
icon: FIF
description: str
domains: tuple[str, ...]
default_action: str # "proxy" | "direct"
SERVICE_PRESETS: tuple[ServicePreset, ...] = (
# --- VPN by default (proxy) ---
ServicePreset(
id="youtube",
name="YouTube",
icon=FIF.VIDEO,
description="YouTube, ytimg, ggpht, googleapis",
default_action="proxy",
domains=(
"youtube.com",
"youtubekids.com",
"ggpht.com",
"ytimg.com",
"yt.be",
"youtu.be",
"googleadservices.com",
"lh3.googleusercontent.com",
"yt3.googleusercontent.com",
"gvt1.com",
"youtube-nocookie.com",
"youtubeembeddedplayer.googleapis.com",
"youtube.googleapis.com",
"youtubei.googleapis.com",
"jnn-pa.googleapis.com",
"youtube-ui.l.google.com",
"yt-video-upload.l.google.com",
"wide-youtube.l.google.com",
"play.google.com",
"accounts.google.com",
"ytimg.l.google.com",
),
),
ServicePreset(
id="discord",
name="Discord",
icon=FIF.CHAT,
description="Discord, discordapp, discordcdn",
default_action="proxy",
domains=(
"dis.gd",
"disboard.org",
"discord.center",
"discord.co",
"discord.com",
"discord.design",
"discord.dev",
"discord.gift",
"discord.gifts",
"discord.me",
"discord.gg",
"discordapp.com",
"discordapp.net",
"discordapp.io",
"discord.new",
"discord.st",
"discord.store",
"discord.tools",
"discordactivities.com",
"discord-activities.com",
"discordbee.com",
"discordbotlist.com",
"discordcdn.com",
"discordexpert.com",
"discordhome.com",
"discordhub.com",
"discordinvites.net",
"discordlist.me",
"discordlist.space",
"discordmerch.com",
"discordpartygames.com",
"discords.com",
"discordsays.com",
"discordservers.com",
"discordstatus.com",
"discordtop.com",
"disforge.com",
"dyno.gg",
"findadiscord.com",
"mee6.xyz",
"top.gg",
"discord-attachments-uploads-prd.storage.googleapis.com",
"cloudflare-ech.com",
),
),
ServicePreset(
id="instagram",
name="Instagram",
icon=FIF.PHOTO,
description="Instagram, CDN Instagram",
default_action="proxy",
domains=(
"instagram.com",
"cdninstagram.com",
),
),
ServicePreset(
id="facebook",
name="Facebook",
icon=FIF.PEOPLE,
description="Facebook, fbcdn, fburl",
default_action="proxy",
domains=(
"facebook.com",
"fbcdn.net",
"fburl.com",
"fbsbx.com",
),
),
ServicePreset(
id="twitter",
name="Twitter / X",
icon=FIF.EDIT,
description="Twitter, X, t.co, twimg",
default_action="proxy",
domains=(
"twimg.com",
"twitter.com",
"x.com",
"t.co",
),
),
ServicePreset(
id="telegram",
name="Telegram",
icon=FIF.SEND,
description="Telegram, t.me, telegram-cdn",
default_action="proxy",
domains=(
"telegram.org",
"t.me",
"telegram.me",
"telegram.dog",
"tdesktop.com",
"telegram.tips",
"telegramusercontent.com",
"telesco.pe",
"telegram-cdn.org",
),
),
ServicePreset(
id="twitch",
name="Twitch",
icon=FIF.MEDIA,
description="Twitch, twitchcdn, jtvnw",
default_action="proxy",
domains=(
"twitch.tv",
"twitch.com",
"twitchcdn.net",
"twitchcon.com",
"twitchsvc.net",
"jtvnw.net",
"ttvnw.net",
"twitch-ext.rootonline.de",
"scorecardresearch.com",
"ext-twitch.tv",
"live-video.net",
"twitchadvertising.tv",
),
),
ServicePreset(
id="soundcloud",
name="SoundCloud",
icon=FIF.MUSIC,
description="SoundCloud, sndcdn",
default_action="proxy",
domains=(
"sndcdn.com",
"soundcloud.cloud",
"soundcloud.com",
"soundcloud.app.goo.gl",
"soundcloud.app",
"soundcloud.org",
"soundcloud.net",
"soundcloud.co",
"soundcloud.co.uk",
"soundcloud.fr",
"soundcloud.de",
"soundcloud.me",
"soundclouddesign.com",
"soundcloudpress.com",
"soundcloudstatus.com",
"soundcloudforartists.com",
),
),
ServicePreset(
id="ntcparty",
name="NTC.party",
icon=FIF.GLOBE,
description="Форум ntc.party",
default_action="proxy",
domains=(
"ntc.party",
),
),
ServicePreset(
id="rutracker",
name="RuTracker",
icon=FIF.DOWNLOAD,
description="RuTracker и зеркала",
default_action="proxy",
domains=(
"rutracker.org",
"rutracker.net",
"rutracker.cr",
"rutracker.nl",
"rutracker.ru",
"rutracker.cc",
"rutracker.cloud",
"rutracker.in",
"rutracker.me",
"rutracker.is",
"dostup-rutracker.org",
"maintracker.net",
"maintracker.org",
"rutracker-net.ru",
),
),
ServicePreset(
id="rutor",
name="Rutor",
icon=FIF.DOWNLOAD,
description="Rutor и зеркала",
default_action="proxy",
domains=(
"rutor.info",
"rutor.is",
),
),
ServicePreset(
id="amazon_cdn",
name="Amazon / Cloudflare / Epic",
icon=FIF.CLOUD,
description="AWS, Cloudflare, Epic Games CDN",
default_action="proxy",
domains=(
"cloudflare-ech.com",
"cloudflare.com",
"cloudflareportal.com",
"cloudflareok.com",
"cloudflareclient.com",
"cloudflarecp.com",
"cloudfront.net",
"cloudflareinsights.com",
"amazon.com",
"amazonaws.com",
"awsstatic.com",
"epicgames.com",
"awsglobalaccelerator.com",
),
),
ServicePreset(
id="claude",
name="Claude AI",
icon=FIF.ROBOT,
description="Claude AI, Anthropic",
default_action="proxy",
domains=(
"claude.ai",
"claude.com",
"antropic.com",
),
),
# --- Direct by default ---
ServicePreset(
id="steam",
name="Steam",
icon=FIF.GAME,
description="Steam, Valve, SteamPowered",
default_action="direct",
domains=(
"steamcommunity.com",
"steampowered.com",
"steam-chat.com",
"steamgames.com",
"steamusercontent.com",
"steamcontent.com",
"steamstatic.com",
"akamaihd.net",
"steam-api.com",
"steamserver.net",
"playartifact.com",
"s.team",
"steam.tv",
"steamdeck.com",
"underlords.com",
"valvesoftware.com",
),
),
ServicePreset(
id="google",
name="Google",
icon=FIF.SEARCH,
description="Google, gstatic, googleapis",
default_action="direct",
domains=(
"google.com",
"gstatic.com",
"googleapis.com",
"googleusercontent.com",
"doubleclick.net",
"withgoogle.com",
),
),
ServicePreset(
id="github",
name="GitHub",
icon=FIF.CODE,
description="GitHub, githubassets, ghcr.io",
default_action="direct",
domains=(
"github.com",
"github.io",
"githubassets.com",
"githubusercontent.com",
"ghcr.io",
"githubstatus.com",
"githubapp.com",
"scoop.sh",
),
),
ServicePreset(
id="whatsapp",
name="WhatsApp",
icon=FIF.PHONE,
description="WhatsApp, wa.me",
default_action="proxy",
domains=(
"whatsapp.com",
"whatsapp.net",
"whatsapp.co",
"wl.co",
"wa.me",
"whatsappbrand.com",
),
),
ServicePreset(
id="maxru",
name="Max.ru",
icon=FIF.GLOBE,
description="Max.ru и поддомены",
default_action="block",
domains=(
"max.ru",
),
),
ServicePreset(
id="speedtest",
name="Speedtest",
icon=FIF.SPEED_HIGH,
description="Speedtest, Ookla",
default_action="proxy",
domains=(
"speedtest.net",
"ooklaserver.net",
"ziffstatic.com",
"cdnst.net",
),
),
ServicePreset(
id="roblox",
name="Roblox",
icon=FIF.GAME,
description="Roblox, rbxcdn и зеркала",
default_action="proxy",
domains=(
"roblox.com",
"roblox.net",
"roblox.org",
"robloxapp.com",
"robloxgames.com",
"robloxlabs.com",
"rbxcdn.com",
"rbxcdn.net",
"rbxcdn.org",
"rbxcdn.io",
"rbxinfra.net",
"rbxtrk.com",
"rbxlabs.com",
"rblx.com",
"rblx.co",
"rblx.org",
),
),
)
SERVICE_PRESETS_BY_ID: dict[str, ServicePreset] = {s.id: s for s in SERVICE_PRESETS}