mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-26 22:25:52 -05:00
Fix new version of hujson
This commit is contained in:
parent
204f99dd51
commit
3ad2350c79
9
acls.go
9
acls.go
@ -38,7 +38,14 @@ func (h *Headscale) LoadACLPolicy(path string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = hujson.Unmarshal(b, &policy)
|
|
||||||
|
ast, err := hujson.Parse(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ast.Standardize()
|
||||||
|
b = ast.Pack()
|
||||||
|
err = json.Unmarshal(b, &policy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package headscale
|
package headscale
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/tailscale/hujson"
|
"github.com/tailscale/hujson"
|
||||||
@ -43,7 +44,13 @@ type ACLTest struct {
|
|||||||
func (h *Hosts) UnmarshalJSON(data []byte) error {
|
func (h *Hosts) UnmarshalJSON(data []byte) error {
|
||||||
hosts := Hosts{}
|
hosts := Hosts{}
|
||||||
hs := make(map[string]string)
|
hs := make(map[string]string)
|
||||||
err := hujson.Unmarshal(data, &hs)
|
ast, err := hujson.Parse(data)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ast.Standardize()
|
||||||
|
data = ast.Pack()
|
||||||
|
err = json.Unmarshal(data, &hs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user