Compare commits

...

3 Commits

Author SHA1 Message Date
mercury c115661529 images from hub 2024-02-29 00:10:00 +04:00
mercury e0ee25127f update version 2024-02-28 15:22:16 +04:00
mercury ae2e9c0205 mirror 2024-02-28 14:53:11 +04:00
13 changed files with 179 additions and 17 deletions
+2 -2
View File
@@ -3,6 +3,6 @@ WGADDRESS=10.0.1.1/24
WGPORT=51820
SSPORT=8388
TGPORT=4443
SYSTEM=ubuntu
RELEASE=18.04
IMAGE=alpine:3.18.2
IP=
VER=
+1
View File
@@ -15,3 +15,4 @@
!/app/zapretlists/.gitkeep
.vscode/
.idea/
mirror/.env
+77 -1
View File
@@ -117,7 +117,7 @@ class Bot
case preg_match('~^/menu (?P<type>addpeer) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>wg) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>client) (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac|adguard|config|ss|lang|oc|naive)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac|adguard|config|ss|lang|oc|naive|mirror)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>subzoneslist|reverselist|includelist|excludelist) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
$this->menu(type: $m['type'] ?? false, arg: $m['arg'] ?? false);
break;
@@ -127,6 +127,9 @@ class Bot
case preg_match('~^/mtproto$~', $this->input['callback'], $m):
$this->mtproto();
break;
case preg_match('~^/getMirror$~', $this->input['callback'], $m):
$this->getMirror();
break;
case preg_match('~^/logs$~', $this->input['callback'], $m):
$this->logs();
break;
@@ -2936,6 +2939,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/menu pac",
],
],
[
[
'text' => $this->i18n('mirror'),
'callback_data' => "/menu mirror",
],
],
[
[
'text' => $this->i18n('config'),
@@ -2968,6 +2977,7 @@ DNS-over-HTTPS with IP:
'lang' => $type == 'lang' ? $this->menuLang() : false,
'oc' => $type == 'oc' ? $this->ocMenu() : false,
'naive' => $type == 'naive' ? $this->naiveMenu() : false,
'mirror' => $type == 'mirror' ? $this->mirrorMenu() : false,
];
$text = $menu[$type ?: 'main' ]['text'];
@@ -3034,6 +3044,72 @@ DNS-over-HTTPS with IP:
];
}
public function mirrorMenu()
{
$ip = $this->getPacConf()['domain'] ?: $this->ip;
$hash = substr(md5($this->key), 0, 8);
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
$text[] = "Menu -> Mirror";
$text[] = <<<PNG
<pre>client -> intermediate VPS -> vpnbot
^ |
| install |
| mirror |
-----------
</pre>
PNG;
$text[] = "<code>$scheme://$ip/pac?h=$hash&t=mirror</code>";
$data[] = [
[
'text' => $this->i18n('download'),
'callback_data' => "/getMirror",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/menu",
],
];
return [
'text' => implode("\n", $text),
'data' => $data,
];
}
public function getMirror()
{
unlink('/config/mirror.tar.gz');
unlink('/config/mirror.tar');
$s = file_get_contents('/mirror/start_socat.sh');
$t = preg_replace([
'~{ip}~',
'~{tg}~',
'~{ss}~',
'~{wg}~',
], [
getenv('IP'),
getenv('TGPORT'),
getenv('SSPORT'),
getenv('WGPORT'),
], $s);
file_put_contents('/mirror/start_socat.sh', $t);
$a = new PharData('/config/mirror.tar');
$a->buildFromDirectory('/mirror');
$a->compress(Phar::GZ);
if (!empty($this->input)) {
$this->sendFile($this->input['from'], curl_file_create('/config/mirror.tar.gz'));
} else {
header('Content-Disposition: attachment; filename=mirror.tar.gz');
header('Content-Type: application/tar+gzip');
echo file_get_contents('/config/mirror.tar.gz');
exit;
}
unlink('/config/mirror.tar.gz');
unlink('/config/mirror.tar');
file_put_contents('/mirror/start_socat.sh', $s);
}
public function ocMenu()
{
$pac = $this->getPacConf();
+8
View File
@@ -293,4 +293,12 @@ $i = [
'en' => 'dns',
'ru' => 'днс',
],
'mirror' => [
'en' => 'mirror',
'ru' => 'зеркало',
],
'download' => [
'en' => 'download',
'ru' => 'скачать',
],
];
+18 -11
View File
@@ -22,17 +22,24 @@ $address = $_GET['a'] ?: '127.0.0.1';
$port = $_GET['p'] ?: '1080';
$hash = $_GET['h'];
if ($hash == substr(md5($c['key']), 0, 8)) {
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
$pac = file_get_contents($file);
header('Content-Type: text/plain');
echo str_replace([
'~address~',
'~port~',
], [
$address,
$port,
], $pac);
exit;
if ($type == 'mirror') {
require __DIR__ . '/bot.php';
require __DIR__ . '/i18n.php';
$bot = new Bot($c['key'], $i);
$bot->getMirror();
} else {
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
$pac = file_get_contents($file);
header('Content-Type: text/plain');
echo str_replace([
'~address~',
'~port~',
], [
$address,
$port,
], $pac);
exit;
}
}
}
+24
View File
@@ -17,6 +17,7 @@ volumes:
services:
up:
image: mercurykd/vpnbot-up:1.1
build:
context: dockerfile
dockerfile: nginx.dockerfile
@@ -32,6 +33,7 @@ services:
ports:
- 443:443
hostname: upstream
container_name: upstream-${VER}
depends_on:
php:
condition: service_healthy
@@ -48,6 +50,7 @@ services:
ipv4_address: 10.10.0.10
logging: *default-logging
ng:
image: mercurykd/vpnbot-ng:1.1
build:
context: dockerfile
dockerfile: nginx.dockerfile
@@ -66,6 +69,7 @@ services:
ports:
- 80:80
hostname: nginx
container_name: nginx-${VER}
depends_on:
up:
condition: service_started
@@ -79,6 +83,7 @@ services:
ipv4_address: 10.10.0.2
logging: *default-logging
php:
image: mercurykd/vpnbot-php:1.1
build:
dockerfile: dockerfile/php.dockerfile
args:
@@ -94,6 +99,8 @@ services:
- ./scripts/start_php.sh:/start_php.sh
- ./scripts/check_file.sh:/check_file.sh
- ./version:/version
- ./mirror:/mirror
- ./.env:/mirror/.env
environment:
TZ: ${TZ}
IP: ${IP}
@@ -102,6 +109,7 @@ services:
SSPORT: ${SSPORT}
TGPORT: ${TGPORT}
hostname: php
container_name: php-${VER}
restart: unless-stopped
stop_grace_period: 1s
command: ["/bin/sh", "/start_php.sh"]
@@ -118,6 +126,7 @@ services:
timeout: 5s
retries: 5
proxy:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -129,6 +138,7 @@ services:
- ./config/sshd_config:/etc/ssh/sshd_config
- ./scripts/start_proxy.sh:/start_proxy.sh
hostname: proxy
container_name: proxy-${VER}
depends_on:
php:
condition: service_healthy
@@ -142,6 +152,7 @@ services:
command: ["/bin/sh", "/start_proxy.sh"]
logging: *default-logging
wg:
image: mercurykd/vpnbot-wg:1.1
build:
dockerfile: dockerfile/wireguard.dockerfile
args:
@@ -159,6 +170,7 @@ services:
- ./ssh:/ssh
- ./config/sshd_config:/etc/ssh/sshd_config
hostname: wireguard
container_name: wireguard-${VER}
depends_on:
php:
condition: service_healthy
@@ -179,6 +191,7 @@ services:
ipv4_address: 10.10.0.4
logging: *default-logging
ad:
image: mercurykd/vpnbot-ad:1.1
build:
dockerfile: dockerfile/adguard.dockerfile
args:
@@ -197,6 +210,7 @@ services:
- ./logs/:/logs/
- ./scripts/start_ad.sh:/start_ad.sh
hostname: adguard
container_name: adguard-${VER}
depends_on:
php:
condition: service_healthy
@@ -211,6 +225,7 @@ services:
entrypoint: ["/bin/sh", "/start_ad.sh"]
logging: *default-logging
ss:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -222,6 +237,7 @@ services:
- ./config/sshd_config:/etc/ssh/sshd_config
- ./scripts/start_ss.sh:/start_ss.sh
hostname: shadowsocks
container_name: shadowsocks-${VER}
depends_on:
php:
condition: service_healthy
@@ -238,6 +254,7 @@ services:
ipv4_address: 10.10.0.6
logging: *default-logging
tg:
image: mercurykd/vpnbot-tg:1.1
build:
dockerfile: dockerfile/telegram.dockerfile
volumes:
@@ -247,6 +264,7 @@ services:
- ./scripts/start_tg.sh:/start_tg.sh
- ./config/mtprotosecret:/mtprotosecret
hostname: telegram
container_name: mtproto-${VER}
depends_on:
php:
condition: service_healthy
@@ -263,6 +281,7 @@ services:
ipv4_address: 10.10.0.8
logging: *default-logging
xr:
image: mercurykd/vpnbot-xr:1.1
build:
dockerfile: dockerfile/xray.dockerfile
args:
@@ -274,6 +293,7 @@ services:
- ./config/xray.json:/xray.json
- ./scripts/start_xray.sh:/start_xray.sh
hostname: xray
container_name: xray-${VER}
depends_on:
php:
condition: service_healthy
@@ -286,6 +306,7 @@ services:
ipv4_address: 10.10.0.9
logging: *default-logging
oc:
image: mercurykd/vpnbot-oc:1.1
build:
dockerfile: dockerfile/ocserv.dockerfile
args:
@@ -298,6 +319,7 @@ services:
- ./certs:/certs
- ./scripts/start_oc.sh:/start_oc.sh
hostname: ocserv
container_name: openconnect-${VER}
depends_on:
php:
condition: service_healthy
@@ -315,6 +337,7 @@ services:
ipv4_address: 10.10.0.11
logging: *default-logging
np:
image: mercurykd/vpnbot-np:1.1
build:
dockerfile: dockerfile/naive.dockerfile
args:
@@ -327,6 +350,7 @@ services:
- ./certs:/certs
- ./scripts/start_np.sh:/start_np.sh
hostname: naive
container_name: naive-${VER}
depends_on:
php:
condition: service_healthy
+1
View File
@@ -3,6 +3,7 @@ FROM $image
RUN apk add --no-cache --update php81 \
php81-mbstring \
php81-session \
php81-phar \
php81-curl \
php81-opcache \
php81-openssl \
+5 -3
View File
@@ -1,7 +1,7 @@
b:
docker compose build
u: # запуск контейнеров
IP=$(shell ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$$|\1|p' | awk '{print $1}' | head -1) docker compose up -d --build --force-recreate
IP=$(shell ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$$|\1|p' | awk '{print $1}' | head -1) VER=$(shell git describe --tags) docker compose up -d --force-recreate
d: # остановка контейнеров
docker compose down
dv: # остановка контейнеров
@@ -40,8 +40,8 @@ cleanf:
docker image prune -f > /dev/null
docker builder prune -f > /dev/null
cleanall:
docker image prune -a
docker builder prune -a
docker image prune -a -f
docker builder prune -a -f
p:
git stash
git pull
@@ -49,3 +49,5 @@ p:
update: p r
cn:
docker compose exec ng nginx -t
push:
docker compose push
+18
View File
@@ -0,0 +1,18 @@
version: "3"
services:
socat:
build:
dockerfile: ./dockerfile
ports:
- 80:80
- 443:443
- 853:853
- ${TGPORT}:${TGPORT}
- ${SSPORT}:${SSPORT}
- ${SSPORT}:${SSPORT}/udp
- ${WGPORT}:${WGPORT}/udp
volumes:
- ./start_socat.sh:/start_socat.sh
command: /bin/sh /start_socat.sh
stop_grace_period: 1s
+2
View File
@@ -0,0 +1,2 @@
FROM alpine:3.18
RUN apk add socat htop net-tools
+11
View File
@@ -0,0 +1,11 @@
b:
docker compose build --no-cache
u:
docker compose up -d --build
d:
docker compose down
ps:
docker compose ps
e:
docker compose exec socat sh
r: d u
+8
View File
@@ -0,0 +1,8 @@
socat TCP-LISTEN:80,fork TCP:{ip}:80 &
socat TCP-LISTEN:443,fork TCP:{ip}:443 &
socat TCP-LISTEN:853,fork TCP:{ip}:853 &
socat TCP-LISTEN:{tg},fork TCP:{ip}:{tg} &
socat TCP-LISTEN:{ss},fork TCP:{ip}:{ss} &
socat UDP-LISTEN:{ss},fork UDP:{ip}:{ss} &
socat UDP-LISTEN:{wg},fork UDP:{ip}:{wg} &
tail -f /dev/null
+4
View File
@@ -1,3 +1,7 @@
29.02.2024 образы теперь будут скачиваться с docker hub
- <code>git pull && make d cleanall u</code>
28.02.2024 v1.1 добавлен раздел "зеркало"
- <code>git pull && make r</code>
27.02.2024 оптимизация размеров образов, сборка naive из исходников
- <code>git pull && make r</code>
19.02.2024 добавлен NaiveProxy