2022-01-05 23:05:51 +08:00
|
|
|
package models
|
|
|
|
|
2022-11-04 03:54:48 +08:00
|
|
|
import (
|
2022-12-28 10:33:35 +08:00
|
|
|
proxy_models "github.com/gravitl/netclient/nmproxy/models"
|
2022-11-04 03:54:48 +08:00
|
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
|
|
)
|
2022-01-16 07:16:44 +08:00
|
|
|
|
2022-01-26 11:14:31 +08:00
|
|
|
// PeerUpdate - struct
|
2022-01-05 23:05:51 +08:00
|
|
|
type PeerUpdate struct {
|
2022-12-28 10:33:35 +08:00
|
|
|
Network string `json:"network" bson:"network" yaml:"network"`
|
|
|
|
ServerVersion string `json:"serverversion" bson:"serverversion" yaml:"serverversion"`
|
|
|
|
ServerAddrs []ServerAddr `json:"serveraddrs" bson:"serveraddrs" yaml:"serveraddrs"`
|
|
|
|
Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
|
|
|
DNS string `json:"dns" bson:"dns" yaml:"dns"`
|
|
|
|
PeerIDs PeerMap `json:"peerids" bson:"peerids" yaml:"peerids"`
|
|
|
|
ProxyUpdate proxy_models.ProxyManagerPayload `json:"proxy_update" bson:"proxy_update" yaml:"proxy_update"`
|
2022-01-05 23:05:51 +08:00
|
|
|
}
|
|
|
|
|
2023-01-06 20:48:25 +08:00
|
|
|
// HostPeerUpdate - struct for host peer updates
|
2023-01-04 12:34:17 +08:00
|
|
|
type HostPeerUpdate struct {
|
2023-01-10 01:33:23 +08:00
|
|
|
Host Host `json:"host" bson:"host" yaml:"host"`
|
2023-01-31 16:48:37 +08:00
|
|
|
Server string `json:"server" bson:"server" yaml:"server"`
|
2023-01-04 13:33:13 +08:00
|
|
|
ServerVersion string `json:"serverversion" bson:"serverversion" yaml:"serverversion"`
|
|
|
|
ServerAddrs []ServerAddr `json:"serveraddrs" bson:"serveraddrs" yaml:"serveraddrs"`
|
|
|
|
Network map[string]NetworkInfo `json:"network" bson:"network" yaml:"network"`
|
|
|
|
Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
|
|
|
PeerIDs HostPeerMap `json:"peerids" bson:"peerids" yaml:"peerids"`
|
|
|
|
ProxyUpdate proxy_models.ProxyManagerPayload `json:"proxy_update" bson:"proxy_update" yaml:"proxy_update"`
|
2023-01-31 15:10:23 +08:00
|
|
|
IngressInfo IngressInfo `json:"ingress_info" bson:"ext_peers" yaml:"ext_peers"`
|
2023-01-31 14:21:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type IngressInfo struct {
|
2023-01-31 16:37:22 +08:00
|
|
|
ExtPeers map[string]ExtClientInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
type PeerExtInfo struct {
|
|
|
|
PeerConfig wgtypes.PeerConfig
|
|
|
|
Allow bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type ExtClientInfo struct {
|
|
|
|
ExtPeer wgtypes.PeerConfig
|
|
|
|
Peers map[string]PeerExtInfo
|
2023-01-04 12:34:17 +08:00
|
|
|
}
|
|
|
|
|
2023-01-06 20:48:25 +08:00
|
|
|
// NetworkInfo - struct for network info
|
2023-01-04 12:34:17 +08:00
|
|
|
type NetworkInfo struct {
|
2023-01-04 13:33:13 +08:00
|
|
|
DNS string `json:"dns" bson:"dns" yaml:"dns"`
|
2023-01-04 12:34:17 +08:00
|
|
|
}
|
|
|
|
|
2022-01-26 11:14:31 +08:00
|
|
|
// KeyUpdate - key update struct
|
2022-01-05 23:05:51 +08:00
|
|
|
type KeyUpdate struct {
|
2022-01-26 11:14:31 +08:00
|
|
|
Network string `json:"network" bson:"network"`
|
|
|
|
Interface string `json:"interface" bson:"interface"`
|
2022-01-05 23:05:51 +08:00
|
|
|
}
|