Client update
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
|
|
||||||
# goreleaser
|
# goreleaser
|
||||||
/dist/
|
/dist/
|
||||||
|
provider
|
||||||
4
unifi/device.generated.go
generated
4
unifi/device.generated.go
generated
@@ -495,8 +495,8 @@ func (dst *DeviceRadioIDentifiers) UnmarshalJSON(b []byte) error {
|
|||||||
type DeviceRadioTable struct {
|
type DeviceRadioTable struct {
|
||||||
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
|
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
|
||||||
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
|
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
|
||||||
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
|
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|17|21|25|29|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
|
||||||
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
|
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|17|21|25|29|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
|
||||||
ChannelOptimizationEnabled bool `json:"channel_optimization_enabled,omitempty"`
|
ChannelOptimizationEnabled bool `json:"channel_optimization_enabled,omitempty"`
|
||||||
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"`
|
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"`
|
||||||
Ht int `json:"ht,omitempty"` // 20|40|80|160|240|320|1080|2160|4320
|
Ht int `json:"ht,omitempty"` // 20|40|80|160|240|320|1080|2160|4320
|
||||||
|
|||||||
137
unifi/dns_record.generated.go
generated
137
unifi/dns_record.generated.go
generated
@@ -1,137 +0,0 @@
|
|||||||
// Code generated from ace.jar fields *.json files
|
|
||||||
// DO NOT EDIT.
|
|
||||||
|
|
||||||
package unifi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// just to fix compile issues with the import
|
|
||||||
var (
|
|
||||||
_ context.Context
|
|
||||||
_ fmt.Formatter
|
|
||||||
_ json.Marshaler
|
|
||||||
)
|
|
||||||
|
|
||||||
type DNSRecord struct {
|
|
||||||
ID string `json:"_id,omitempty"`
|
|
||||||
SiteID string `json:"site_id,omitempty"`
|
|
||||||
|
|
||||||
Hidden bool `json:"attr_hidden,omitempty"`
|
|
||||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
|
||||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
|
||||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
|
||||||
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
Key string `json:"key,omitempty"` // .{1,128}
|
|
||||||
Port int `json:"port,omitempty"`
|
|
||||||
Priority int `json:"priority,omitempty"` // .{1,128}
|
|
||||||
RecordType string `json:"record_type,omitempty"` // A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT
|
|
||||||
Ttl int `json:"ttl,omitempty"`
|
|
||||||
Value string `json:"value,omitempty"` // .{1,256}
|
|
||||||
Weight int `json:"weight,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *DNSRecord) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias DNSRecord
|
|
||||||
aux := &struct {
|
|
||||||
Port emptyStringInt `json:"port"`
|
|
||||||
Ttl emptyStringInt `json:"ttl"`
|
|
||||||
Weight emptyStringInt `json:"weight"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.Port = int(aux.Port)
|
|
||||||
dst.Ttl = int(aux.Ttl)
|
|
||||||
dst.Weight = int(aux.Weight)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) listDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) {
|
|
||||||
var respBody []DNSRecord
|
|
||||||
|
|
||||||
err := c.do(ctx, "GET", fmt.Sprintf("%s/site/%s/static-dns", c.apiV2Path, site), nil, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return respBody, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) getDNSRecord(ctx context.Context, site, id string) (*DNSRecord, error) {
|
|
||||||
var respBody struct {
|
|
||||||
Meta meta `json:"meta"`
|
|
||||||
Data []DNSRecord `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
err := c.do(ctx, "GET", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, id), nil, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(respBody.Data) != 1 {
|
|
||||||
return nil, &NotFoundError{}
|
|
||||||
}
|
|
||||||
|
|
||||||
d := respBody.Data[0]
|
|
||||||
return &d, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) deleteDNSRecord(ctx context.Context, site, id string) error {
|
|
||||||
err := c.do(ctx, "DELETE", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, id), struct{}{}, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) createDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
|
|
||||||
var respBody struct {
|
|
||||||
Meta meta `json:"meta"`
|
|
||||||
Data []DNSRecord `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
err := c.do(ctx, "POST", fmt.Sprintf("%s/site/%s/static-dns", c.apiV2Path, site), d, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(respBody.Data) != 1 {
|
|
||||||
return nil, &NotFoundError{}
|
|
||||||
}
|
|
||||||
|
|
||||||
new := respBody.Data[0]
|
|
||||||
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) updateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
|
|
||||||
var respBody struct {
|
|
||||||
Meta meta `json:"meta"`
|
|
||||||
Data []DNSRecord `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
err := c.do(ctx, "PUT", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, d.ID), d, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(respBody.Data) != 1 {
|
|
||||||
return nil, &NotFoundError{}
|
|
||||||
}
|
|
||||||
|
|
||||||
new := respBody.Data[0]
|
|
||||||
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,51 @@ package unifi
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type DNSRecord struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
Key string `json:"key,omitempty"` // .{1,128}
|
||||||
|
Port int `json:"port,omitempty"`
|
||||||
|
Priority int `json:"priority,omitempty"` // .{1,128}
|
||||||
|
RecordType string `json:"record_type,omitempty"` // A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT
|
||||||
|
Ttl int `json:"ttl,omitempty"`
|
||||||
|
Value string `json:"value,omitempty"` // .{1,256}
|
||||||
|
Weight int `json:"weight,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dst *DNSRecord) UnmarshalJSON(b []byte) error {
|
||||||
|
type Alias DNSRecord
|
||||||
|
aux := &struct {
|
||||||
|
Port emptyStringInt `json:"port"`
|
||||||
|
Ttl emptyStringInt `json:"ttl"`
|
||||||
|
Weight emptyStringInt `json:"weight"`
|
||||||
|
|
||||||
|
*Alias
|
||||||
|
}{
|
||||||
|
Alias: (*Alias)(dst),
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(b, &aux)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
||||||
|
}
|
||||||
|
dst.Port = int(aux.Port)
|
||||||
|
dst.Ttl = int(aux.Ttl)
|
||||||
|
dst.Weight = int(aux.Weight)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) ListDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) {
|
func (c *Client) ListDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) {
|
||||||
var respBody []DNSRecord
|
var respBody []DNSRecord
|
||||||
|
|
||||||
|
|||||||
45
unifi/port_forward.generated.go
generated
45
unifi/port_forward.generated.go
generated
@@ -25,16 +25,20 @@ type PortForward struct {
|
|||||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
DestinationIP string `json:"destination_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^any$
|
DestinationIP string `json:"destination_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^any$
|
||||||
DstPort string `json:"dst_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
DestinationIPs []PortForwardDestinationIPs `json:"destination_ips,omitempty"`
|
||||||
Enabled bool `json:"enabled"`
|
DstPort string `json:"dst_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||||
Fwd string `json:"fwd,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
Enabled bool `json:"enabled"`
|
||||||
FwdPort string `json:"fwd_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
Fwd string `json:"fwd,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||||
Log bool `json:"log"`
|
FwdPort string `json:"fwd_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||||
Name string `json:"name,omitempty"` // .{1,128}
|
Log bool `json:"log"`
|
||||||
PfwdInterface string `json:"pfwd_interface,omitempty"` // wan|wan2|both
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
Proto string `json:"proto,omitempty"` // tcp_udp|tcp|udp
|
PfwdInterface string `json:"pfwd_interface,omitempty"` // wan|wan2|both|all
|
||||||
Src string `json:"src,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^any$
|
Proto string `json:"proto,omitempty"` // tcp_udp|tcp|udp
|
||||||
|
Src string `json:"src,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^any$
|
||||||
|
SrcFirewallGroupID string `json:"src_firewall_group_id"`
|
||||||
|
SrcLimitingEnabled bool `json:"src_limiting_enabled"`
|
||||||
|
SrcLimitingType string `json:"src_limiting_type,omitempty"` // ip|firewall_group
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *PortForward) UnmarshalJSON(b []byte) error {
|
func (dst *PortForward) UnmarshalJSON(b []byte) error {
|
||||||
@@ -53,6 +57,27 @@ func (dst *PortForward) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PortForwardDestinationIPs struct {
|
||||||
|
DestinationIP string `json:"destination_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^any$
|
||||||
|
Interface string `json:"interface,omitempty"` // wan|wan2
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dst *PortForwardDestinationIPs) UnmarshalJSON(b []byte) error {
|
||||||
|
type Alias PortForwardDestinationIPs
|
||||||
|
aux := &struct {
|
||||||
|
*Alias
|
||||||
|
}{
|
||||||
|
Alias: (*Alias)(dst),
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(b, &aux)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) listPortForward(ctx context.Context, site string) ([]PortForward, error) {
|
func (c *Client) listPortForward(ctx context.Context, site string) ([]PortForward, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
2
unifi/setting_ips.generated.go
generated
2
unifi/setting_ips.generated.go
generated
@@ -32,7 +32,7 @@ type SettingIps struct {
|
|||||||
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |auto|manual|disabled
|
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |auto|manual|disabled
|
||||||
DNSFiltering bool `json:"dns_filtering"`
|
DNSFiltering bool `json:"dns_filtering"`
|
||||||
DNSFilters []SettingIpsDNSFilters `json:"dns_filters,omitempty"`
|
DNSFilters []SettingIpsDNSFilters `json:"dns_filters,omitempty"`
|
||||||
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
|
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada
|
||||||
EnabledNetworks []string `json:"enabled_networks,omitempty"`
|
EnabledNetworks []string `json:"enabled_networks,omitempty"`
|
||||||
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
|
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
|
||||||
HoneypotEnabled bool `json:"honeypot_enabled"`
|
HoneypotEnabled bool `json:"honeypot_enabled"`
|
||||||
|
|||||||
2
unifi/version.generated.go
generated
2
unifi/version.generated.go
generated
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package unifi
|
package unifi
|
||||||
|
|
||||||
const UnifiVersion = "8.2.93"
|
const UnifiVersion = "8.3.32"
|
||||||
|
|||||||
Reference in New Issue
Block a user