Files
LorenEteval_Furious/Furious/Utility/Constants.py
T
2025-06-22 11:07:16 +08:00

116 lines
3.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Copyright (C) 2024–present Loren Eteval & contributors <loren.eteval@proton.me>
#
# This file is part of Furious.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from Furious.Version import __version__
from PySide6 import QtCore, __version__ as _pyside6_version
from PySide6.QtWidgets import QApplication
import os
import math
import pathlib
import platform
import functools
APP = functools.partial(QApplication.instance)
APPLICATION_NAME = 'Furious'
APPLICATION_VERSION = __version__
APPLICATION_MACOS_SIGNATURE = 'com.Furious'
APPLICATION_REPO_OWNER_NAME = 'LorenEteval'
APPLICATION_REPO_NAME = 'Furious'
APPLICATION_ABOUT_PAGE = (
f'https://github.com/{APPLICATION_REPO_OWNER_NAME}/{APPLICATION_REPO_NAME}'
)
ORGANIZATION_NAME = 'Furious'
ORGANIZATION_DOMAIN = 'Furious.GUI'
# Tested: Furious supports minimum PySide6 version 6.1.0
PYSIDE6_VERSION = _pyside6_version
OS_CPU_COUNT = os.cpu_count()
PLATFORM = platform.system()
PLATFORM_RELEASE = platform.release()
PLATFORM_MACHINE = platform.machine()
LOCAL_SERVER_NAME = '891ad49d-8996-43cb-820c-d9baf42a04de'
SYSTEM_LANGUAGE = QtCore.QLocale().name()[:2].upper()
GOLDEN_RATIO = (math.sqrt(5) + 1) / 2
PROXY_OUTBOUND_USER_EMAIL = f'user@{ORGANIZATION_DOMAIN}'
ROOT_DIR = pathlib.Path(__file__).resolve().parent.parent.parent
PACKAGE_DIR = ROOT_DIR / APPLICATION_NAME
DATA_DIR = PACKAGE_DIR / 'Data'
XRAY_ASSET_DIR = DATA_DIR / 'xray'
CRASH_LOG_DIR = PACKAGE_DIR / 'CrashLog'
GEN_TRANSLATION_FILE = PACKAGE_DIR / 'Externals' / 'GenTranslation.py'
URL_GEOSITE = 'https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat'
URL_GEOIP = (
'https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat'
)
URL_GEOSITE_SHA256 = 'https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat.sha256sum'
URL_GEOIP_SHA256 = 'https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat.sha256sum'
XRAY_ASSET_PATH_GEOSITE = XRAY_ASSET_DIR / 'geosite.dat'
XRAY_ASSET_PATH_GEOIP = XRAY_ASSET_DIR / 'geoip.dat'
PROXY_SERVER_BYPASS = (
'localhost;*.local;127.*;10.*;172.16.*;172.17.*;'
'172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;'
'172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*'
)
if PLATFORM == 'Windows':
if PLATFORM_RELEASE != '7':
# https://github.com/2dust/v2rayN/issues/4334
PROXY_SERVER_BYPASS += ';<local>'
CORE_CHECK_ALIVE_INTERVAL = 2500
if PLATFORM == 'Windows':
APPLICATION_TUN_DEVICE_NAME = APPLICATION_NAME
elif PLATFORM == 'Darwin':
APPLICATION_TUN_DEVICE_NAME = 'utun777'
else:
APPLICATION_TUN_DEVICE_NAME = ''
APPLICATION_TUN_NETWORK_INTERFACE_NAME = 'en0' if PLATFORM == 'Darwin' else ''
APPLICATION_TUN_GATEWAY_ADDRESS = '10.0.68.1'
if PLATFORM == 'Windows':
APPLICATION_TUN_IP_ADDRESS = '10.0.68.10'
else:
APPLICATION_TUN_IP_ADDRESS = APPLICATION_TUN_GATEWAY_ADDRESS
APPLICATION_TUN_INTERFACE_DNS_ADDRESS = '1.1.1.1'
ADMINISTRATOR_NAME = 'Administrator' if PLATFORM == 'Windows' else 'root'
NETWORK_STATE_TEST_URL = 'http://cp.cloudflare.com'
NETWORK_SPEED_TEST_URL = (
'http://speed.cloudflare.com/__down?during=download&bytes=104857600'
)
UNICODE_LARGE_RED_CIRCLE = u'\U0001F534'
UNICODE_LARGE_GREEN_CIRCLE = u'\U0001F7E2'