From 9c470d4534be9ec8df7e348c181ade6bbd3f1832 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Mon, 2 Mar 2020 02:49:44 +0000 Subject: [PATCH] fix parsing -- needed a pointer method --- types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types.go b/types.go index b876114..511ed70 100644 --- a/types.go +++ b/types.go @@ -74,7 +74,7 @@ func (n JSONIPNet) MarshalJSON() ([]byte, error) { return []byte("\"" + n.IPNet.String() + "\""), nil } -func (n JSONIPNet) UnmarshalJSON(b []byte) error { +func (n *JSONIPNet) UnmarshalJSON(b []byte) error { cidr := strings.Trim(string(b), "\"") _, IPNet, err := net.ParseCIDR(cidr) n.IPNet = *IPNet @@ -93,7 +93,7 @@ func (k JSONKey) MarshalJSON() ([]byte, error) { return []byte("\"" + k.Key.String() + "\""), nil } -func (k JSONKey) UnmarshalJSON(b []byte) error { +func (k *JSONKey) UnmarshalJSON(b []byte) error { b64Key := strings.Trim(string(b), "\"") key, err := wgtypes.ParseKey(b64Key) k.Key = key