mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 00:06:38 +00:00
27 lines
492 B
Go
27 lines
492 B
Go
package manager
|
|
|
|
import (
|
|
"fmt"
|
|
"net/netip"
|
|
)
|
|
|
|
// ForwardRule todo figure out better place to this to avoid circular imports
|
|
type ForwardRule struct {
|
|
Protocol Protocol
|
|
DestinationPort Port
|
|
TranslatedAddress netip.Addr
|
|
TranslatedPort Port
|
|
}
|
|
|
|
func (r ForwardRule) GetRuleID() string {
|
|
return fmt.Sprintf("%s-%s-%s-%s",
|
|
r.Protocol,
|
|
r.DestinationPort,
|
|
r.TranslatedAddress.String(),
|
|
r.TranslatedPort)
|
|
}
|
|
|
|
func (r ForwardRule) String() string {
|
|
return r.GetRuleID()
|
|
}
|