mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-27 20:56:44 +00:00
Manage Forwarding rules
This commit is contained in:
26
client/firewall/manager/forward_rule.go
Normal file
26
client/firewall/manager/forward_rule.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package manager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
// ForwardRule todo figure out better place to this to avoid circular imports
|
||||
type ForwardRule struct {
|
||||
Protocol Protocol
|
||||
DestinationPort Port
|
||||
TranslatedAddress net.IP
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user