Skip to content

Commit

Permalink
cloak public/private keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfly722 committed Sep 14, 2024
1 parent 960042d commit 0b5968b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions cloak-wg-helper/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ var params = {
cloakGateway: '',
cloakEncryptionMethod: '',
cloakNumberOfConnections: '',
cloakServerPrivate: '',
cloakServerPublic: '',
wireguardClientPrivate: '',
wireguardClientPublic: '',
wireguardServerPrivate: '',
wireguardServerPublic: '',
wireguardMTU: ''

}

function fill(){
Expand Down Expand Up @@ -63,7 +64,21 @@ function regenerateWGServer(){
document.getElementById("wireguardServerPublic").value = wgServer.publicKey;
onChange("wireguardServerPrivate",wgServer.privateKey);
onChange("wireguardServerPublic" ,wgServer.publicKey);
}

function updateCloakServer(privateKey){
cloakServer = window.wireguard.generateKeypairForPrivate(privateKey)
document.getElementById("cloakServerPublic").value = cloakServer.publicKey;
onChange("cloakServerPrivate",cloakServer.privateKey);
onChange("cloakServerPublic" ,cloakServer.publicKey);
}

function regenerateCloakServer(){
var cloakServer = window.wireguard.generateKeypair()
document.getElementById("cloakServerPrivate").value = cloakServer.privateKey;
document.getElementById("cloakServerPublic").value = cloakServer.publicKey;
onChange("cloakServerPrivate",cloakServer.privateKey);
onChange("cloakServerPublic" ,cloakServer.publicKey);
}


Expand All @@ -72,6 +87,10 @@ function regenerateWireguard(){
regenerateWGServer();
}

function regenerateCloak(){
regenerateCloakServer();
}


function update(){

Expand All @@ -94,7 +113,7 @@ sudo tee /etc/cloak/cloak-client.json << EOF
"ProxyMethod": "wireguard",
"EncryptionMethod": ":cloakEncryptionMethod",
"UID": "$ck_uid",
"PublicKey": "$ck_publicKey",
"PublicKey": ":cloakServerPublic",
"ServerName": ":fakehost",
"NumConn": :cloakNumberOfConnections,
"KeepAlive": 0,
Expand Down Expand Up @@ -190,7 +209,7 @@ sudo tee /etc/cloak/cloak-server.json << EOF
"$ck_uid"
],
"RedirAddr": ":fakehost",
"PrivateKey": "$ck_privateKey"
"PrivateKey": ":cloakServerPrivate"
}
EOF
</code></pre>
Expand Down Expand Up @@ -265,6 +284,7 @@ sudo wg</code></pre>

window.onload = function() {
regenerateWireguard();
regenerateCloak();
fill();
update();
};
Expand Down
Binary file modified cloak-wg-helper/index.html
Binary file not shown.

0 comments on commit 0b5968b

Please sign in to comment.