+
{{.message}}
{{end}}
diff --git a/internal/server/configuration.go b/internal/server/configuration.go
index 5f2f3a7..2727967 100644
--- a/internal/server/configuration.go
+++ b/internal/server/configuration.go
@@ -106,7 +106,7 @@ func NewConfig() *Config {
cfg.LDAP.DisabledAttribute = "userAccountControl"
cfg.LDAP.AdminLdapGroup = "CN=WireGuardAdmins,OU=_O_IT,DC=COMPANY,DC=LOCAL"
- cfg.WG.DeviceNames = []string{"wg0", "wg1"}
+ cfg.WG.DeviceNames = []string{"wg0"}
cfg.WG.DefaultDeviceName = "wg0"
cfg.WG.ConfigDirectoryPath = "/etc/wireguard"
cfg.WG.ManageIPAddresses = true
diff --git a/internal/wireguard/peermanager.go b/internal/wireguard/peermanager.go
index cf1abb0..beee18d 100644
--- a/internal/wireguard/peermanager.go
+++ b/internal/wireguard/peermanager.go
@@ -574,39 +574,7 @@ func (m *PeerManager) GetFilteredAndSortedPeers(device, sortKey, sortDirection,
}
}
- sort.Slice(filteredPeers, func(i, j int) bool {
- var sortValueLeft string
- var sortValueRight string
-
- switch sortKey {
- case "id":
- sortValueLeft = filteredPeers[i].Identifier
- sortValueRight = filteredPeers[j].Identifier
- case "pubKey":
- sortValueLeft = filteredPeers[i].PublicKey
- sortValueRight = filteredPeers[j].PublicKey
- case "mail":
- sortValueLeft = filteredPeers[i].Email
- sortValueRight = filteredPeers[j].Email
- case "ip":
- sortValueLeft = filteredPeers[i].IPsStr
- sortValueRight = filteredPeers[j].IPsStr
- case "handshake":
- if filteredPeers[i].Peer == nil {
- return false
- } else if filteredPeers[j].Peer == nil {
- return true
- }
- sortValueLeft = filteredPeers[i].Peer.LastHandshakeTime.Format(time.RFC3339)
- sortValueRight = filteredPeers[j].Peer.LastHandshakeTime.Format(time.RFC3339)
- }
-
- if sortDirection == "asc" {
- return sortValueLeft < sortValueRight
- } else {
- return sortValueLeft > sortValueRight
- }
- })
+ sortPeers(sortKey, sortDirection, filteredPeers)
return filteredPeers
}
@@ -619,6 +587,12 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
m.populatePeerData(&peers[i])
}
+ sortPeers(sortKey, sortDirection, peers)
+
+ return peers
+}
+
+func sortPeers(sortKey string, sortDirection string, peers []Peer) {
sort.Slice(peers, func(i, j int) bool {
var sortValueLeft string
var sortValueRight string
@@ -636,6 +610,9 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
case "ip":
sortValueLeft = peers[i].IPsStr
sortValueRight = peers[j].IPsStr
+ case "endpoint":
+ sortValueLeft = peers[i].Endpoint
+ sortValueRight = peers[j].Endpoint
case "handshake":
if peers[i].Peer == nil {
return true
@@ -652,8 +629,6 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
return sortValueLeft > sortValueRight
}
})
-
- return peers
}
func (m *PeerManager) GetDevice(device string) Device {
diff --git a/internal/wireguard/tpl/peer.tpl b/internal/wireguard/tpl/peer.tpl
index 7f94732..d6a85e4 100644
--- a/internal/wireguard/tpl/peer.tpl
+++ b/internal/wireguard/tpl/peer.tpl
@@ -17,7 +17,7 @@ MTU = {{.Peer.Mtu}}
{{- end}}
[Peer]
-PublicKey = {{ .Peer.PublicKey }}
+PublicKey = {{ .Interface.PublicKey }}
Endpoint = {{ .Peer.Endpoint }}
{{- if .Peer.AllowedIPsStr}}
AllowedIPs = {{ .Peer.AllowedIPsStr }}