mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
calculate WG peer connection status
This commit is contained in:
@@ -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