Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 321b853d42 | |||
| 8effb72cdc | |||
| bec8f5488e | |||
| f97b0f9228 | |||
| 8e8babe1a6 | |||
| 238c380f23 | |||
| abc2e7c587 | |||
| 3f99d9fbf0 |
+270
-179
@@ -320,8 +320,11 @@ class Bot
|
||||
case preg_match('~^/logs$~', $this->input['callback'], $m):
|
||||
$this->logs();
|
||||
break;
|
||||
case preg_match('~^/dnstt$~', $this->input['callback'], $m):
|
||||
$this->dnstt();
|
||||
case preg_match('~^/dnstt$~', $this->input['callback'] ?: $this->input['message'], $m):
|
||||
$this->dnstt(!empty($this->input['callback']));
|
||||
break;
|
||||
case preg_match('~^/showdnstt$~', $this->input['callback'], $m):
|
||||
$this->showdnstt();
|
||||
break;
|
||||
case preg_match('~^/dnsttDownload$~', $this->input['callback'], $m):
|
||||
$this->dnsttDownload();
|
||||
@@ -458,9 +461,6 @@ class Bot
|
||||
case preg_match('~^/enterPage$~', $this->input['callback'], $m):
|
||||
$this->enterPage();
|
||||
break;
|
||||
case preg_match('~^/geodb$~', $this->input['callback'], $m):
|
||||
$this->geodb();
|
||||
break;
|
||||
case preg_match('~^/adguardreset$~', $this->input['callback'], $m):
|
||||
$this->adguardreset();
|
||||
break;
|
||||
@@ -518,6 +518,12 @@ class Bot
|
||||
case preg_match('~^/switchAmnezia (-?\d+)$~', $this->input['callback'], $m):
|
||||
$this->switchAmnezia($m[1]);
|
||||
break;
|
||||
case preg_match('~^/resetAmnezia (-?\d+)$~', $this->input['callback'], $m):
|
||||
$this->resetAmnezia($m[1]);
|
||||
break;
|
||||
case preg_match('~^/reduceAmnezia (-?\d+)$~', $this->input['callback'], $m):
|
||||
$this->reduceAmnezia($m[1]);
|
||||
break;
|
||||
case preg_match('~^/switchExchange (\d+)$~', $this->input['callback'], $m):
|
||||
$this->switchExchange($m[1]);
|
||||
break;
|
||||
@@ -1236,7 +1242,11 @@ class Bot
|
||||
public function chhypass($pass)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
$pac['hysteria_pass'] = $pass;
|
||||
if (!empty($pass)) {
|
||||
$pac['hysteria_pass'] = $pass;
|
||||
} else {
|
||||
unset($pac['hysteria_pass']);
|
||||
}
|
||||
$this->setPacConf($pac);
|
||||
$this->restartHysteria();
|
||||
$this->menu('hy');
|
||||
@@ -2066,63 +2076,79 @@ class Bot
|
||||
$this->restartWG($this->createConfig($server));
|
||||
}
|
||||
|
||||
public function switchAmnezia($page = 0)
|
||||
public function resetAmnezia($page = 0) {
|
||||
$this->switchAmnezia($page, 1);
|
||||
}
|
||||
|
||||
public function reduceAmnezia($page = 0) {
|
||||
$this->switchAmnezia($page, false, 1);
|
||||
}
|
||||
|
||||
public function switchAmnezia($page = 0, $reset = false, $reduce = false)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$amnezia = $c[$this->getInstanceWG(1) . 'amnezia'] = $c[$this->getInstanceWG(1) . 'amnezia'] ? 0 : 1;
|
||||
switch (true) {
|
||||
case !empty($reset):
|
||||
$amnezia = 1;
|
||||
unset($c[$this->getInstanceWG(1) . 'amnezia_keys']);
|
||||
unset($c[$this->getInstanceWG(1) . 'presharedkey']);
|
||||
break;
|
||||
case !empty($reduce):
|
||||
$amnezia = 1;
|
||||
unset($c[$this->getInstanceWG(1) . 'amnezia_keys']['S3']);
|
||||
unset($c[$this->getInstanceWG(1) . 'amnezia_keys']['S4']);
|
||||
unset($c[$this->getInstanceWG(1) . 'amnezia_keys']['I1']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$amnezia = $c[$this->getInstanceWG(1) . 'amnezia'] = $c[$this->getInstanceWG(1) . 'amnezia'] ? 0 : 1;
|
||||
break;
|
||||
}
|
||||
$this->setPacConf($c);
|
||||
|
||||
$pk = $this->presharedKey();
|
||||
$ak = $this->amneziaKeys();
|
||||
$clients = $this->readClients();
|
||||
foreach ($clients as $k => $v) {
|
||||
unset($clients[$k]['peers'][0]['PresharedKey']);
|
||||
unset($clients[$k]['interface']['Jc']);
|
||||
unset($clients[$k]['interface']['Jmin']);
|
||||
unset($clients[$k]['interface']['Jmax']);
|
||||
unset($clients[$k]['interface']['S1']);
|
||||
unset($clients[$k]['interface']['S2']);
|
||||
unset($clients[$k]['interface']['S3']);
|
||||
unset($clients[$k]['interface']['S4']);
|
||||
unset($clients[$k]['interface']['H1']);
|
||||
unset($clients[$k]['interface']['H2']);
|
||||
unset($clients[$k]['interface']['H3']);
|
||||
unset($clients[$k]['interface']['H4']);
|
||||
unset($clients[$k]['interface']['I1']);
|
||||
if (!empty($amnezia)) {
|
||||
$clients[$k]['peers'][0]['PresharedKey'] = $pk;
|
||||
$clients[$k]['interface']['Jc'] = $ak['Jc'];
|
||||
$clients[$k]['interface']['Jmin'] = $ak['Jmin'];
|
||||
$clients[$k]['interface']['Jmax'] = $ak['Jmax'];
|
||||
$clients[$k]['interface']['S1'] = $ak['S1'];
|
||||
$clients[$k]['interface']['S2'] = $ak['S2'];
|
||||
$clients[$k]['interface']['H1'] = $ak['H1'];
|
||||
$clients[$k]['interface']['H2'] = $ak['H2'];
|
||||
$clients[$k]['interface']['H3'] = $ak['H3'];
|
||||
$clients[$k]['interface']['H4'] = $ak['H4'];
|
||||
} else {
|
||||
unset($clients[$k]['peers'][0]['PresharedKey']);
|
||||
unset($clients[$k]['interface']['Jc']);
|
||||
unset($clients[$k]['interface']['Jmin']);
|
||||
unset($clients[$k]['interface']['Jmax']);
|
||||
unset($clients[$k]['interface']['S1']);
|
||||
unset($clients[$k]['interface']['S2']);
|
||||
unset($clients[$k]['interface']['H1']);
|
||||
unset($clients[$k]['interface']['H2']);
|
||||
unset($clients[$k]['interface']['H3']);
|
||||
unset($clients[$k]['interface']['H4']);
|
||||
foreach ($ak as $j => $i) {
|
||||
$clients[$k]['interface'][$j] = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->saveClients($clients);
|
||||
|
||||
$wg = $this->readConfig();
|
||||
unset($wg['interface']['Jc']);
|
||||
unset($wg['interface']['Jmin']);
|
||||
unset($wg['interface']['Jmax']);
|
||||
unset($wg['interface']['S1']);
|
||||
unset($wg['interface']['S2']);
|
||||
unset($wg['interface']['S3']);
|
||||
unset($wg['interface']['S4']);
|
||||
unset($wg['interface']['H1']);
|
||||
unset($wg['interface']['H2']);
|
||||
unset($wg['interface']['H3']);
|
||||
unset($wg['interface']['H4']);
|
||||
unset($wg['interface']['I1']);
|
||||
if (!empty($amnezia)) {
|
||||
$wg['interface']['Jc'] = $ak['Jc'];
|
||||
$wg['interface']['Jmin'] = $ak['Jmin'];
|
||||
$wg['interface']['Jmax'] = $ak['Jmax'];
|
||||
$wg['interface']['S1'] = $ak['S1'];
|
||||
$wg['interface']['S2'] = $ak['S2'];
|
||||
$wg['interface']['H1'] = $ak['H1'];
|
||||
$wg['interface']['H2'] = $ak['H2'];
|
||||
$wg['interface']['H3'] = $ak['H3'];
|
||||
$wg['interface']['H4'] = $ak['H4'];
|
||||
} else {
|
||||
unset($wg['interface']['Jc']);
|
||||
unset($wg['interface']['Jmin']);
|
||||
unset($wg['interface']['Jmax']);
|
||||
unset($wg['interface']['S1']);
|
||||
unset($wg['interface']['S2']);
|
||||
unset($wg['interface']['H1']);
|
||||
unset($wg['interface']['H2']);
|
||||
unset($wg['interface']['H3']);
|
||||
unset($wg['interface']['H4']);
|
||||
foreach ($ak as $j => $i) {
|
||||
$wg['interface'][$j] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($wg['peers'] as $k => $v) {
|
||||
@@ -2132,7 +2158,7 @@ class Bot
|
||||
unset($wg['peers'][$k]['PresharedKey']);
|
||||
}
|
||||
}
|
||||
$this->restartWG($this->createConfig($wg), 1);
|
||||
$this->restartWG($this->createConfig($wg), !$reset && !$reduce);
|
||||
$this->menu('wg', $page);
|
||||
}
|
||||
|
||||
@@ -3352,12 +3378,6 @@ DNS-over-HTTPS with IP:
|
||||
$am = $c[$this->getInstanceWG(1) . 'amnezia'];
|
||||
$end = $c[$this->getInstanceWG(1) . 'endpoint'];
|
||||
$data = [
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n($am ? 'on' : 'off') . " amnezia",
|
||||
'callback_data' => "/switchAmnezia $page",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n(!$bt ? 'on' : 'off') . " {$this->i18n('torrent')} ",
|
||||
@@ -3395,6 +3415,24 @@ DNS-over-HTTPS with IP:
|
||||
],
|
||||
],
|
||||
];
|
||||
if (!empty($am)) {
|
||||
array_unshift($data, [
|
||||
[
|
||||
'text' => "reset obf-keys",
|
||||
'callback_data' => "/resetAmnezia $page",
|
||||
],
|
||||
[
|
||||
'text' => "reduce to 1",
|
||||
'callback_data' => "/reduceAmnezia $page",
|
||||
],
|
||||
]);
|
||||
}
|
||||
array_unshift($data, [
|
||||
[
|
||||
'text' => $this->i18n($am ? 'on' : 'off') . " amnezia",
|
||||
'callback_data' => "/switchAmnezia $page",
|
||||
],
|
||||
]);
|
||||
if ($clients) {
|
||||
$data = array_merge($data, $clients);
|
||||
}
|
||||
@@ -3802,46 +3840,54 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function getAmneziaShortLink($client)
|
||||
{
|
||||
$domain = $this->getDomain();
|
||||
$dns = explode(',', $client['interface']['DNS']);
|
||||
$c = json_encode([
|
||||
$domain = $this->getDomain();
|
||||
$pac = $this->getPacConf();
|
||||
$dnsRaw = $client['interface']['DNS'] ?: $pac[$this->getInstanceWG(1) . 'dns'] ?: $this->dns;
|
||||
$dns = array_map('trim', explode(',', $dnsRaw));
|
||||
$wgPort = (int) getenv($this->getInstanceWG() == 'wg1' ? 'WG1PORT' : 'WGPORT');
|
||||
$amneziaKeys = $this->amneziaKeys();
|
||||
$protoVer = array_key_exists('I1', $amneziaKeys) ? "2" : "1";
|
||||
$containerName = $protoVer === "2" ? "amnezia-awg2" : "amnezia-awg";
|
||||
$c = [
|
||||
"containers" => [
|
||||
[
|
||||
"awg" => [
|
||||
"isThirdPartyConfig" => True,
|
||||
"last_config" => json_encode([
|
||||
"H1" => "{$client['interface']['H1']}",
|
||||
"H2" => "{$client['interface']['H2']}",
|
||||
"H3" => "{$client['interface']['H3']}",
|
||||
"H4" => "{$client['interface']['H4']}",
|
||||
"Jc" => "{$client['interface']['Jc']}",
|
||||
"Jmax" => "{$client['interface']['Jmax']}",
|
||||
"Jmin" => "{$client['interface']['Jmin']}",
|
||||
"S1" => "{$client['interface']['S1']}",
|
||||
"S2" => "{$client['interface']['S2']}",
|
||||
"client_ip" => explode('/', $client['interface']['Address'])[0],
|
||||
"client_priv_key" => $client['interface']['PrivateKey'],
|
||||
"client_pub_key" => "0",
|
||||
"config" => $this->createConfig($client),
|
||||
"hostName" => $domain,
|
||||
"port" => (int) getenv($this->getInstanceWG() == 'wg1' ? 'WG1PORT' : 'WGPORT'),
|
||||
"psk_key" => $client['peers'][0]['PresharedKey'],
|
||||
"server_pub_key" => $client['peers'][0]['PublicKey']
|
||||
]),
|
||||
"port" => (int) getenv('WG1PORT'),
|
||||
"transport_proto" => "udp"
|
||||
"isThirdPartyConfig" => true,
|
||||
"last_config" => json_encode(array_merge(array_map('strval', $amneziaKeys), [
|
||||
"protocol_version" => $protoVer,
|
||||
"client_ip" => $client['interface']['Address'],
|
||||
"client_priv_key" => $client['interface']['PrivateKey'],
|
||||
"client_pub_key" => "0",
|
||||
"config" => $this->createConfig($client),
|
||||
"hostName" => $domain,
|
||||
"port" => $wgPort,
|
||||
"psk_key" => $client['peers'][0]['PresharedKey'],
|
||||
"server_pub_key" => $client['peers'][0]['PublicKey'],
|
||||
"allowed_ips" => array_map('trim', explode(',', $client['peers'][0]['AllowedIPs'])),
|
||||
"persistent_keep_alive" => "25"
|
||||
])),
|
||||
"port" => $wgPort,
|
||||
"transport_proto" => "udp",
|
||||
"protocol_version" => $protoVer
|
||||
],
|
||||
"container" => "amnezia-awg"
|
||||
"container" => $containerName
|
||||
]
|
||||
],
|
||||
"defaultContainer" => "amnezia-awg",
|
||||
"description" => $client['interface']['## name'],
|
||||
"dns1" => $dns[0],
|
||||
"dns2" => $dns[1] ?: '',
|
||||
"hostName" => $domain
|
||||
]);
|
||||
exec("echo '$c' | python amnezia.py", $o);
|
||||
return $o[0];
|
||||
"defaultContainer" => $containerName,
|
||||
"description" => $client['interface']['## name'],
|
||||
"dns1" => $dns[0] ?? '',
|
||||
"dns2" => $dns[1] ?? '',
|
||||
"hostName" => $domain,
|
||||
"isThirdPartyConfig" => true
|
||||
];
|
||||
$json = json_encode($c);
|
||||
$proc = proc_open('python amnezia.py', [0 => ['pipe', 'r'], 1 => ['pipe', 'w']], $pipes);
|
||||
fwrite($pipes[0], $json);
|
||||
fclose($pipes[0]);
|
||||
$result = trim(stream_get_contents($pipes[1]));
|
||||
fclose($pipes[1]);
|
||||
proc_close($proc);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getClient($client, $page)
|
||||
@@ -3849,7 +3895,7 @@ DNS-over-HTTPS with IP:
|
||||
$clients = $this->readClients();
|
||||
if ($clients) {
|
||||
$name = $this->getName($clients[$client]['interface']);
|
||||
$conf = $this->createConfig($clients[$client]);
|
||||
$conf = htmlspecialchars($this->createConfig($clients[$client]));
|
||||
if ($this->getWGType() == 'awg') {
|
||||
$sl = $this->getAmneziaShortLink($clients[$client]);
|
||||
}
|
||||
@@ -4696,11 +4742,25 @@ DNS-over-HTTPS with IP:
|
||||
$this->sendFile($this->input['from'], curl_file_create('/config/dnstt/server.pub'));
|
||||
}
|
||||
|
||||
public function dnstt()
|
||||
public function showdnstt()
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$c['showdnstt'] = empty($c['showdnstt']);
|
||||
$this->setPacConf($c);
|
||||
$this->dnstt(1);
|
||||
}
|
||||
|
||||
public function dnstt($update = false)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$pubkey = file_get_contents('/config/dnstt/server.pub');
|
||||
$text[] = "dnstt";
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('show in menu ') . $this->i18n($c['showdnstt'] ? 'on' : 'off'),
|
||||
'callback_data' => "/showdnstt",
|
||||
],
|
||||
];
|
||||
if (!empty($c['dnsttDomain']) && !empty($c['dnsttPassword'])) {
|
||||
$text[] = "<pre>set the NS record for {$c['dnsttDomain']}: tns.{$c['domain']}\nset A record for tns.{$c['domain']}: {$this->ip}</pre>";
|
||||
$text[] = "account: <code>vpnbot:{$c['dnsttPassword']}</code>";
|
||||
@@ -4734,12 +4794,21 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/menu",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text),
|
||||
$data ?: false,
|
||||
);
|
||||
if ($update) {
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text),
|
||||
$data ?: false,
|
||||
);
|
||||
} else {
|
||||
$this->send(
|
||||
$this->input['chat'],
|
||||
implode("\n", $text),
|
||||
$this->input['message_id'],
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function menu($type = false, $arg = false, $return = false)
|
||||
@@ -4842,86 +4911,94 @@ DNS-over-HTTPS with IP:
|
||||
$menu = [
|
||||
'main' => [
|
||||
'text' => implode("\n", $main ?: []),
|
||||
'data' => [
|
||||
'data' => array_merge(
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
|
||||
'callback_data' => "/changeWG 0",
|
||||
[
|
||||
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
|
||||
'callback_data' => "/changeWG 0",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
|
||||
'callback_data' => "/changeWG 1",
|
||||
],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
|
||||
'callback_data' => "/changeWG 1",
|
||||
[
|
||||
'text' => $this->i18n('xray'),
|
||||
'callback_data' => "/xray",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('naive'),
|
||||
'callback_data' => "/menu naive",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('ocserv'),
|
||||
'callback_data' => "/menu oc",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('mtproto'),
|
||||
'callback_data' => "/mtproto",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('ad_title'),
|
||||
'callback_data' => "/menu adguard",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('warp'),
|
||||
'callback_data' => "/warp",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('sh_title'),
|
||||
'callback_data' => "/menu ss",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('pac'),
|
||||
'callback_data' => "/pacMenu 0",
|
||||
],
|
||||
],
|
||||
],
|
||||
[array_merge(
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('Hysteria'),
|
||||
'callback_data' => "/menu hy",
|
||||
],
|
||||
],
|
||||
$conf['showdnstt'] ? [
|
||||
[
|
||||
'text' => $this->i18n('DNSTT'),
|
||||
'callback_data' => "/dnstt",
|
||||
],
|
||||
] : [],
|
||||
)],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('xray'),
|
||||
'callback_data' => "/xray",
|
||||
[
|
||||
'text' => $this->i18n('config'),
|
||||
'callback_data' => "/menu config",
|
||||
],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('naive'),
|
||||
'callback_data' => "/menu naive",
|
||||
[
|
||||
'text' => $this->i18n('chat'),
|
||||
'url' => base64_decode('aHR0cHM6Ly90Lm1lLys0RzMtUTRkX3ZGRXhPRGN5'),
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('donate'),
|
||||
'web_app' => [
|
||||
'url' => "https://$domain/webapp$hash/donate.html",
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('ocserv'),
|
||||
'callback_data' => "/menu oc",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('mtproto'),
|
||||
'callback_data' => "/mtproto",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('ad_title'),
|
||||
'callback_data' => "/menu adguard",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('warp'),
|
||||
'callback_data' => "/warp",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('sh_title'),
|
||||
'callback_data' => "/menu ss",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('pac'),
|
||||
'callback_data' => "/pacMenu 0",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('Hysteria'),
|
||||
'callback_data' => "/menu hy",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('DNSTT'),
|
||||
'callback_data' => "/dnstt",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('config'),
|
||||
'callback_data' => "/menu config",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('chat'),
|
||||
'url' => base64_decode('aHR0cHM6Ly90Lm1lLys0RzMtUTRkX3ZGRXhPRGN5'),
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('donate'),
|
||||
'web_app' => [
|
||||
'url' => "https://$domain/webapp$hash/donate.html",
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
)
|
||||
],
|
||||
'wg' => $type == 'wg' ? $this->statusWg($arg) : false,
|
||||
'client' => $type == 'client' ? $this->getClient(...explode('_', $arg)) : false,
|
||||
@@ -8909,7 +8986,7 @@ DNS-over-HTTPS with IP:
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
implode("\n", ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
@@ -9360,16 +9437,34 @@ DNS-over-HTTPS with IP:
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
if (empty($c[$this->getInstanceWG(1) . 'amnezia_keys'])) {
|
||||
// S1 and S2: 0–64 bytes; constraint: S1 + 56 ≠ S2
|
||||
$s1 = random_int(15, 64);
|
||||
do {
|
||||
$s2 = random_int(15, 64);
|
||||
} while ($s1 + 56 === $s2);
|
||||
|
||||
// H1–H4: distinct 32-bit values (must not overlap)
|
||||
$h = [];
|
||||
while (count($h) < 4) {
|
||||
$v = random_int(1, 4_294_967_295);
|
||||
if (!in_array($v, $h)) {
|
||||
$h[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$c[$this->getInstanceWG(1) . 'amnezia_keys'] = [
|
||||
'Jc' => rand(3, 10),
|
||||
'Jmin' => 50,
|
||||
'Jc' => random_int(3, 10),
|
||||
'Jmin' => 64,
|
||||
'Jmax' => 1000,
|
||||
'S1' => rand(15, 150),
|
||||
'S2' => rand(15, 150),
|
||||
'H1' => rand(1, 2_147_483_647),
|
||||
'H2' => rand(1, 2_147_483_647),
|
||||
'H3' => rand(1, 2_147_483_647),
|
||||
'H4' => rand(1, 2_147_483_647),
|
||||
'S1' => $s1,
|
||||
'S2' => $s2,
|
||||
'S3' => random_int(0, 64),
|
||||
'S4' => random_int(0, 32),
|
||||
'H1' => $h[0],
|
||||
'H2' => $h[1],
|
||||
'H3' => $h[2],
|
||||
'H4' => $h[3],
|
||||
'I1' => '<b 0xc000000001><r 100>',
|
||||
];
|
||||
$this->setPacConf($c);
|
||||
}
|
||||
@@ -9486,12 +9581,8 @@ DNS-over-HTTPS with IP:
|
||||
public function restartWG($conf_str, $switch = false)
|
||||
{
|
||||
$this->ssh("echo '$conf_str' > /etc/wireguard/wg0.conf", $this->getInstanceWG());
|
||||
if (!empty($switch)) {
|
||||
$this->ssh("{$this->getWGType(1)}-quick down wg0", $this->getInstanceWG());
|
||||
$this->ssh("{$this->getWGType()}-quick up wg0", $this->getInstanceWG());
|
||||
} else {
|
||||
$this->ssh("{$this->getWGType()} syncconf wg0 <({$this->getWGType()}-quick strip wg0)", $this->getInstanceWG());
|
||||
}
|
||||
$this->ssh("{$this->getWGType((int) $switch)}-quick down wg0", $this->getInstanceWG());
|
||||
$this->ssh("{$this->getWGType()}-quick up wg0", $this->getInstanceWG());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -99,7 +99,7 @@
|
||||
"list": "~block~",
|
||||
"action": "REJECT",
|
||||
"interval": 60,
|
||||
"behavior": "domain",
|
||||
"behavior": "classical",
|
||||
"name": "block"
|
||||
},
|
||||
{
|
||||
@@ -131,7 +131,7 @@
|
||||
"list": "~pac~",
|
||||
"action": "PROXY",
|
||||
"interval": 60,
|
||||
"behavior": "domain",
|
||||
"behavior": "classical",
|
||||
"name": "pac"
|
||||
},
|
||||
{
|
||||
@@ -139,7 +139,7 @@
|
||||
"list": "~subnet~",
|
||||
"action": "PROXY",
|
||||
"interval": 60,
|
||||
"behavior": "ipcidr",
|
||||
"behavior": "classical",
|
||||
"name": "subnet"
|
||||
},
|
||||
{
|
||||
|
||||
+2
-2
@@ -214,7 +214,7 @@ services:
|
||||
- dnstt
|
||||
- hy
|
||||
wg:
|
||||
image: mercurykd/vpnbot-wg:1.1
|
||||
image: mercurykd/vpnbot-wg:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/wireguard.dockerfile
|
||||
args:
|
||||
@@ -252,7 +252,7 @@ services:
|
||||
ipv4_address: 10.10.0.4
|
||||
logging: *default-logging
|
||||
wg1:
|
||||
image: mercurykd/vpnbot-wg:1.1
|
||||
image: mercurykd/vpnbot-wg:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/wireguard.dockerfile
|
||||
args:
|
||||
|
||||
Reference in New Issue
Block a user