mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
generate interface and peer configuration filenames in backend only (#395)
This commit is contained in:
@@ -47,8 +47,9 @@ type Interface struct {
|
||||
|
||||
// Calculated values
|
||||
|
||||
EnabledPeers int `json:"EnabledPeers"`
|
||||
TotalPeers int `json:"TotalPeers"`
|
||||
EnabledPeers int `json:"EnabledPeers"`
|
||||
TotalPeers int `json:"TotalPeers"`
|
||||
Filename string `json:"Filename"` // the filename of the config file, for example: wg0.conf
|
||||
}
|
||||
|
||||
func NewInterface(src *domain.Interface, peers []domain.Peer) *Interface {
|
||||
@@ -88,6 +89,7 @@ func NewInterface(src *domain.Interface, peers []domain.Peer) *Interface {
|
||||
|
||||
EnabledPeers: 0,
|
||||
TotalPeers: 0,
|
||||
Filename: src.GetConfigFileName(),
|
||||
}
|
||||
|
||||
if len(peers) > 0 {
|
||||
|
@@ -73,6 +73,10 @@ type Peer struct {
|
||||
PostUp ConfigOption[string] `json:"PostUp"` // action that is executed after the device is up
|
||||
PreDown ConfigOption[string] `json:"PreDown"` // action that is executed before the device is down
|
||||
PostDown ConfigOption[string] `json:"PostDown"` // action that is executed after the device is down
|
||||
|
||||
// Calculated values
|
||||
|
||||
Filename string `json:"Filename"` // the filename of the config file, for example: wg_peer_x.conf
|
||||
}
|
||||
|
||||
func NewPeer(src *domain.Peer) *Peer {
|
||||
@@ -105,6 +109,7 @@ func NewPeer(src *domain.Peer) *Peer {
|
||||
PostUp: ConfigOptionFromDomain(src.Interface.PostUp),
|
||||
PreDown: ConfigOptionFromDomain(src.Interface.PreDown),
|
||||
PostDown: ConfigOptionFromDomain(src.Interface.PostDown),
|
||||
Filename: src.GetConfigFileName(),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user