Skip to content

Commit

Permalink
Bump to 6.0.43, use go generate
Browse files Browse the repository at this point in the history
Also moved fetching of JSON information to Go for cross-OS usage.
  • Loading branch information
paultyng committed Apr 9, 2021
1 parent 5219e06 commit 4ab4036
Show file tree
Hide file tree
Showing 76 changed files with 496 additions and 421 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Many of the naming adjustments are breaking changes, but to simplify things, tre

The data models and basic REST methods are "generated" from JSON files in the JAR that show all fields and the associated regex/validation information.

This is kind of gross, I wanted to switch to using the java classes in the jar like scala2go but the jar is obfuscated and I couldn't find a way to extract that information from anywhere else. Maybe it exists somewhere in the web UI, but I was unable to find it in there in a way that was extractable in a practical way.
To regenerate the code, you can bump the Unifi Controller version number in [unifi/gen.go] and run `go generate` inside the `unifi` directory.

This code generation is kind of gross, I wanted to switch to using the java classes in the jar like scala2go but the jar is obfuscated and I couldn't find a way to extract that information from anywhere else. Maybe it exists somewhere in the web UI, but I was unable to find it in there in a way that was extractable in a practical way.

Still planning to dig through the bits some more later on.
3 changes: 0 additions & 3 deletions fields/6.0.23/ApGroups.json

This file was deleted.

4 changes: 0 additions & 4 deletions fields/6.0.23/SettingSuperIdentity.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion fields/6.0.23/Device.json → fields/6.0.43/Device.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"tx_power_mode": "auto|medium|high|low|custom",
"tx_power": "[\\d]+|auto",
"min_rssi_enabled": "true|false",
"min_rssi": "^-([1-9]|[1-8][0-9]|9[0-4])$",
"min_rssi": "^-(6[7-9]|[7-8][0-9]|90)$",
"name": "",
"hard_noise_floor_enabled": "true|false",
"sens_level_enabled": "true|false",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"enabled": "false|true",
"interval": "^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enabled": "true|false",
"server": "",
"outbound_proxy": "",
"package_url": ""
}
"package_url": "",
"server": ""
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"sound_before_enabled": "true|false",
"sound_before_type": "sample|media",
"sound_before_resource": "",
"sound_after_enabled": "true|false",
"sound_after_resource": "",
"sound_after_type": "sample|media",
"sound_after_resource": ""
}
"sound_before_enabled": "true|false",
"sound_before_resource": "",
"sound_before_type": "sample|media"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"enable_isolated_wlan": "true|false",
"enabled": "true|false",
"x_mesh_essid": "",
"x_mesh_psk": "",
"uplink_host": "",
"uplink_type": ""
}
"uplink_type": "",
"x_mesh_essid": "",
"x_mesh_psk": ""
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"code": "[\\d]{1,3}"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"enabled": "false|true",
"fingerprintingEnabled": "false|true"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"enabled": "true|false",
"x_element_essid": "",
"x_element_psk": ""
}
}
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
{
"portal_enabled": "true|false",
"allowed_subnet_": "",
"auth": "none|hotspot|facebook_wifi|custom",
"redirect_enabled": "true|false",
"redirect_url": "",
"redirect_https": "true|false",
"redirect_to_https": "true|false",
"portal_customized": "true|false",
"portal_use_hostname": "true|false",
"portal_hostname": "^[a-zA-Z0-9.-]+$|^$",
"authorize_use_sandbox": "true|false",
"custom_ip": "^(([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])$|^$",
"ec_enabled": "true|false",
"expire": "[\\d]+|custom",
"expire_number": "^[1-9][0-9]{0,5}|1000000$",
"expire_unit": "1|60|1440",
"x_password": "",
"custom_ip": "^(([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])$|^$",
"facebook_enabled": "true|false",
"facebook_app_id": "",
"x_facebook_app_secret": "",
"facebook_enabled": "true|false",
"facebook_scope_email": "true|false",
"facebook_wifi_block_https": "true|false",
"facebook_wifi_gw_id": "",
"facebook_wifi_gw_name": "",
"x_facebook_wifi_gw_secret": "",
"facebook_wifi_block_https": "true|false",
"google_enabled": "true|false",
"gateway": "paypal|stripe|authorize|quickpay|merchantwarrior|ippay",
"google_client_id": "",
"x_google_client_secret": "",
"google_domain": "",
"google_enabled": "true|false",
"google_scope_email": "true|false",
"ippay_use_sandbox": "true|false",
"merchantwarrior_use_sandbox": "false|true",
"password_enabled": "true|false",
"voucher_enabled": "true|false",
"voucher_customized": "true|false",
"payment_enabled": "true|false",
"restricted_subnet_": "",
"allowed_subnet_": "",
"restricted_dns_enabled": "false|true",
"restricted_dns_servers": [
"^(([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])$|^$"
],
"gateway": "paypal|stripe|authorize|quickpay|merchantwarrior|ippay",
"paypal_use_sandbox": "true|false",
"x_paypal_username": "",
"x_paypal_password": "",
"x_paypal_signature": "",
"x_stripe_api_key": "",
"x_quickpay_agreementid": "",
"x_quickpay_apikey": "",
"x_quickpay_merchantid": "",
"quickpay_testmode": "true|false",
"x_authorize_loginid": "",
"x_authorize_transactionkey": "",
"x_merchantwarrior_merchantuuid": "",
"x_merchantwarrior_apikey": "",
"x_merchantwarrior_apipassphrase": "",
"x_ippay_terminalid": "",
"merchantwarrior_use_sandbox": "false|true",
"authorize_use_sandbox": "true|false",
"ippay_use_sandbox": "true|false",
"template_engine": "jsp|angular",
"portal_customized": "true|false",
"portal_customized_bg_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_bg_image_enabled": "true|false",
"portal_customized_bg_image_filename": "",
"portal_customized_bg_image_tile": "true|false",
"portal_customized_box_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_opacity": "^[1-9][0-9]?$|^100$|^$",
"portal_customized_box_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_button_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_button_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_languages": [
"^[a-z]{2}(_[A-Z]{2})*$"
],
"portal_customized_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_logo_enabled": "true|false",
"portal_customized_logo_filename": "",
"portal_customized_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_title": "",
"portal_customized_tos_enabled": "true|false",
"portal_customized_tos": "",
"portal_customized_tos_enabled": "true|false",
"portal_customized_unsplash_author_name": "",
"portal_customized_unsplash_author_username": "",
"portal_customized_welcome_text": "",
"portal_customized_welcome_text_enabled": "true|false",
"portal_customized_welcome_text_position": "under_logo|above_boxes",
"portal_customized_box_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_languages": [
"^[a-z]{2}(_[A-Z]{2})*$"
],
"radius_enabled": "true|false",
"portal_enabled": "true|false",
"portal_hostname": "^[a-zA-Z0-9.-]+$|^$",
"portal_use_hostname": "true|false",
"quickpay_testmode": "true|false",
"radius_auth_type": "chap|mschapv2",
"radius_disconnect_enabled": "true|false",
"radius_disconnect_port": "[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]",
"radius_enabled": "true|false",
"radiusprofile_id": "",
"wechat_enabled": "true|false",
"redirect_enabled": "true|false",
"redirect_https": "true|false",
"redirect_to_https": "true|false",
"redirect_url": "",
"restricted_dns_enabled": "false|true",
"restricted_dns_servers": [
"^(([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])$|^$"
],
"restricted_subnet_": "",
"template_engine": "jsp|angular",
"voucher_customized": "true|false",
"voucher_enabled": "true|false",
"wechat_app_id": "",
"wechat_enabled": "true|false",
"wechat_shop_id": "",
"x_authorize_loginid": "",
"x_authorize_transactionkey": "",
"x_facebook_app_secret": "",
"x_facebook_wifi_gw_secret": "",
"x_google_client_secret": "",
"x_ippay_terminalid": "",
"x_merchantwarrior_apikey": "",
"x_merchantwarrior_apipassphrase": "",
"x_merchantwarrior_merchantuuid": "",
"x_password": "",
"x_paypal_password": "",
"x_paypal_signature": "",
"x_paypal_username": "",
"x_quickpay_agreementid": "",
"x_quickpay_apikey": "",
"x_quickpay_merchantid": "",
"x_stripe_api_key": "",
"x_wechat_app_secret": "",
"x_wechat_secret_key": "",
"ec_enabled": "true|false"
}
"x_wechat_secret_key": ""
}
60 changes: 30 additions & 30 deletions fields/6.0.23/SettingIps.json → fields/6.0.43/SettingIps.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
{
"dns_filtering": "true|false",
"dns_filters": [
{
"allowed_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_tld": [
"^[a-zA-Z0-9.-]+$|^$"
],
"description": "",
"filter": "none|work|family",
"name": "",
"network_id": "",
"version": "v4|v6"
}
],
"enabled_categories": [
"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"
],
"endpoint_scanning": "true|false",
"honeypot": [
{
"ip_address": "",
"network_id": "",
"version": "v4|v6"
}
],
"honeypot_enabled": "true|false",
"ips_mode": "ids|ips|ipsInline|disabled",
"restrict_ip_addresses": "true|false",
"restrict_tor": "true|false",
"restrict_torrents": "true|false",
"restrict_ip_addresses": "true|false",
"suppression": {
"alerts": [
{
Expand All @@ -31,32 +58,5 @@
"value": ""
}
]
},
"dns_filtering": "true|false",
"dns_filters": [
{
"name": "",
"description": "",
"filter": "none|work|family",
"network_id": "",
"version": "v4|v6",
"allowed_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_tld": [
"^[a-zA-Z0-9.-]+$|^$"
]
}
],
"honeypot_enabled": "true|false",
"honeypot": [
{
"network_id": "",
"ip_address": "",
"version": "v4|v6"
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"brightness": "[1-9]|[1-9][0-9]|100",
"enabled": "true|false",
"idle_timeout": "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600",
"sync": "true|false",
"touch_event": "true|false",
"brightness": "[1-9]|[1-9][0-9]|100",
"idle_timeout": "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600"
}
"touch_event": "true|false"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"timezone": ""
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"advanced_feature_enabled": "true|false",
"alert_enabled": "true|false",
"auto_upgrade": "true|false",
"boot_sound": "true|false",
"led_enabled": "true|false",
"advanced_feature_enabled": "true|false",
"outdoor_mode_enabled": "true|false",
"unifi_idp_enabled": "true|false",
"wifiman_enabled": "true|false",
"x_mgmt_key": "[0-9a-f]{32}",
"x_ssh_auth_password_enabled": "true|false",
"x_ssh_bind_wildcard": "true|false",
"x_ssh_enabled": "true|false",
"x_ssh_keys": [
""
],
"x_ssh_username": "^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$",
"x_ssh_password": ".{1,128}",
"x_ssh_md5passwd": "",
"x_ssh_password": ".{1,128}",
"x_ssh_sha512passwd": "",
"x_ssh_enabled": "true|false",
"x_ssh_bind_wildcard": "true|false",
"x_ssh_auth_password_enabled": "true|false"
}
"x_ssh_username": "^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"enabled": "true|false"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"ntp_server_2": "",
"ntp_server_3": "",
"ntp_server_4": ""
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ugw3_wan2_enabled": "false|true"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"enabled": "false|true",
"download": "^[1-9][0-9]*$",
"enabled": "false|true",
"upload": "^[1-9][0-9]*$"
}
}
Loading

0 comments on commit 4ab4036

Please sign in to comment.