Compare commits

...

4 Commits

Author SHA1 Message Date
mercury 7e20c14299 update version 2025-01-07 21:02:43 +04:00
mercury b9155cf674 fix show ports on start 2025-01-07 21:00:06 +04:00
mercury 159f775e12 port accounting for shadowsocks 2025-01-07 18:30:57 +04:00
mercury ae672439be return shadowsocks 2025-01-07 18:01:44 +04:00
6 changed files with 147 additions and 7 deletions
+33 -7
View File
@@ -1531,6 +1531,8 @@ class Bot
'xray' => $this->getXray(),
'oc' => file_get_contents('/config/ocserv.conf'),
'ocu' => file_get_contents('/config/ocserv.passwd'),
'ss' => $this->getSSConfig(),
'sl' => $this->getSSLocalConfig(),
];
return json_encode($conf, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
@@ -1612,6 +1614,22 @@ class Bot
yaml_emit_file($this->adguard, $json['ad']);
$this->startAd();
}
// ss
if (!empty($json['ss'])) {
$out[] = 'update shadowsocks server';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->ssh('pkill ssserver', 'ss');
file_put_contents('/config/ssserver.json', json_encode($json['ss'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$this->ssh('ssserver -v -d -c /config.json', 'ss');
}
// sl
if (!empty($json['sl'])) {
$out[] = 'update shadowsocks proxy';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->ssh('pkill sslocal', 'proxy');
file_put_contents('/config/sslocal.json', json_encode($json['sl'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$this->ssh('sslocal -v -d -c /config.json', 'proxy');
}
// mtproto
if (!empty($json['mtproto'])) {
$out[] = 'update mtproto';
@@ -3995,14 +4013,12 @@ DNS-over-HTTPS with IP:
public function menuSS()
{
$conf = $this->getPacConf();
$ip = $this->ip;
$hash = $this->getHashBot();
$domain = $this->getDomain();
$scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
$ss = $this->getSSConfig();
$v2ray = !empty($ss['plugin']) ? 'ON' : 'OFF';
$port = !empty($ss['plugin']) ? (!empty($ssl) ? 443 : 80) : getenv('SSPORT');
$options = !empty($ssl) && !empty($ss['plugin']) ? "tls;fast-open;path=/v2ray;host=$domain" : "path=/v2ray;host=$domain";
$port = !empty($ss['plugin']) ? 443 : getenv('SSPORT');
$options = !empty($ss['plugin']) ? "tls;fast-open;path=/v2ray$hash;host=$domain" : "path=/v2ray$hash;host=$domain";
$text = "Menu -> ShadowSocks";
$data[] = [
@@ -4011,7 +4027,7 @@ DNS-over-HTTPS with IP:
'callback_data' => "/sspswd",
],
];
$ss_link = preg_replace('~==~', '', 'ss://' . base64_encode("{$ss['method']}:{$ss['password']}")) . "@$domain:$port" . (!empty($ss['plugin']) ? '?plugin=' . urlencode("v2ray-plugin;path=/v2ray;host=$domain" . (!empty($ssl) ? ';tls' : '')) : '');
$ss_link = preg_replace('~==~', '', 'ss://' . base64_encode("{$ss['method']}:{$ss['password']}")) . "@$domain:$port" . (!empty($ss['plugin']) ? '?plugin=' . urlencode("v2ray-plugin;path=/v2ray$hash;host=$domain;tls") : '');
$text .= "\n\n<code>$ss_link</code>\n";
$text .= "\n\npassword: <span class='tg-spoiler'>{$ss['password']}</span>";
$text .= "\n\nserver: <code>$domain:$port</code>";
@@ -4089,6 +4105,7 @@ DNS-over-HTTPS with IP:
$main[] = $this->i18n($c['wg1'] ? 'on' : 'off') . ' ' . getenv('WG1PORT') . ' Wireguard 1';
$main[] = $this->i18n($c['tg'] ? 'on' : 'off') . ' ' . getenv('TGPORT') . ' MTProto';
$main[] = $this->i18n($c['ad'] ? 'on' : 'off') . ' 853 AdguardHome DoT';
$main[] = $this->i18n($c['ss'] ? 'on' : 'off') . ' 8388 Shadowsocks';
if (!empty($conf['domain'])) {
$main[] = '';
$oc = $this->getHashSubdomain('oc');
@@ -4149,6 +4166,10 @@ DNS-over-HTTPS with IP:
],
],
[
[
'text' => $this->i18n('sh_title'),
'callback_data' => "/menu ss",
],
[
'text' => $this->i18n('pac'),
'callback_data' => "/pacMenu 0",
@@ -6440,7 +6461,7 @@ DNS-over-HTTPS with IP:
location
CONF;
$template = preg_replace('~(location /adguard.+?})\s*location~s', $r, $template);
$template = preg_replace('~(/webapp|/pac|/adguard|/ws|location /dns-query)~', '${1}' . $h, $template);
$template = preg_replace('~(/webapp|/pac|/adguard|/ws|/v2ray|location /dns-query)~', '${1}' . $h, $template);
file_put_contents('/config/nginx.conf', $template);
$x = $this->getXray();
if (!empty($x['inbounds'][0]['streamSettings']['wsSettings']['path'])) {
@@ -6915,6 +6936,10 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n($c['ad'] ? 'on' : 'off') . ' 853 AdguardHome DoT',
'callback_data' => "/hidePort ad",
]],
[[
'text' => $this->i18n($c['ss'] ? 'on' : 'off') . ' 8388 Shadowsocks',
'callback_data' => "/hidePort ss",
]],
];
$data[] = [
[
@@ -6937,6 +6962,7 @@ DNS-over-HTTPS with IP:
'wg1' => getenv('WG1PORT') . ':' . getenv('WG1PORT') . '/udp',
'tg' => getenv('TGPORT') . ':' . getenv('TGPORT'),
'ad' => '853:853',
'ss' => '8388:8388',
];
$f = '/docker/compose';
$c = yaml_parse_file($f);
+1
View File
@@ -13,6 +13,7 @@ if ($c['debug']) {
$bot = new Bot($c['key'], $i);
$bot->selfUpdate();
$bot->ssPswdCheck();
$bot->restartTG();
if (!empty($bot->selfupdate)) {
$bot->offWarp();
+24
View File
@@ -97,6 +97,18 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 5d;
}
location /v2ray {
access_log /logs/nginx_v2ray_access;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://ss:8388/;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /dns-query {
access_log /logs/nginx_doh_access;
proxy_http_version 1.1;
@@ -162,6 +174,17 @@ http {
# proxy_pass http://php;
# }
# location /v2ray {
# access_log /logs/nginx_v2ray_access;
# proxy_redirect off;
# proxy_buffering off;
# proxy_http_version 1.1;
# proxy_pass http://ss:8388/;
# proxy_set_header Host $http_host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
# location /ws {
# proxy_pass http://xr:443;
# proxy_redirect off;
@@ -173,6 +196,7 @@ http {
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_read_timeout 5d;
# }
# location /dns-query {
# access_log /logs/nginx_doh_access;
# proxy_http_version 1.1;
+24
View File
@@ -97,6 +97,18 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 5d;
}
location /v2ray {
access_log /logs/nginx_v2ray_access;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://ss:8388/;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /dns-query {
access_log /logs/nginx_doh_access;
proxy_http_version 1.1;
@@ -162,6 +174,17 @@ http {
# proxy_pass http://php;
# }
# location /v2ray {
# access_log /logs/nginx_v2ray_access;
# proxy_redirect off;
# proxy_buffering off;
# proxy_http_version 1.1;
# proxy_pass http://ss:8388/;
# proxy_set_header Host $http_host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
# location /ws {
# proxy_pass http://xr:443;
# proxy_redirect off;
@@ -173,6 +196,7 @@ http {
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_read_timeout 5d;
# }
# location /dns-query {
# access_log /logs/nginx_doh_access;
# proxy_http_version 1.1;
+63
View File
@@ -44,6 +44,8 @@ services:
condition: service_healthy
ad:
condition: service_started
ss:
condition: service_started
env_file:
- path: ./.env
required: true # default
@@ -162,6 +164,7 @@ services:
- ./update:/update
- ./.git:/.git
- ./scripts/start_service.sh:/start_service.sh
- ./docker-compose.override.yml:/docker/compose
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
IP: ${IP}
@@ -192,6 +195,8 @@ services:
- xr
- oc
- np
- proxy
- ss
wg:
image: mercurykd/vpnbot-wg:1.1
build:
@@ -460,3 +465,61 @@ services:
default:
ipv4_address: 10.10.0.13
logging: *default-logging
proxy:
image: mercurykd/vpnbot-ss:1.2
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
image: ${IMAGE}
volumes:
- ./config/.profile:/root/.ashrc:ro
- ./config/sslocal.json:/config.json
- ./ssh:/ssh
- ./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
networks:
default:
ipv4_address: 10.10.0.3
environment:
TZ: ${TZ}
env_file:
- path: ./.env
required: true # default
- path: ./override.env
required: false
stop_grace_period: 1s
command: ["/bin/sh", "/start_proxy.sh"]
logging: *default-logging
ss:
image: mercurykd/vpnbot-ss:1.2
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
image: ${IMAGE}
volumes:
- ./config/.profile:/root/.ashrc:ro
- ./config/ssserver.json:/config.json
- ./ssh:/ssh
- ./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
env_file:
- path: ./.env
required: true # default
- path: ./override.env
required: false
stop_grace_period: 1s
command: ["/bin/sh", "/start_ss.sh"]
networks:
default:
ipv4_address: 10.10.0.6
logging: *default-logging
+2
View File
@@ -1,3 +1,5 @@
07.01.2025 v2.4
- вернул shadowsocks (спасибо за донат)
04.01.2025
- возможность установить нужную версию с нуля
- корректировка автосканера под новую версию