@@ -81,7 +81,8 @@ type Peer struct {
8181 // Core WireGuard Settings
8282 PublicKey string `gorm:"primaryKey" form:"pubkey" binding:"required,base64"` // the public key of the peer itself
8383 PresharedKey string `form:"presharedkey" binding:"omitempty,base64"`
84- AllowedIPsStr string `form:"allowedip" binding:"cidrlist"` // a comma separated list of IPs that are used in the client config file
84+ AllowedIPsStr string `form:"allowedip" binding:"cidrlist"` // a comma separated list of IPs that are used in the client config file
85+ AllowedIPsSrvStr string `form:"allowedipSrv" binding:"cidrlist"` // a comma separated list of IPs that are used in the server config file
8586 Endpoint string `form:"endpoint" binding:"omitempty,hostname_port"`
8687 PersistentKeepalive int `form:"keepalive" binding:"gte=0"`
8788
@@ -123,6 +124,10 @@ func (p Peer) GetAllowedIPs() []string {
123124 return common .ParseStringList (p .AllowedIPsStr )
124125}
125126
127+ func (p Peer ) GetAllowedIPsSrv () []string {
128+ return common .ParseStringList (p .AllowedIPsSrvStr )
129+ }
130+
126131func (p Peer ) GetConfig (dev * Device ) wgtypes.PeerConfig {
127132 publicKey , _ := wgtypes .ParseKey (p .PublicKey )
128133
@@ -153,6 +158,7 @@ func (p Peer) GetConfig(dev *Device) wgtypes.PeerConfig {
153158 peerAllowedIPs = p .GetAllowedIPs ()
154159 case DeviceTypeServer :
155160 peerAllowedIPs = p .GetIPAddresses ()
161+ peerAllowedIPs = append (peerAllowedIPs , p .GetAllowedIPsSrv ()... )
156162 }
157163 for _ , ip := range peerAllowedIPs {
158164 _ , ipNet , err := net .ParseCIDR (ip )
0 commit comments