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

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-22 01:50:41 +00:00
parent f225e15b2c
commit b15f394199
+6
View File
@@ -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 == "":