mirror of
https://github.com/mje-nz/zerotier-dns.git
synced 2024-05-11 05:55:15 +00:00
Fix for non-empty structs
Capabilites, Tags and TagsByName fields can be non-empty structs. The current code breaks in that case (can't be unmarshaled) whereas the patch replaces `string` with `json.RawMessage` to take care of it.
This commit is contained in:
+3
-2
@@ -3,6 +3,7 @@
|
||||
package ztapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
@@ -56,7 +57,7 @@ type Member struct {
|
||||
Ts int
|
||||
}
|
||||
Authorized bool
|
||||
Capabilities []string
|
||||
Capabilities []json.RawMessage
|
||||
CreationTime apiTime
|
||||
ID string
|
||||
Identity string
|
||||
@@ -68,7 +69,7 @@ type Member struct {
|
||||
Objtype string
|
||||
PhysicalAddr string
|
||||
Revision int
|
||||
Tags []string
|
||||
Tags []json.RawMessage
|
||||
VMajor int
|
||||
VMinor int
|
||||
VProto int
|
||||
|
||||
+7
-4
@@ -2,7 +2,10 @@
|
||||
|
||||
package ztapi
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// GetNetworkInfo returns a Nework containing information about a ZeroTier network
|
||||
func GetNetworkInfo(API, host, networkID string) (*Network, error) {
|
||||
@@ -32,7 +35,7 @@ type Network struct {
|
||||
Config struct {
|
||||
ActiveMemberCount int
|
||||
AuthorizedMemberCount int
|
||||
Capabilities []string
|
||||
Capabilities []json.RawMessage
|
||||
Clock apiTime
|
||||
CreationTime apiTime
|
||||
EnableBroadcast bool
|
||||
@@ -57,7 +60,7 @@ type Network struct {
|
||||
Or bool
|
||||
Type string
|
||||
}
|
||||
Tags []string
|
||||
Tags []json.RawMessage
|
||||
TotalMemberCount int
|
||||
V4AssignMode struct {
|
||||
Zt bool
|
||||
@@ -79,6 +82,6 @@ type Network struct {
|
||||
}
|
||||
OnlineMemberCount int
|
||||
CapabilitesByName map[string]string
|
||||
TagsByName map[string]string
|
||||
TagsByName map[string]json.RawMessage
|
||||
CircuitTestEvery int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user