parent
971fdbd0f7
commit
e7d33476ae
3 changed files with 29 additions and 12 deletions
|
|
@ -52,6 +52,14 @@
|
||||||
<input type="text" id="dns" placeholder="e.g. 8.8.8.8, 1.1.1.1">
|
<input type="text" id="dns" placeholder="e.g. 8.8.8.8, 1.1.1.1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="allowedIPs">Client AllowedIPs:</label>
|
||||||
|
<input type="text" id="allowedIPs" value="0.0.0.0/0, ::/0" placeholder="e.g. 0.0.0.0/0, ::/0 or 10.0.0.0/24" required>
|
||||||
|
<small style="color: #666; display: block; margin-top: 5px;">0.0.0.0/0 routes all traffic through VPN. Use specific subnets for split-tunnel.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="seed-section">
|
<div class="seed-section">
|
||||||
<label>Cryptographic Seed (for reproducible key generation):</label>
|
<label>Cryptographic Seed (for reproducible key generation):</label>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,13 @@
|
||||||
<input type="text" id="dns" placeholder="e.g. 8.8.8.8, 1.1.1.1">
|
<input type="text" id="dns" placeholder="e.g. 8.8.8.8, 1.1.1.1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="allowedIPs">Peer AllowedIPs:</label>
|
||||||
|
<input type="text" id="allowedIPs" value="10.0.0.0/24" placeholder="e.g. 10.0.0.0/24 or 0.0.0.0/0" required>
|
||||||
|
<small style="color: #666; display: block; margin-top: 5px;">Define which IPs each peer can reach through others. Use network CIDR for mesh-only traffic.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-section">
|
<div class="form-section">
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,7 @@ async function generateConfigs() {
|
||||||
const serverEndpoint = document.getElementById('serverEndpoint').value;
|
const serverEndpoint = document.getElementById('serverEndpoint').value;
|
||||||
const clientCount = parseInt(document.getElementById('clientCount').value);
|
const clientCount = parseInt(document.getElementById('clientCount').value);
|
||||||
const dns = document.getElementById('dns').value;
|
const dns = document.getElementById('dns').value;
|
||||||
|
const allowedIPs = document.getElementById('allowedIPs').value;
|
||||||
|
|
||||||
// Validate inputs
|
// Validate inputs
|
||||||
if (!validateInputs(serverNetwork, serverEndpoint, clientCount)) {
|
if (!validateInputs(serverNetwork, serverEndpoint, clientCount)) {
|
||||||
|
|
@ -356,10 +357,10 @@ async function generateConfigs() {
|
||||||
`${networkParts[0]}.${networkParts[1]}.${networkParts[2]}.${networkParts[3] + 1}`,
|
`${networkParts[0]}.${networkParts[1]}.${networkParts[2]}.${networkParts[3] + 1}`,
|
||||||
cidr, clients);
|
cidr, clients);
|
||||||
|
|
||||||
const clientConfigs = clients.map(client =>
|
const clientConfigs = clients.map(client =>
|
||||||
generateClientConfig(client, serverPublicKey, serverEndpoint, serverPort,
|
generateClientConfig(client, serverPublicKey, serverEndpoint, serverPort,
|
||||||
`${networkParts[0]}.${networkParts[1]}.${networkParts[2]}.${networkParts[3] + 1}`,
|
`${networkParts[0]}.${networkParts[1]}.${networkParts[2]}.${networkParts[3] + 1}`,
|
||||||
cidr, dns)
|
cidr, dns, allowedIPs)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store configurations
|
// Store configurations
|
||||||
|
|
@ -439,28 +440,28 @@ AllowedIPs = ${client.ip}/32
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateClientConfig(client, serverPublicKey, serverEndpoint, serverPort, serverIP, cidr, dns) {
|
function generateClientConfig(client, serverPublicKey, serverEndpoint, serverPort, serverIP, cidr, dns, allowedIPs) {
|
||||||
let config = `# ${client.name} Configuration
|
let config = `# ${client.name} Configuration
|
||||||
[Interface]
|
[Interface]
|
||||||
PrivateKey = ${client.privateKey}
|
PrivateKey = ${client.privateKey}
|
||||||
Address = ${client.ip}/${cidr}`;
|
Address = ${client.ip}/${cidr}`;
|
||||||
|
|
||||||
// Only add DNS if it's not empty
|
// Only add DNS if it's not empty
|
||||||
if (dns && dns.trim()) {
|
if (dns && dns.trim()) {
|
||||||
config += `
|
config += `
|
||||||
DNS = ${dns.trim()}`;
|
DNS = ${dns.trim()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
config += `
|
config += `
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = ${serverPublicKey}
|
PublicKey = ${serverPublicKey}
|
||||||
PresharedKey = ${client.presharedKey}
|
PresharedKey = ${client.presharedKey}
|
||||||
AllowedIPs = 0.0.0.0/0, ::/0
|
AllowedIPs = ${allowedIPs}
|
||||||
Endpoint = ${serverEndpoint}:${serverPort}
|
Endpoint = ${serverEndpoint}:${serverPort}
|
||||||
PersistentKeepalive = 25
|
PersistentKeepalive = 25
|
||||||
`;
|
`;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -643,6 +644,7 @@ async function generateMeshConfigs() {
|
||||||
try {
|
try {
|
||||||
const networkCIDR = document.getElementById('networkCIDR').value;
|
const networkCIDR = document.getElementById('networkCIDR').value;
|
||||||
const dns = document.getElementById('dns').value;
|
const dns = document.getElementById('dns').value;
|
||||||
|
const allowedIPs = document.getElementById('allowedIPs').value;
|
||||||
const peerCount = parseInt(document.getElementById('peerCount').value);
|
const peerCount = parseInt(document.getElementById('peerCount').value);
|
||||||
|
|
||||||
// Validate inputs
|
// Validate inputs
|
||||||
|
|
@ -728,7 +730,7 @@ async function generateMeshConfigs() {
|
||||||
// Generate configurations for each peer
|
// Generate configurations for each peer
|
||||||
const meshConfigs = peers.map((peer, index) => ({
|
const meshConfigs = peers.map((peer, index) => ({
|
||||||
name: peer.name,
|
name: peer.name,
|
||||||
config: generateMeshPeerConfig(peer, peers, index, cidr, dns, presharedKeys)
|
config: generateMeshPeerConfig(peer, peers, index, cidr, dns, presharedKeys, allowedIPs)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Store configurations
|
// Store configurations
|
||||||
|
|
@ -769,7 +771,7 @@ function validateMeshInputs(networkCIDR, peerCount) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateMeshPeerConfig(currentPeer, allPeers, currentIndex, cidr, dns, presharedKeys) {
|
function generateMeshPeerConfig(currentPeer, allPeers, currentIndex, cidr, dns, presharedKeys, allowedIPs) {
|
||||||
let config = `# ${currentPeer.name} Configuration (Mesh Network)
|
let config = `# ${currentPeer.name} Configuration (Mesh Network)
|
||||||
[Interface]
|
[Interface]
|
||||||
PrivateKey = ${currentPeer.privateKey}
|
PrivateKey = ${currentPeer.privateKey}
|
||||||
|
|
@ -798,7 +800,7 @@ ListenPort = ${currentPeer.port}
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = ${peer.publicKey}
|
PublicKey = ${peer.publicKey}
|
||||||
PresharedKey = ${presharedKey}
|
PresharedKey = ${presharedKey}
|
||||||
AllowedIPs = ${peer.ip}/32`;
|
AllowedIPs = ${allowedIPs}`;
|
||||||
|
|
||||||
// Add endpoint if available
|
// Add endpoint if available
|
||||||
if (peer.endpoint) {
|
if (peer.endpoint) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue