Update IPSecESPLifetime
This commit is contained in:
@@ -139,7 +139,7 @@ func extractJSON(jarFile, fieldsDir string) error {
|
|||||||
return fmt.Errorf("unable to open settings file: %w", err)
|
return fmt.Errorf("unable to open settings file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings map[string]interface{}
|
var settings map[string]any
|
||||||
err = json.Unmarshal(settingsData, &settings)
|
err = json.Unmarshal(settingsData, &settings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to unmarshal settings: %w", err)
|
return fmt.Errorf("unable to unmarshal settings: %w", err)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func (l firmwareUpdateApiResponseEmbeddedFirmwareDataLink) MarshalJSON() ([]byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *firmwareUpdateApiResponseEmbeddedFirmwareDataLink) UnmarshalJSON(j []byte) error {
|
func (l *firmwareUpdateApiResponseEmbeddedFirmwareDataLink) UnmarshalJSON(j []byte) error {
|
||||||
var m map[string]interface{}
|
var m map[string]any
|
||||||
|
|
||||||
err := json.Unmarshal(j, &m)
|
err := json.Unmarshal(j, &m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ func (r *Resource) IsSetting() bool {
|
|||||||
return strings.HasPrefix(r.StructName, "Setting")
|
return strings.HasPrefix(r.StructName, "Setting")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) processFields(fields map[string]interface{}) {
|
func (r *Resource) processFields(fields map[string]any) {
|
||||||
t := r.Types[r.StructName]
|
t := r.Types[r.StructName]
|
||||||
for name, validation := range fields {
|
for name, validation := range fields {
|
||||||
fieldInfo, err := r.fieldInfoFromValidation(name, validation)
|
fieldInfo, err := r.fieldInfoFromValidation(name, validation)
|
||||||
@@ -494,7 +494,7 @@ func (r *Resource) processFields(fields map[string]interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) fieldInfoFromValidation(name string, validation interface{}) (*FieldInfo, error) {
|
func (r *Resource) fieldInfoFromValidation(name string, validation any) (*FieldInfo, error) {
|
||||||
fieldName := strcase.ToCamel(name)
|
fieldName := strcase.ToCamel(name)
|
||||||
fieldName = cleanName(fieldName, fieldReps)
|
fieldName = cleanName(fieldName, fieldReps)
|
||||||
|
|
||||||
@@ -502,7 +502,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation interface{})
|
|||||||
var fieldInfo *FieldInfo
|
var fieldInfo *FieldInfo
|
||||||
|
|
||||||
switch validation := validation.(type) {
|
switch validation := validation.(type) {
|
||||||
case []interface{}:
|
case []any:
|
||||||
if len(validation) == 0 {
|
if len(validation) == 0 {
|
||||||
fieldInfo = NewFieldInfo(fieldName, name, "string", "", false, true, "")
|
fieldInfo = NewFieldInfo(fieldName, name, "string", "", false, true, "")
|
||||||
err := r.FieldProcessor(fieldName, fieldInfo)
|
err := r.FieldProcessor(fieldName, fieldInfo)
|
||||||
@@ -523,7 +523,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation interface{})
|
|||||||
err = r.FieldProcessor(fieldName, fieldInfo)
|
err = r.FieldProcessor(fieldName, fieldInfo)
|
||||||
return fieldInfo, err
|
return fieldInfo, err
|
||||||
|
|
||||||
case map[string]interface{}:
|
case map[string]any:
|
||||||
typeName := r.StructName + fieldName
|
typeName := r.StructName + fieldName
|
||||||
|
|
||||||
result := NewFieldInfo(fieldName, name, typeName, "", true, false, "")
|
result := NewFieldInfo(fieldName, name, typeName, "", true, false, "")
|
||||||
@@ -587,7 +587,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) processJSON(b []byte) error {
|
func (r *Resource) processJSON(b []byte) error {
|
||||||
var fields map[string]interface{}
|
var fields map[string]any
|
||||||
err := json.Unmarshal(b, &fields)
|
err := json.Unmarshal(b, &fields)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestFieldInfoFromValidation(t *testing.T) {
|
|||||||
expectedType string
|
expectedType string
|
||||||
expectedComment string
|
expectedComment string
|
||||||
expectedOmitEmpty bool
|
expectedOmitEmpty bool
|
||||||
validation interface{}
|
validation any
|
||||||
}{
|
}{
|
||||||
{"string", "", true, ""},
|
{"string", "", true, ""},
|
||||||
{"string", "default|custom", true, "default|custom"},
|
{"string", "default|custom", true, "default|custom"},
|
||||||
|
|||||||
2
unifi/network.generated.go
generated
2
unifi/network.generated.go
generated
@@ -92,7 +92,7 @@ type Network struct {
|
|||||||
IPSecEspDhGroup int `json:"ipsec_esp_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
|
IPSecEspDhGroup int `json:"ipsec_esp_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
|
||||||
IPSecEspEncryption string `json:"ipsec_esp_encryption,omitempty"` // aes128|aes192|aes256|3des
|
IPSecEspEncryption string `json:"ipsec_esp_encryption,omitempty"` // aes128|aes192|aes256|3des
|
||||||
IPSecEspHash string `json:"ipsec_esp_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
|
IPSecEspHash string `json:"ipsec_esp_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
|
||||||
IPSecEspLifetime string `json:"ipsec_esp_lifetime,omitempty"` // ^(?:3[0-9]|[4-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$
|
IPSecEspLifetime emptyStringInt `json:"ipsec_esp_lifetime,omitempty"` // ^(?:3[0-9]|[4-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$
|
||||||
IPSecHash string `json:"ipsec_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
|
IPSecHash string `json:"ipsec_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
|
||||||
IPSecIkeDhGroup int `json:"ipsec_ike_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
|
IPSecIkeDhGroup int `json:"ipsec_ike_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
|
||||||
IPSecIkeEncryption string `json:"ipsec_ike_encryption,omitempty"` // aes128|aes192|aes256|3des
|
IPSecIkeEncryption string `json:"ipsec_ike_encryption,omitempty"` // aes128|aes192|aes256|3des
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type Setting struct {
|
|||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Setting) newFields() (interface{}, error) {
|
func (s *Setting) newFields() (any, error) {
|
||||||
switch s.Key {
|
switch s.Key {
|
||||||
case "auto_speedtest":
|
case "auto_speedtest":
|
||||||
return &SettingAutoSpeedtest{}, nil
|
return &SettingAutoSpeedtest{}, nil
|
||||||
@@ -79,7 +79,7 @@ func (s *Setting) newFields() (interface{}, error) {
|
|||||||
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetSetting(ctx context.Context, site, key string) (*Setting, interface{}, error) {
|
func (c *Client) GetSetting(ctx context.Context, site, key string) (*Setting, any, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
Data []json.RawMessage `json:"data"`
|
Data []json.RawMessage `json:"data"`
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ func (c *Client) Login(ctx context.Context, user, pass string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody interface{}, respBody interface{}) error {
|
func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody any, respBody any) error {
|
||||||
// single threading requests, this is mostly to assist in CSRF token propagation
|
// single threading requests, this is mostly to assist in CSRF token propagation
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ func (c *Client) CreateUser(ctx context.Context, site string, d *User) (*User, e
|
|||||||
return &user, nil
|
return &user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]interface{}) ([]User, error) {
|
func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]any) ([]User, error) {
|
||||||
reqBody := map[string]interface{}{}
|
reqBody := map[string]any{}
|
||||||
|
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
reqBody[k] = v
|
reqBody[k] = v
|
||||||
@@ -94,7 +94,7 @@ func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]i
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "block-sta", map[string]interface{}{
|
users, err := c.stamgr(ctx, site, "block-sta", map[string]any{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -107,7 +107,7 @@ func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "unblock-sta", map[string]interface{}{
|
users, err := c.stamgr(ctx, site, "unblock-sta", map[string]any{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -120,7 +120,7 @@ func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "forget-sta", map[string]interface{}{
|
users, err := c.stamgr(ctx, site, "forget-sta", map[string]any{
|
||||||
"macs": []string{mac},
|
"macs": []string{mac},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -133,7 +133,7 @@ func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "kick-sta", map[string]interface{}{
|
users, err := c.stamgr(ctx, site, "kick-sta", map[string]any{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -146,7 +146,7 @@ func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) OverrideUserFingerprint(ctx context.Context, site, mac string, devIdOveride int) error {
|
func (c *Client) OverrideUserFingerprint(ctx context.Context, site, mac string, devIdOveride int) error {
|
||||||
reqBody := map[string]interface{}{
|
reqBody := map[string]any{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
"dev_id_override": devIdOveride,
|
"dev_id_override": devIdOveride,
|
||||||
"search_query": "",
|
"search_query": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user