mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-25 19:56:46 +00:00
28 lines
657 B
Go
28 lines
657 B
Go
package manager
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
// Port of the address for firewall rule
|
|
// todo Move Protocol and Port and RouterPair to the Firwall package or a separate package
|
|
type Port struct {
|
|
// IsRange is true Values contains two values, the first is the start port, the second is the end port
|
|
IsRange bool
|
|
|
|
// Values contains one value for single port, multiple values for the list of ports, or two values for the range of ports
|
|
Values []int
|
|
}
|
|
|
|
// String interface implementation
|
|
func (p *Port) String() string {
|
|
var ports string
|
|
for _, port := range p.Values {
|
|
if ports != "" {
|
|
ports += ","
|
|
}
|
|
ports += strconv.Itoa(port)
|
|
}
|
|
return ports
|
|
}
|