mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
Implement EditableKeys parameter (#417)
Signed-off-by: Vladimir DOMBROVSKI <vladimir.dombrovski@bso.co>
This commit is contained in:
committed by
GitHub
parent
fbcb22198c
commit
62f3c8d4a1
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"github.com/h44z/wg-portal/internal/config"
|
||||
|
||||
"github.com/h44z/wg-portal/internal"
|
||||
)
|
||||
@@ -129,16 +130,18 @@ func (p *Peer) GenerateDisplayName(prefix string) {
|
||||
}
|
||||
|
||||
// OverwriteUserEditableFields overwrites the user editable fields of the peer with the values from the userPeer
|
||||
func (p *Peer) OverwriteUserEditableFields(userPeer *Peer) {
|
||||
func (p *Peer) OverwriteUserEditableFields(userPeer *Peer, cfg *config.Config) {
|
||||
p.DisplayName = userPeer.DisplayName
|
||||
p.Interface.PublicKey = userPeer.Interface.PublicKey
|
||||
p.Interface.PrivateKey = userPeer.Interface.PrivateKey
|
||||
if cfg.Core.EditableKeys {
|
||||
p.Interface.PublicKey = userPeer.Interface.PublicKey
|
||||
p.Interface.PrivateKey = userPeer.Interface.PrivateKey
|
||||
p.PresharedKey = userPeer.PresharedKey
|
||||
}
|
||||
p.Interface.Mtu = userPeer.Interface.Mtu
|
||||
p.PersistentKeepalive = userPeer.PersistentKeepalive
|
||||
p.ExpiresAt = userPeer.ExpiresAt
|
||||
p.Disabled = userPeer.Disabled
|
||||
p.DisabledReason = userPeer.DisabledReason
|
||||
p.PresharedKey = userPeer.PresharedKey
|
||||
}
|
||||
|
||||
type PeerInterfaceConfig struct {
|
||||
|
Reference in New Issue
Block a user