Browse Source

wireguard: implement EndpointAddress.UnmarshalText

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/32/head
Alejandro Mery 1 year ago
parent
commit
125a4c0dbe
  1. 5
      pkg/wireguard/config.go

5
pkg/wireguard/config.go

@ -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" // FromString sets the EndpointAddress from a given "[host]:port"
func (ep *EndpointAddress) FromString(s string) error { func (ep *EndpointAddress) FromString(s string) error {
host, port, err := core.SplitHostPort(s) host, port, err := core.SplitHostPort(s)

Loading…
Cancel
Save