fix: WAN network support was broken
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,3 +3,6 @@
|
|||||||
|
|
||||||
# goreleaser
|
# goreleaser
|
||||||
/dist/
|
/dist/
|
||||||
|
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Unifi Go SDK [](https://godoc.org/github.com/paultyng/go-unifi)
|
# Unifi Go SDK [](https://godoc.org/github.com/filipowm/go-unifi)
|
||||||
|
|
||||||
This was written primarily for use in my [Terraform provider for Unifi](https://github.com/paultyng/terraform-provider-unifi).
|
This was written primarily for use in my [Terraform provider for Unifi](https://github.com/filipowm/terraform-provider-unifi).
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ func generateCode(fieldsDir string, outDir string) error {
|
|||||||
f.CustomUnmarshalType = "*bool"
|
f.CustomUnmarshalType = "*bool"
|
||||||
f.CustomUnmarshalFunc = "emptyBoolToTrue"
|
f.CustomUnmarshalFunc = "emptyBoolToTrue"
|
||||||
}
|
}
|
||||||
|
case "WANUsername", "XWANPassword":
|
||||||
|
f.OmitEmpty = true
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/paultyng/go-unifi
|
module github.com/filipowm/go-unifi
|
||||||
|
|
||||||
go 1.22.1
|
go 1.22.1
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/paultyng/go-unifi/unifi"
|
"github.com/filipowm/go-unifi/unifi"
|
||||||
"github.com/tj/assert"
|
"github.com/tj/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
4
unifi/network.generated.go
generated
4
unifi/network.generated.go
generated
@@ -231,7 +231,7 @@ type Network struct {
|
|||||||
WANSmartqUpRate int `json:"wan_smartq_up_rate,omitempty"` // [0-9]{1,6}|1000000
|
WANSmartqUpRate int `json:"wan_smartq_up_rate,omitempty"` // [0-9]{1,6}|1000000
|
||||||
WANType string `json:"wan_type,omitempty"` // disabled|dhcp|static|pppoe|dslite
|
WANType string `json:"wan_type,omitempty"` // disabled|dhcp|static|pppoe|dslite
|
||||||
WANTypeV6 string `json:"wan_type_v6,omitempty"` // disabled|slaac|dhcpv6|static
|
WANTypeV6 string `json:"wan_type_v6,omitempty"` // disabled|slaac|dhcpv6|static
|
||||||
WANUsername string `json:"wan_username"` // [^"' ]+|^$
|
WANUsername string `json:"wan_username,omitempty"` // [^"' ]+|^$
|
||||||
WANVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
|
WANVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
|
||||||
WANVLANEnabled bool `json:"wan_vlan_enabled"`
|
WANVLANEnabled bool `json:"wan_vlan_enabled"`
|
||||||
WireguardClientConfigurationFile string `json:"wireguard_client_configuration_file,omitempty"`
|
WireguardClientConfigurationFile string `json:"wireguard_client_configuration_file,omitempty"`
|
||||||
@@ -257,7 +257,7 @@ type Network struct {
|
|||||||
XServerKey string `json:"x_server_key,omitempty"`
|
XServerKey string `json:"x_server_key,omitempty"`
|
||||||
XSharedClientCrt string `json:"x_shared_client_crt,omitempty"`
|
XSharedClientCrt string `json:"x_shared_client_crt,omitempty"`
|
||||||
XSharedClientKey string `json:"x_shared_client_key,omitempty"`
|
XSharedClientKey string `json:"x_shared_client_key,omitempty"`
|
||||||
XWANPassword string `json:"x_wan_password"` // [^"' ]+|^$
|
XWANPassword string `json:"x_wan_password,omitempty"` // [^"' ]+|^$
|
||||||
XWireguardPrivateKey string `json:"x_wireguard_private_key,omitempty"`
|
XWireguardPrivateKey string `json:"x_wireguard_private_key,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/paultyng/go-unifi/unifi"
|
"github.com/filipowm/go-unifi/unifi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkUnmarshalJSON(t *testing.T) {
|
func TestNetworkUnmarshalJSON(t *testing.T) {
|
||||||
|
|||||||
2
unifi/version.generated.go
generated
2
unifi/version.generated.go
generated
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package unifi
|
package unifi
|
||||||
|
|
||||||
const UnifiVersion = "9.0.108"
|
const UnifiVersion = "9.0.114"
|
||||||
|
|||||||
Reference in New Issue
Block a user