diff --git a/custom/js/helper.js b/custom/js/helper.js
index 42bc17a..ad7d921 100644
--- a/custom/js/helper.js
+++ b/custom/js/helper.js
@@ -18,6 +18,12 @@ function renderClientList(data) {
allowedIpsHtml += `${obj} `;
})
+ // render client private subnets
+ let privateSubnetsHtml = "";
+ $.each(obj.Client.private_subnets, function(index, obj) {
+ privateSubnetsHtml += `${obj} `;
+ })
+
// render client html content
let html = `
@@ -50,6 +56,8 @@ function renderClientList(data) {
+ allocatedIpsHtml
+ `Allowed IPs`
+ allowedIpsHtml
+ + `Private Subnets`
+ + privateSubnetsHtml
+`
`
diff --git a/model/client.go b/model/client.go
index 2d610a6..3da74f0 100644
--- a/model/client.go
+++ b/model/client.go
@@ -6,17 +6,18 @@ import (
// Client model
type Client struct {
- ID string `json:"id"`
- PrivateKey string `json:"private_key"`
- PublicKey string `json:"public_key"`
- PresharedKey string `json:"preshared_key"`
- Name string `json:"name"`
- Email string `json:"email"`
- AllocatedIPs []string `json:"allocated_ips"`
- AllowedIPs []string `json:"allowed_ips"`
- Enabled bool `json:"enabled"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
+ ID string `json:"id"`
+ PrivateKey string `json:"private_key"`
+ PublicKey string `json:"public_key"`
+ PresharedKey string `json:"preshared_key"`
+ Name string `json:"name"`
+ Email string `json:"email"`
+ AllocatedIPs []string `json:"allocated_ips"`
+ AllowedIPs []string `json:"allowed_ips"`
+ PrivateSubnets []string `json:"private_subnets"`
+ Enabled bool `json:"enabled"`
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
}
// ClientData includes the Client and extra data
diff --git a/templates/base.html b/templates/base.html
index 0e04f31..67f89fb 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -153,6 +153,10 @@
+
+
+
+
@@ -274,13 +278,14 @@
const email = $("#client_email").val();
const allocated_ips = $("#client_allocated_ips").val().split(",");
const allowed_ips = $("#client_allowed_ips").val().split(",");
+ const private_subnets = $("#client_private_subnets").val().split(",");
let enabled = false;
if ($("#enabled").is(':checked')){
enabled = true;
}
- const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips,
+ const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips, "private_subnets": private_subnets,
"enabled": enabled};
$.ajax({
@@ -354,6 +359,18 @@
'placeholderColor': '#666666'
});
+ // PrivateSubnets tag input
+ $("#client_private_subnets").tagsInput({
+ 'width': '100%',
+ 'height': '75%',
+ 'interactive': true,
+ 'defaultText': 'Add More',
+ 'removeWithBackspace': true,
+ 'minChars': 0,
+ 'maxChars': 18,
+ 'placeholderColor': '#666666'
+ });
+
// New client form validation
$(document).ready(function () {
$.validator.setDefaults({
diff --git a/templates/clients.html b/templates/clients.html
index 689d5d2..c095fc5 100644
--- a/templates/clients.html
+++ b/templates/clients.html
@@ -58,6 +58,10 @@ Wireguard Clients
+
+
+
+