mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
calculate WG peer connection status
This commit is contained in:
1 parent
5094149406
commit
7b98ed34df
3 files changed
+181
-37
No files matched your search
@@ -84,3 +84,15 @@ func (c Config) toDeviceConfig() (wgtypes.Config, error) {
|
||||
Peers: wgPeerConfigs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *PeerConfig) prefixes() ([]netip.Prefix, error) {
|
||||
managePrefix, err := addrToSingleIPPrefix(p.ManagementIP)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse management IP: %w", err)
|
||||
}
|
||||
prefixes := []netip.Prefix{managePrefix}
|
||||
if p.Subnet != nil {
|
||||
prefixes = append(prefixes, *p.Subnet)
|
||||
}
|
||||
return prefixes, nil
|
||||
}
|
||||
Reference in new issue
Block a user