2023-12-08 10:48:21 +01:00
|
|
|
package manager
|
|
|
|
|
2024-10-02 13:41:00 +02:00
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
|
|
|
"github.com/netbirdio/netbird/route"
|
|
|
|
)
|
|
|
|
|
2023-12-08 10:48:21 +01:00
|
|
|
type RouterPair struct {
|
2024-10-02 13:41:00 +02:00
|
|
|
ID route.ID
|
|
|
|
Source netip.Prefix
|
|
|
|
Destination netip.Prefix
|
2023-12-08 10:48:21 +01:00
|
|
|
Masquerade bool
|
2024-10-02 13:41:00 +02:00
|
|
|
Inverse bool
|
2023-12-08 10:48:21 +01:00
|
|
|
}
|
|
|
|
|
2024-10-02 13:41:00 +02:00
|
|
|
func GetInversePair(pair RouterPair) RouterPair {
|
2023-12-08 10:48:21 +01:00
|
|
|
return RouterPair{
|
|
|
|
ID: pair.ID,
|
|
|
|
// invert Source/Destination
|
|
|
|
Source: pair.Destination,
|
|
|
|
Destination: pair.Source,
|
|
|
|
Masquerade: pair.Masquerade,
|
2024-10-02 13:41:00 +02:00
|
|
|
Inverse: true,
|
2023-12-08 10:48:21 +01:00
|
|
|
}
|
|
|
|
}
|