mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
Add Wireguard Config
This commit is contained in:
parent
5bf336ff91
commit
a67911df67
5 changed files with 32 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"nfsense.net/nfsense/internal/definitions/network"
|
||||
"nfsense.net/nfsense/internal/definitions/object"
|
||||
"nfsense.net/nfsense/internal/definitions/service"
|
||||
"nfsense.net/nfsense/internal/definitions/vpn"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
@ -18,6 +19,7 @@ type Config struct {
|
|||
Object object.Object `json:"object" validate:"required,dive"`
|
||||
Network network.Network `json:"network" validate:"required,dive"`
|
||||
Service service.Service `json:"service" validate:"required,dive"`
|
||||
VPN vpn.VPN `json:"vpn" validate:"required,dive"`
|
||||
}
|
||||
|
||||
// Clone TODO find a better way to deep copy
|
||||
|
|
9
internal/definitions/vpn/interface.go
Normal file
9
internal/definitions/vpn/interface.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package vpn
|
||||
|
||||
type WireguardInterface struct {
|
||||
PublicKey string `json:"public_key"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
ListenPort uint64 `json:"listen_port"`
|
||||
Peers []string `json:"peers"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
10
internal/definitions/vpn/peer.go
Normal file
10
internal/definitions/vpn/peer.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package vpn
|
||||
|
||||
type WireguardPeer struct {
|
||||
PublicKey string `json:"public_key"`
|
||||
PresharedKey *string `json:"preshared_key,omitempty"`
|
||||
AllowedIPs []string `json:"allowed_ips"`
|
||||
Endpoint *string `json:"endpoint,omitempty"`
|
||||
PersistentKeepalive *uint64 `json:"persistent_keepalive,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
5
internal/definitions/vpn/vpn.go
Normal file
5
internal/definitions/vpn/vpn.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package vpn
|
||||
|
||||
type VPN struct {
|
||||
Wireguard Wireguard `json:"wireguard" validate:"required,dive"`
|
||||
}
|
6
internal/definitions/vpn/wireguard.go
Normal file
6
internal/definitions/vpn/wireguard.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package vpn
|
||||
|
||||
type Wireguard struct {
|
||||
Interfaces map[string]WireguardInterface `json:"interfaces" validate:"required,dive"`
|
||||
Peers map[string]WireguardPeer `json:"peers" validate:"required,dive"`
|
||||
}
|
Loading…
Add table
Reference in a new issue