short link for amnezia
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
import sys
|
||||||
|
from PyQt5.QtCore import *
|
||||||
|
|
||||||
|
|
||||||
|
def enc(s):
|
||||||
|
ba = qCompress(QByteArray(s.encode()))
|
||||||
|
ba = ba.toBase64(QByteArray.Base64Option.Base64UrlEncoding | QByteArray.Base64Option.OmitTrailingEquals)
|
||||||
|
print('vpn://' + str(ba, 'utf-8'))
|
||||||
|
|
||||||
|
s = ''
|
||||||
|
for line in sys.stdin:
|
||||||
|
s += line
|
||||||
|
s = s.strip()
|
||||||
|
enc(s)
|
||||||
+47
-1
@@ -2536,14 +2536,60 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->menu('client', "{$k}_$page");
|
$this->menu('client', "{$k}_$page");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAmneziaShortLink($client)
|
||||||
|
{
|
||||||
|
$dns = explode(',', $client['interface']['DNS']);
|
||||||
|
$c = json_encode([
|
||||||
|
"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" => $this->ip,
|
||||||
|
"port" => (int) getenv('WG1PORT'),
|
||||||
|
"psk_key" => $client['peers'][0]['PresharedKey'],
|
||||||
|
"server_pub_key" => $client['peers'][0]['PublicKey']
|
||||||
|
]),
|
||||||
|
"port" => (int) getenv('WG1PORT'),
|
||||||
|
"transport_proto" => "udp"
|
||||||
|
],
|
||||||
|
"container" => "amnezia-awg"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"defaultContainer" => "amnezia-awg",
|
||||||
|
"description" => $client['interface']['## name'],
|
||||||
|
"dns1" => $dns[0],
|
||||||
|
"dns2" => $dns[1] ?: '',
|
||||||
|
"hostName" => $this->ip
|
||||||
|
]);
|
||||||
|
exec("echo '$c' | python amnezia.py", $o);
|
||||||
|
return $o[0];
|
||||||
|
}
|
||||||
|
|
||||||
public function getClient($client, $page)
|
public function getClient($client, $page)
|
||||||
{
|
{
|
||||||
$clients = $this->readClients();
|
$clients = $this->readClients();
|
||||||
if ($clients) {
|
if ($clients) {
|
||||||
$name = $this->getName($clients[$client]['interface']);
|
$name = $this->getName($clients[$client]['interface']);
|
||||||
$conf = $this->createConfig($clients[$client]);
|
$conf = $this->createConfig($clients[$client]);
|
||||||
|
if ($this->getInstanceWG(1)) {
|
||||||
|
$sl = $this->getAmneziaShortLink($clients[$client]);
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'text' => "<code>$conf</code>\n\n<b>$name</b> ({$this->getTitleWG()})",
|
'text' => "<pre>$conf</pre>\n\n<code>$sl</code>\n\n<b>$name</b> ({$this->getTitleWG()})",
|
||||||
'data' => [
|
'data' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ RUN apk add --no-cache --update php81 \
|
|||||||
openssh \
|
openssh \
|
||||||
openssl \
|
openssl \
|
||||||
curl \
|
curl \
|
||||||
|
py3-qt5 \
|
||||||
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
|
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||||
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||||
&& mv linux-amd64/dnslookup /usr/bin \
|
&& mv linux-amd64/dnslookup /usr/bin \
|
||||||
|
|||||||
Reference in New Issue
Block a user