wireguard: implement EndpointAddress.UnmarshalText

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-09-01 20:00:42 +00:00
parent ebfe47a31a
commit ecff053a7b
+5
View File
@@ -107,6 +107,11 @@ func (ep EndpointAddress) String() string {
}
}
// UnmarshalText loads an endpoint address from text data
func (ep *EndpointAddress) UnmarshalText(b []byte) error {
return ep.FromString(string(b))
}
// FromString sets the EndpointAddress from a given "[host]:port"
func (ep *EndpointAddress) FromString(s string) error {
host, port, err := core.SplitHostPort(s)