return shadowsocks
This commit is contained in:
+27
-6
@@ -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";
|
||||
$options = !empty($ssl) && !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" . (!empty($ssl) ? ';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>";
|
||||
@@ -4149,6 +4165,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 +6460,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'])) {
|
||||
@@ -6937,6 +6957,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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -44,6 +44,8 @@ services:
|
||||
condition: service_healthy
|
||||
ad:
|
||||
condition: service_started
|
||||
ss:
|
||||
condition: service_started
|
||||
env_file:
|
||||
- path: ./.env
|
||||
required: true # default
|
||||
@@ -192,6 +194,8 @@ services:
|
||||
- xr
|
||||
- oc
|
||||
- np
|
||||
- proxy
|
||||
- ss
|
||||
wg:
|
||||
image: mercurykd/vpnbot-wg:1.1
|
||||
build:
|
||||
@@ -460,3 +464,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
|
||||
|
||||
Reference in New Issue
Block a user