Browse Source

wireguard: add EndpointAddress.Name() removing the domain from Host

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head
Alejandro Mery 10 months ago
parent
commit
b15f394199
  1. 6
      pkg/wireguard/config.go

6
pkg/wireguard/config.go

@ -49,6 +49,12 @@ type EndpointAddress struct {
Port uint16
}
// Name returns the first part of a hostname
func (ep EndpointAddress) Name() string {
before, _, _ := strings.Cut(ep.Host, ".")
return before
}
func (ep EndpointAddress) String() string {
switch {
case ep.Host == "":

Loading…
Cancel
Save