mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-08 10:57:25 +02:00
Client-side forward handling Co-authored-by: Viktor Liu <17948409+lixmal@users.noreply.github.com> --------- Co-authored-by: Viktor Liu <17948409+lixmal@users.noreply.github.com>
28 lines
688 B
Go
28 lines
688 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) ID() string {
|
|
id := fmt.Sprintf("%s;%s;%s;%s",
|
|
r.Protocol,
|
|
r.DestinationPort.String(),
|
|
r.TranslatedAddress.String(),
|
|
r.TranslatedPort.String())
|
|
return id
|
|
}
|
|
|
|
func (r ForwardRule) String() string {
|
|
return fmt.Sprintf("protocol: %s, destinationPort: %s, translatedAddress: %s, translatedPort: %s", r.Protocol, r.DestinationPort.String(), r.TranslatedAddress.String(), r.TranslatedPort.String())
|
|
}
|