generate interface and peer configuration filenames in backend only (#395)

This commit is contained in:
Christoph
2025-04-19 13:12:31 +02:00
parent a60feb7fc9
commit 6681dfa96f
14 changed files with 91 additions and 20 deletions

View File

@@ -84,6 +84,9 @@ type Interface struct {
EnabledPeers int `json:"EnabledPeers" readonly:"true"`
// TotalPeers is the total number of peers for this interface.
TotalPeers int `json:"TotalPeers" readonly:"true"`
// Filename is the name of the config file for this interface.
// This value is read only and is not settable by the user.
Filename string `json:"Filename" example:"wg0.conf" binding:"omitempty,max=21" readonly:"true"`
}
func NewInterface(src *domain.Interface, peers []domain.Peer) *Interface {
@@ -123,6 +126,7 @@ func NewInterface(src *domain.Interface, peers []domain.Peer) *Interface {
EnabledPeers: 0,
TotalPeers: 0,
Filename: src.GetConfigFileName(),
}
if len(peers) > 0 {