mirror of
https://github.com/andrey271192/Domain_web.git
synced 2026-09-20 14:41:58 +00:00
feat: GeoExport mirror with VPS install/uninstall
Add static site copy, Node server, and one-line deploy scripts for nginx + systemd on Ubuntu VPS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2
site/.gitignore
vendored
Normal file
2
site/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
.DS_Store
|
||||
37
site/README.md
Normal file
37
site/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GeoExport — локальная копия
|
||||
|
||||
Зеркало интерфейса [geoexport.org](https://geoexport.org/): экспорт списков geoip/geosite для VPN-клиентов (Xray, 3x-ui, V2Ray).
|
||||
|
||||
## Запуск
|
||||
|
||||
```bash
|
||||
cd ~/geoexport-clone
|
||||
npm start
|
||||
```
|
||||
|
||||
Откройте в браузере: **http://127.0.0.1:4173**
|
||||
|
||||
Другой порт: `PORT=8080 npm start`
|
||||
|
||||
## Состав
|
||||
|
||||
| Путь | Назначение |
|
||||
|------|------------|
|
||||
| `index.html` | Точка входа SPA |
|
||||
| `assets/` | Собранный фронтенд (React + Tailwind) с оригинала |
|
||||
| `data/*.json` | Кэш API: пресеты, источники, дата обновления |
|
||||
| `server.mjs` | Локальный сервер: статика + JSON + прокси динамических API |
|
||||
|
||||
## Обновление данных
|
||||
|
||||
```bash
|
||||
curl -sL https://geoexport.org/api/presets -o data/presets.json
|
||||
curl -sL https://geoexport.org/api/sources -o data/sources.json
|
||||
curl -sL https://geoexport.org/api/last-update -o data/last-update.json
|
||||
curl -sL https://geoexport.org/api/routing/presets -o data/routing-presets.json
|
||||
```
|
||||
|
||||
## Ограничения
|
||||
|
||||
- Экспорт, поиск, DNS lookup и генерация routing проксируются на живой `geoexport.org` (нужен интернет).
|
||||
- Это копия UI и кэшированных справочников, не полный автономный бэкенд с базами `.dat`.
|
||||
69
site/assets/index-VQj200iM.js
Normal file
69
site/assets/index-VQj200iM.js
Normal file
File diff suppressed because one or more lines are too long
1
site/assets/index-uS40y9LP.css
Normal file
1
site/assets/index-uS40y9LP.css
Normal file
File diff suppressed because one or more lines are too long
1
site/data/last-update.json
Normal file
1
site/data/last-update.json
Normal file
@@ -0,0 +1 @@
|
||||
{"last_update":"2026-05-24","updating":false,"sources":[{"source_slug":"runetfreedom","source_name":"RuNet Freedom","last_update":"2026-05-24","compatible":"Xray, 3x-ui, V2Ray"},{"source_slug":"loyalsoldier","source_name":"Loyalsoldier","last_update":"2026-05-24","compatible":"Xray, 3x-ui, V2Ray, Mihomo"},{"source_slug":"daniellavrushin","source_name":"DanielLavrushin (b4geoip)","last_update":"2026-05-24","compatible":"Xray, 3x-ui"},{"source_slug":"v2fly","source_name":"v2fly (официальный)","last_update":"2026-05-24","compatible":"Xray, 3x-ui, V2Ray, Sing-box"}]}
|
||||
1
site/data/presets.json
Normal file
1
site/data/presets.json
Normal file
File diff suppressed because one or more lines are too long
1
site/data/routing-presets.json
Normal file
1
site/data/routing-presets.json
Normal file
@@ -0,0 +1 @@
|
||||
{"presets":{"direct_sites":[{"id":"ru_sites","label":"Российские сайты","description":"Домены .ru, .рф и российские сервисы — идут напрямую без VPN","value":"geosite:category-ru","checked":true},{"id":"ru_whitelist","label":"Белый список РФ","description":"Дополнительный список российских сервисов и госсайтов","value":"geosite:whitelist","checked":true},{"id":"private","label":"Локальная сеть","description":"192.168.x.x, 10.x.x.x и другие приватные адреса — всегда напрямую","value":"geosite:private","checked":true},{"id":"apple","label":"Apple","description":"iCloud, App Store, Apple Maps — для корректной работы устройства","value":"geosite:apple","checked":true},{"id":"microsoft","label":"Microsoft","description":"Windows Update, Office, Teams — экономия трафика VPN","value":"geosite:microsoft","checked":false},{"id":"steam","label":"Steam","description":"Игры и обновления Steam — напрямую для скорости","value":"geosite:steam","checked":false},{"id":"google_cn","label":"Google (доступные сервисы)","description":"Сервисы Google доступные в РФ без VPN","value":"geosite:google@cn","checked":false}],"direct_ips":[{"id":"geoip_ru","label":"IP-адреса России","description":"Все российские IP-диапазоны — напрямую","value":"geoip:ru","checked":true},{"id":"geoip_private","label":"Приватные IP","description":"10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16","value":"geoip:private","checked":true}],"proxy_sites":[{"id":"youtube","label":"YouTube","description":"YouTube заблокирован в РФ — направляем через VPN","value":"geosite:youtube","checked":true},{"id":"telegram","label":"Telegram","description":"Серверы Telegram — через VPN для надёжности","value":"geosite:telegram","checked":true},{"id":"meta","label":"Meta (Instagram, Facebook)","description":"Instagram и Facebook заблокированы в РФ","value":"geosite:facebook","checked":true},{"id":"twitter","label":"Twitter / X","description":"Twitter заблокирован в РФ","value":"geosite:twitter","checked":true},{"id":"netflix","label":"Netflix","description":"Netflix недоступен в РФ","value":"geosite:netflix","checked":false},{"id":"spotify","label":"Spotify","description":"Spotify недоступен в РФ","value":"geosite:spotify","checked":false},{"id":"github","label":"GitHub","description":"GitHub периодически блокируется в РФ","value":"geosite:github","checked":false},{"id":"geolocation_notcn","label":"Все заблокированные (универсальный)","description":"Весь иностранный трафик не из РФ/CN — через VPN. Осторожно: большой список","value":"geosite:geolocation-!cn","checked":false}],"proxy_ips":[{"id":"geoip_telegram","label":"IP Telegram","description":"IP-диапазоны серверов Telegram","value":"geoip:telegram","checked":true}],"block_sites":[{"id":"ads","label":"Реклама","description":"Рекламные домены — блокируем полностью","value":"geosite:category-ads-all","checked":true}],"block_ips":[]},"geo_sources":{"loyalsoldier":{"label":"Loyalsoldier (рекомендуется)","geoip":"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat","geosite":"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"},"runetfreedom":{"label":"RuNet Freedom (РКН + Россия)","geoip":"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat","geosite":"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat"},"daniellavrushin":{"label":"DanielLavrushin (расширенная)","geoip":"https://github.com/DanielLavrushin/b4geoip/releases/latest/download/geoip.dat","geosite":"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"},"v2fly":{"label":"v2fly (оригинальная)","geoip":"https://github.com/v2fly/geoip/releases/latest/download/geoip.dat","geosite":"https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"}},"route_orders":[{"value":"block-direct-proxy","label":"Блок → Прямой → VPN (рекомендуется)"},{"value":"block-proxy-direct","label":"Блок → VPN → Прямой"},{"value":"proxy-direct-block","label":"VPN → Прямой → Блок"}],"dns_types":[{"value":"DoH","label":"DoH (DNS over HTTPS, рекомендуется)"},{"value":"DoU","label":"DoU (DNS over UDP, быстрее)"}]}
|
||||
1
site/data/sources.json
Normal file
1
site/data/sources.json
Normal file
@@ -0,0 +1 @@
|
||||
[{"slug":"runetfreedom","name":"RuNet Freedom","description":"Российские правила блокировок, оптимизировано для обхода РКН","compatible":"Xray, 3x-ui, V2Ray","geoip_url":"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat","geosite_url":"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat"},{"slug":"loyalsoldier","name":"Loyalsoldier","description":"Популярный набор правил, стандарт для большинства клиентов","compatible":"Xray, 3x-ui, V2Ray, Mihomo","geoip_url":"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat","geosite_url":"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"},{"slug":"daniellavrushin","name":"DanielLavrushin (b4geoip)","description":"Расширенная база с дополнительными категориями (Akamai, CDN и др.)","compatible":"Xray, 3x-ui","geoip_url":"https://github.com/DanielLavrushin/b4geoip/releases/latest/download/geoip.dat","geosite_url":null},{"slug":"v2fly","name":"v2fly (официальный)","description":"Официальные базы проекта v2fly/domain-list-community","compatible":"Xray, 3x-ui, V2Ray, Sing-box","geoip_url":"https://github.com/v2fly/geoip/releases/latest/download/geoip.dat","geosite_url":"https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"}]
|
||||
13
site/index.html
Normal file
13
site/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GeoExport</title>
|
||||
<script type="module" crossorigin src="/assets/index-VQj200iM.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-uS40y9LP.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
13
site/package.json
Normal file
13
site/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "geoexport-clone",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": "Local mirror of https://geoexport.org/",
|
||||
"scripts": {
|
||||
"start": "node server.mjs",
|
||||
"dev": "node server.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
146
site/server.mjs
Normal file
146
site/server.mjs
Normal file
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Local GeoExport mirror: static assets + cached JSON + proxy for dynamic API.
|
||||
*/
|
||||
import http from "node:http";
|
||||
import https from "node:https";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const PORT = Number(process.env.PORT) || 4173;
|
||||
const UPSTREAM = "geoexport.org";
|
||||
|
||||
const LOCAL_API = new Set([
|
||||
"/api/presets",
|
||||
"/api/sources",
|
||||
"/api/last-update",
|
||||
"/api/routing/presets",
|
||||
]);
|
||||
|
||||
const DATA_MAP = {
|
||||
"/api/presets": "presets.json",
|
||||
"/api/sources": "sources.json",
|
||||
"/api/last-update": "last-update.json",
|
||||
"/api/routing/presets": "routing-presets.json",
|
||||
};
|
||||
|
||||
const MIME = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".js": "text/javascript; charset=utf-8",
|
||||
".css": "text/css; charset=utf-8",
|
||||
".json": "application/json; charset=utf-8",
|
||||
".ico": "image/x-icon",
|
||||
".svg": "image/svg+xml",
|
||||
".png": "image/png",
|
||||
};
|
||||
|
||||
function send(res, status, body, headers = {}) {
|
||||
res.writeHead(status, headers);
|
||||
res.end(body);
|
||||
}
|
||||
|
||||
function serveFile(res, filePath) {
|
||||
const ext = path.extname(filePath);
|
||||
const type = MIME[ext] || "application/octet-stream";
|
||||
fs.readFile(filePath, (err, data) => {
|
||||
if (err) {
|
||||
send(res, 404, "Not found");
|
||||
return;
|
||||
}
|
||||
send(res, 200, data, { "Content-Type": type });
|
||||
});
|
||||
}
|
||||
|
||||
function serveLocalApi(res, pathname) {
|
||||
const file = DATA_MAP[pathname];
|
||||
if (!file) {
|
||||
send(res, 404, JSON.stringify({ error: "unknown local api" }), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const full = path.join(__dirname, "data", file);
|
||||
fs.readFile(full, (err, data) => {
|
||||
if (err) {
|
||||
send(res, 500, JSON.stringify({ error: err.message }), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
return;
|
||||
}
|
||||
send(res, 200, data, {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "no-cache",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function proxyToUpstream(req, res) {
|
||||
const options = {
|
||||
hostname: UPSTREAM,
|
||||
port: 443,
|
||||
path: req.url,
|
||||
method: req.method,
|
||||
headers: {
|
||||
...req.headers,
|
||||
host: UPSTREAM,
|
||||
},
|
||||
};
|
||||
|
||||
const proxyReq = https.request(options, (proxyRes) => {
|
||||
const headers = { ...proxyRes.headers };
|
||||
delete headers["content-security-policy"];
|
||||
res.writeHead(proxyRes.statusCode || 502, headers);
|
||||
proxyRes.pipe(res);
|
||||
});
|
||||
|
||||
proxyReq.on("error", (err) => {
|
||||
send(res, 502, JSON.stringify({ error: `Upstream error: ${err.message}` }), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
});
|
||||
|
||||
req.pipe(proxyReq);
|
||||
}
|
||||
|
||||
function handler(req, res) {
|
||||
const url = new URL(req.url, `http://127.0.0.1:${PORT}`);
|
||||
let pathname = decodeURIComponent(url.pathname);
|
||||
|
||||
if (pathname.startsWith("/api/")) {
|
||||
if (LOCAL_API.has(pathname)) {
|
||||
serveLocalApi(res, pathname);
|
||||
return;
|
||||
}
|
||||
proxyToUpstream(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pathname === "/") pathname = "/index.html";
|
||||
|
||||
const safe = path.normalize(pathname).replace(/^(\.\.[/\\])+/, "");
|
||||
const filePath = path.join(__dirname, safe);
|
||||
|
||||
if (!filePath.startsWith(__dirname)) {
|
||||
send(res, 403, "Forbidden");
|
||||
return;
|
||||
}
|
||||
|
||||
fs.stat(filePath, (err, stat) => {
|
||||
if (err || !stat.isFile()) {
|
||||
if (!path.extname(pathname)) {
|
||||
serveFile(res, path.join(__dirname, "index.html"));
|
||||
return;
|
||||
}
|
||||
send(res, 404, "Not found");
|
||||
return;
|
||||
}
|
||||
serveFile(res, filePath);
|
||||
});
|
||||
}
|
||||
|
||||
http.createServer(handler).listen(PORT, () => {
|
||||
console.log(`GeoExport clone: http://127.0.0.1:${PORT}`);
|
||||
console.log(`Static + local JSON; export/search/lookup proxied to ${UPSTREAM}`);
|
||||
});
|
||||
Reference in New Issue
Block a user