You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// IPAddresses are meant to be allocated at program initialization and all stored in the database.
// For example, if wireguardhttps is initialized with the subnet 10.0.0.0/24, an entry will be created in this table for every IP address between 10.0.0.0 and 10.0.0.255.
type IPAddress struct {
gorm.Model
Address string `gorm:"PRIMARY_KEY;UNIQUE"`
}
// Device is a connected Wireguard peer.
// Devices must be assigned an unassigned IP address from the `IPAddress` table
// Each device must have a unique IP address and public key, and we use the UNIQUE SQL constraint to enforce this.
type Device struct {
gorm.Model
IP IPAddress `gorm:"foreignkey:IPAddress;auto_preload"`