├── .gitattributes ├── .gitignore ├── Certificates └── README.adoc ├── Documentation ├── README.adoc ├── REST API │ ├── Config - Download Configuration.adoc │ ├── Config - Restore Configuration.adoc │ ├── Data - DHCP Leases.adoc │ ├── Data - DHCP Statistics.adoc │ ├── Data - Default Configuration Status.adoc │ ├── Data - Firewall Statistics.adoc │ ├── Data - NAT Statistics.adoc │ ├── Data - Routes.adoc │ ├── Data - System Information.adoc │ ├── General - Authenticate.adoc │ ├── General - Configuration Settings Batch.adoc │ ├── General - Configuration Settings Delete.adoc │ ├── General - Configuration Settings Get Predefined List.adoc │ ├── General - Configuration Settings Get Sections.adoc │ ├── General - Configuration Settings Get Tree.adoc │ ├── General - Configuration Settings Set.adoc │ ├── General - Get Data.adoc │ ├── General - Session Heartbeat.adoc │ ├── General - Upgrade Firmware.adoc │ ├── General - Wizard Feature.adoc │ ├── General - Wizard Setup.adoc │ ├── ONU - Generate Support File.adoc │ ├── ONU - Reboot.adoc │ ├── Operation - Check For Firmware Updates.adoc │ ├── Operation - Clear Traffic Analysis.adoc │ ├── Operation - Factory Reset.adoc │ ├── Operation - Generate Support File.adoc │ ├── Operation - Reboot.adoc │ ├── Operation - Release DHCP Lease.adoc │ ├── Operation - Renew DHCP Lease.adoc │ ├── Operation - Reset Default Configuration.adoc │ ├── Operation - Shutdown.adoc │ ├── Wizard - List All Wizards.adoc │ ├── Wizard - Specific Wizard Create.adoc │ ├── Wizard - Specific Wizard Download.adoc │ ├── Wizard - Specific Wizard Remove.adoc │ └── Wizard - Specific Wizard Upload.adoc └── WebSocket API │ ├── Command Line Interface (CLI).adoc │ ├── JSON - Configuration Change.adoc │ ├── JSON - Device Discovery.adoc │ ├── JSON - Interfaces.adoc │ ├── JSON - Number Of Routes.adoc │ ├── JSON - System Statistics.adoc │ ├── JSON - Traffic Analysis.adoc │ ├── JSON - UDAPI Statistics.adoc │ ├── JSON - Users.adoc │ ├── README.adoc │ ├── Raw - Bandwidth Test.adoc │ ├── Raw - Firewall Statistics.adoc │ ├── Raw - Log Feed.adoc │ ├── Raw - NAT Statistics.adoc │ ├── Raw - Packet Capture.adoc │ ├── Raw - Ping.adoc │ ├── Raw - Port Forwarding Statistics.adoc │ ├── Raw - Traceroute.adoc │ └── Statistics.adoc ├── EdgeOS.API ├── EdgeOS.API.csproj ├── FrameReassembler.cs ├── Properties │ └── AssemblyInfo.cs ├── ServerCertificateValidationCallback.cs ├── StatsConnection.cs ├── SubscriptionDataEvent.cs ├── Types │ ├── Configuration │ │ ├── Configuration.cs │ │ ├── ConfigurationBool.cs │ │ ├── Firewall.cs │ │ └── Firewall │ │ │ ├── FirewallGroup.cs │ │ │ └── Group │ │ │ └── AddressGroupEntry.cs │ ├── PingRequest.cs │ ├── REST │ │ ├── AuthenticateResponse.cs │ │ ├── ConfigurationDownloadPrepareResponse.cs │ │ ├── ConfigurationResponse.cs │ │ ├── ConfigurationSettingsBatchRequest.cs │ │ ├── ConfigurationSettingsBatchResponse.cs │ │ ├── ConfigurationSettingsDeleteResponse.cs │ │ ├── ConfigurationSettingsGetResponse.cs │ │ ├── ConfigurationSettingsGetTreeResponse.cs │ │ ├── ConfigurationSettingsSetResponse.cs │ │ ├── ConfigurationSettingsStatus.cs │ │ ├── DataDHCPLeasesResponse.cs │ │ ├── DataDHCPStatisticsResponse.cs │ │ ├── DataDefaultConfigurationStatusResponse.cs │ │ ├── DataFirewallStatisticsResponse.cs │ │ ├── DataNATStatisticsResponse.cs │ │ ├── DataRoutesResponse.cs │ │ ├── DataSystemInformationResponse.cs │ │ ├── ONURebootResponse.cs │ │ ├── OperationResponse.cs │ │ ├── OperationStatus.cs │ │ ├── OperationSupportFileDownloadPrepareResponse.cs │ │ └── UpgradeResponse.cs │ └── Subscription │ │ ├── Requests │ │ ├── ConsoleSubscription.cs │ │ ├── ConsoleSubscriptions │ │ │ ├── BandwidthTestClient.cs │ │ │ ├── BandwidthTestServer.cs │ │ │ ├── FirewallStatistics.cs │ │ │ ├── PacketCaptureFeed.cs │ │ │ ├── PingSubscription.cs │ │ │ └── TracertSubscription.cs │ │ ├── Subscription.cs │ │ ├── SubscriptionMessageType.cs │ │ └── SubscriptionRequest.cs │ │ └── Responses │ │ ├── ConfigurationChangeResponse.cs │ │ ├── ConsoleResponse.cs │ │ ├── DiscoverResponse.cs │ │ ├── IResponse.cs │ │ ├── InterfacesResponse.cs │ │ ├── NumberOfRoutesResponse.cs │ │ ├── SystemStatsResponse.cs │ │ ├── TrafficAnalysisResponse.cs │ │ ├── UDAPIStatisticsResponse.cs │ │ ├── UDAPITypes │ │ ├── CPU.cs │ │ ├── Device.cs │ │ ├── FanSpeed.cs │ │ ├── Interface.cs │ │ ├── InterfaceSFPStats.cs │ │ ├── InterfaceStats.cs │ │ ├── Power.cs │ │ ├── RAM.cs │ │ ├── Storage.cs │ │ ├── Temperature.cs │ │ └── UDAPIStatistics.cs │ │ └── UserResponse.cs ├── WebClient.cs └── packages.config ├── EdgeOS.sln ├── Examples ├── ConfigurationTreeWalker │ ├── ConfigurationTreeWalker.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── InterfacesChart │ ├── App.ico │ ├── Credits.txt │ ├── InterfacesChart.Designer.cs │ ├── InterfacesChart.cs │ ├── InterfacesChart.csproj │ ├── InterfacesChart.resx │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── Sample.config ├── LogFeed │ ├── LogFeed.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs └── WebClientDemo │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── WebClientDemo.csproj ├── README.md ├── Resources ├── Endpoint URLs.txt ├── ITQ Sample │ ├── WebSockets.zip │ └── Websockets.txt ├── REST Endpoint URLs.txt ├── Useful URLs.txt └── Windows UWP Sample │ ├── WebSocket_sample.txt │ └── WebSocket_sample.zip └── ToDo.adoc /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2015-2019 cache/options directory. 2 | .vs 3 | 4 | # The packages folder can be ignored because of NuGet Package Restore. 5 | /[Pp]ackages/ 6 | 7 | # Build results 8 | [Dd]ebug/ 9 | [Rr]elease/ 10 | [Oo]bj/ 11 | 12 | # User-specific files 13 | *.user 14 | 15 | # Sensitive config files. 16 | App.config 17 | 18 | # Copyrighted extracted files. 19 | /Resources/Web UI Extract/ 20 | 21 | # Extracted version of the ZIP file. 22 | /Resources/Windows UWP Sample/WebSocket_sample/ 23 | 24 | # Certificate files do not belong in Git. 25 | /Certificates/*.crt -------------------------------------------------------------------------------- /Certificates/README.adoc: -------------------------------------------------------------------------------- 1 | = Certificates Folder = 2 | :toc: 3 | 4 | == Introduction == 5 | 6 | The Examples projects all have a post-build task to run `xcopy "$(SolutionDir)Certificates\*.crt" "$(TargetDir)" /Y /D` on a successful build so that your router's self-signed certificate can be trusted. 7 | 8 | == Usage == 9 | 10 | The library itself when the function(s) are called to `AllowLocalCertificates()` will look for a file with the `%hostname%`.crt (with any `-` or `.` characters removed) to perform certificate validation. 11 | 12 | Should the certificate already be valid there is no need to place a certificate in this folder (unless you want to otherwise pin the validation to a specific certificate) and standard certificate validation occurs. 13 | 14 | == Obtaining Certificates == 15 | 16 | Visiting your router's web UI in your web-browser and using the functionality to save a website's certificate to a file will usually suffice in obtaining the public certificate for your router. 17 | 18 | This of course varies based off the browser you use but a helpful site for most common browsers is at : https://medium.com/@menakajain/export-download-ssl-certificate-from-server-site-url-bcfc41ea46a2 19 | 20 | WARNING: You will want to override the filename to have a `.crt` file extention not the default `.cer` as the library only looks for `.crt` ending filenames. -------------------------------------------------------------------------------- /Documentation/REST API/Config - Download Configuration.adoc: -------------------------------------------------------------------------------- 1 | = Config - Download Configuration 2 | :toc: preamble 3 | 4 | To download the configuration send a HTTP GET to `/api/edge/config/save.json` and then make an additional HTTP GET request to `/files/config/`. 5 | 6 | The saved temporary stored file will be deleted once the request has been made. 7 | 8 | == Response 9 | 10 | === Root 11 | 12 | [cols="1,1,1,2", options="header"] 13 | |=== 14 | |Name 15 | |Type 16 | |Values 17 | |Description 18 | 19 | |`CONFIG` 20 | |Object 21 | |`CONFIG` object 22 | |The saved configuration information. 23 | 24 | |`success` 25 | |Boolean 26 | |`true` or `false` 27 | |Whether the API request was successful. 28 | |=== 29 | 30 | === `CONFIG` Object 31 | 32 | [cols="1,1,1,2", options="header"] 33 | |=== 34 | |Name 35 | |Type 36 | |Values 37 | |Description 38 | 39 | |`success` 40 | |String 41 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 42 | |Whether the configuration save was successful. 43 | 44 | |`path` 45 | |String 46 | |File path (e.g. `/tmp/sysd-save.ycYPpL`) 47 | |A temporary file path on the local device where the configuration was saved. 48 | |=== 49 | 50 | == Examples 51 | 52 | === Successful Save Response 53 | 54 | .GET */api/edge/config/save.json* Response 55 | [source,json] 56 | ---- 57 | {"CONFIG": {"success": "1", "path": "/tmp/sysd-save.ycYPpL"}, "success": true} 58 | ---- 59 | -------------------------------------------------------------------------------- /Documentation/REST API/Config - Restore Configuration.adoc: -------------------------------------------------------------------------------- 1 | = Config - Restore Configuration 2 | :toc: preamble 3 | 4 | To restore the configuration send a HTTP POST to `/api/edge/config/restore.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=*X-CSRF-Token*` as a `multipart/form-data` request with the `qqfile` key containing a valid `.tar.gz` configuration file. 5 | 6 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 7 | 8 | It does not support a HTTP GET. 9 | 10 | == Request 11 | 12 | === Request Querystring 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`header` 22 | |String 23 | |`text/html` 24 | |Unknown hard-coded value. 25 | 26 | |`noraw` 27 | |Number 28 | |`1` 29 | |Unknown hard-coded value. 30 | 31 | |`X-CSRF-TOKEN` 32 | |String 33 | |A 256-bit hexadecimal CSRF token 34 | |The Cross-Site Request Forgery (CSRF) token from a cookie set during login. 35 | |=== 36 | 37 | === Request Content 38 | 39 | [cols="1,1,1,2", options="header"] 40 | |=== 41 | |Name 42 | |Type 43 | |Values 44 | |Description 45 | 46 | |`qqfile` 47 | |String 48 | |Configuration file 49 | |The configuration to restore. 50 | |=== 51 | 52 | == Response 53 | 54 | === Root 55 | 56 | [cols="1,1,1,2", options="header"] 57 | |=== 58 | |Name 59 | |Type 60 | |Values 61 | |Description 62 | 63 | |`errors` (Optional) 64 | |Array (String) 65 | |Array of `errors` 66 | |An array of the errors that occurred. 67 | 68 | |`success` 69 | |Boolean 70 | |`true` or `false` 71 | |Whether the API request was successful. 72 | |=== 73 | 74 | == Examples 75 | 76 | === Bad File Example 77 | 78 | .POST */api/edge/config/restore.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=e3117c58b702c42f8b928b350b1660abff886f7d7d44735a6ae4a8bb6fefc66b* Request 79 | [source,http] 80 | ---- 81 | -----------------------------339514711711515864301518031004 82 | Content-Disposition: form-data; name="qqfile"; filename="BadConfigurationFile.bin" 83 | Content-Type: application/octet-stream 84 | 85 | I am a BadConfigurationFile. 86 | -----------------------------339514711711515864301518031004-- 87 | ---- 88 | 89 | .POST */api/edge/config/restore.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=e3117c58b702c42f8b928b350b1660abff886f7d7d44735a6ae4a8bb6fefc66b* Response 90 | [source,json] 91 | ---- 92 | {"errors": ["CONFIG request failed"], "success": false} 93 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - DHCP Leases.adoc: -------------------------------------------------------------------------------- 1 | = Data - DHCP Leases 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=dhcp_leases` can be used to get a JSON formatted list of DHCP leases. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The output to the data request. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`dhcp-server-leases` 38 | |Dictionary 39 | |`dhcp-server-leases` object(s) 40 | |A dictionary that contains each of the DHCP servers and their leases. 41 | |=== 42 | 43 | === `dhcp-server-leases` Object 44 | 45 | [cols="1,1,1,2", options="header"] 46 | |=== 47 | |Name 48 | |Type 49 | |Values 50 | |Description 51 | 52 | |Key 53 | |String 54 | |The unique name of a particular DHCP server (e.g. `LAN1`) 55 | |A property that represents the unique DHCP server name. 56 | 57 | |Value 58 | |Object or empty string 59 | |`leases` object 60 | |An object that represents a particular DHCP server's leases. 61 | |=== 62 | 63 | === `leases` Object 64 | 65 | [cols="1,1,1,2", options="header"] 66 | |=== 67 | |Name 68 | |Type 69 | |Values 70 | |Description 71 | 72 | |Key 73 | |String 74 | |The IP address of a specific lease (e.g. `192.168.0.180`) 75 | |A property that represents a specific DHCP lease. 76 | 77 | |Value 78 | |Object or empty string 79 | |`lease-details` object 80 | |An object that represents a particular DHCP server lease. 81 | |=== 82 | 83 | === `lease-details` Object 84 | 85 | [cols="1,1,1,2", options="header"] 86 | |=== 87 | |Name 88 | |Type 89 | |Values 90 | |Description 91 | 92 | |`expiration` 93 | |String 94 | |A date in `YYYY/MM/DD HH:mm:ss` format 95 | |The date of a specific lease expiry. 96 | 97 | |`pool` 98 | |String 99 | |DHCP pool name (e.g. `LAN1`) 100 | |The pool this lease corresponds to (appears to be a repetition of the DHCP server name). 101 | 102 | |`mac` 103 | |String 104 | |MAC Address (e.g. `FF:FF:FF:FF:FF:01`) 105 | |The MAC address of this particular DHCP server lease. 106 | 107 | |`client-hostname` 108 | |String 109 | |Client supplied hostname 110 | |The client supplied hostname for a DHCP server lease. 111 | |=== 112 | 113 | == Examples 114 | 115 | === Successful Response 116 | 117 | .GET */api/edge/data.json?data=dhcp_leases* Response 118 | [source,json] 119 | ---- 120 | {"success": "1", "output": {"dhcp-server-leases": {"LAN2": "", "LAN1": {"192.168.0.180": {"expiration": "2020/06/08 13:07:17", "pool": "LAN1", "mac": "xx:xx:xx:xx:xx:xx", "client-hostname": "Versa"}, "192.168.0.165": {"expiration": "2020/06/08 08:42:42", "pool": "LAN1", "mac": "xx:xx:xx:xx:xx:xx", "client-hostname": ""}, "192.168.0.104": {"expiration": "2020/06/07 16:19:20", "pool": "LAN1", "mac": "xx:xx:xx:xx:xx:xx", "client-hostname": "andys-6s"}}}}} 121 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - DHCP Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Data - DHCP Statistics 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=dhcp_stats` can be used to get a JSON formatted list of DHCP statistics. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The output to the data request. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`dhcp-server-stats` 38 | |Dictionary 39 | |`dhcp-server-stats` object(s) 40 | |A dictionary that contains each of the DHCP servers and their pool statistics. 41 | |=== 42 | 43 | === `dhcp-server-stats` Object 44 | 45 | [cols="1,1,1,2", options="header"] 46 | |=== 47 | |Name 48 | |Type 49 | |Values 50 | |Description 51 | 52 | |Key 53 | |String 54 | |The unique name of a particular DHCP server (e.g. `LAN1`) 55 | |A property that represents the unique DHCP server name. 56 | 57 | |Value 58 | |Object or empty string 59 | |`pool-stats` object 60 | |An object that represents a particular DHCP server's pool statistics. 61 | |=== 62 | 63 | === `pool-stats` Object 64 | 65 | [cols="1,1,1,2", options="header"] 66 | |=== 67 | |Name 68 | |Type 69 | |Values 70 | |Description 71 | 72 | |`pool_size` 73 | |String 74 | |A number encapsulated in a string (e.g. `"253"`) 75 | |The total size of the dynamic DHCP pool. 76 | 77 | |`leased` 78 | |String 79 | |A number encapsulated in a string (e.g. `"1"`) 80 | |The number of dynamically leased addresses. 81 | 82 | |`available` 83 | |String 84 | |A number encapsulated in a string (e.g. `"252"`) 85 | |The number of remaining available addresses in the dynamic DHCP pool. 86 | |=== 87 | 88 | == Examples 89 | 90 | === Successful Response 91 | 92 | .GET */api/edge/data.json?data=dhcp_status* Response 93 | [source,json] 94 | ---- 95 | {"success": "1", "output": {"dhcp-server-stats": {"LAN2": {"pool_size": "253", "leased": "0", "available": "253"}, "LAN1": {"pool_size": "253", "leased": "3", "available": "250"}}}} 96 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - Default Configuration Status.adoc: -------------------------------------------------------------------------------- 1 | = Data - Default Configuration Status 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=default_config` obtains information on whether the device is operating with no user supplied configuration. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The status of the configuration. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`is_default` 38 | |String 39 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 40 | |Whether the device is running the factory default configuration. 41 | |=== 42 | 43 | == Examples 44 | 45 | === Device Already Configured Response 46 | 47 | .GET */api/edge/data.json?data=default_config* Response 48 | [source,json] 49 | ---- 50 | {"success": "1", "output": {"is_default": "0"}} 51 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - Firewall Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Data - Firewall Statistics 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=fw_stats` can be used to get a JSON formatted list of firewall statistics. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The output to the data request. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`name` 38 | |Array of Dictionary 39 | |`firewall-ruleset-stats` object(s) 40 | |An array of dictionary items of `firewall-ruleset-stats` objects that contains each of the IPv4 firewall rulesets and their rule statistics. 41 | 42 | |`ipv6-name` (Optional) 43 | |Array of Dictionary 44 | |`firewall-ruleset-stats` object(s) 45 | |An array of dictionary items of `firewall-ruleset-stats` objects that contains each of the IPv6 firewall rulesets and their rule statistics. 46 | |=== 47 | 48 | === `firewall-ruleset-stats` Object 49 | 50 | [cols="1,1,1,2", options="header"] 51 | |=== 52 | |Name 53 | |Type 54 | |Values 55 | |Description 56 | 57 | |Key 58 | |String 59 | |The unique name of a particular firewall ruleset (e.g. `WAN_IN`) 60 | |A property that represents the unique firewall ruleset name. 61 | 62 | |Value 63 | |Array (Object) 64 | |Array of `firewall-rule-stats` 65 | |An object that represents a particular firewall rule's statistics. 66 | |=== 67 | 68 | === `firewall-rule-stats` Object 69 | 70 | [cols="1,1,1,2", options="header"] 71 | |=== 72 | |Name 73 | |Type 74 | |Values 75 | |Description 76 | 77 | |`rule` 78 | |String 79 | |A number encapsulated in a string (e.g. `"10"`) 80 | |The rule number for this particular firewall entry. 81 | 82 | |`pkts` 83 | |String 84 | |A number encapsulated in a string (e.g. `"36837"`) 85 | |The number of packets that this firewall rule has matched. 86 | 87 | |`bytes` 88 | |String 89 | |A number encapsulated in a string (e.g. `"6953322"`) 90 | |The number of bytes that this firewall rule has matched. 91 | |=== 92 | 93 | == Examples 94 | 95 | === Successful Response 96 | 97 | .GET */api/edge/data.json?data=fw_stats* Response 98 | [source,json] 99 | ---- 100 | {"success": "1", "output": {"name": [{"WAN_IN": [{"rule": "10", "pkts": "36837", "bytes": "6953322"}, {"rule": "20", "pkts": "0", "bytes": "0"}, {"rule": "21", "pkts": "3", "bytes": "184"}, {"rule": "22", "pkts": "0", "bytes": "0"}, {"rule": "10000", "pkts": "0", "bytes": "0"}], "WAN_LOCAL": [{"rule": "10", "pkts": "3875", "bytes": "589011"}, {"rule": "20", "pkts": "342", "bytes": "21329"}, {"rule": "10000", "pkts": "3236", "bytes": "262149"}]}]}} 101 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - NAT Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Data - Network Address Translation (NAT) Statistics 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=nat_stats` can be used to get a JSON formatted list of Network Address Translation (NAT) statistics. This appears to be legacy and not used in recent releases. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The output to the data request. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | |=== 37 | 38 | == Examples 39 | 40 | === Successful Response 41 | 42 | .GET */api/edge/data.json?data=nat_stats* Response 43 | [source,json] 44 | ---- 45 | {"success": "1", "output": {}} 46 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - Routes.adoc: -------------------------------------------------------------------------------- 1 | = Data - Routes 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=routes` obtains route information. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Array (Object) 24 | |Array of `route` 25 | |The output to the data request. 26 | |=== 27 | 28 | === `route` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`pfx` 38 | |String 39 | |String 40 | |The route prefix. 41 | 42 | |`nh` 43 | |Array (Object) 44 | |`nh` Object(s) 45 | |The route next hop information. 46 | |=== 47 | 48 | === `nh` Object 49 | 50 | [cols="1,1,1,2", options="header"] 51 | |=== 52 | |Name 53 | |Type 54 | |Values 55 | |Description 56 | 57 | |`t` 58 | |String 59 | |String 60 | |The type (in the format `route-type`, `Selected`, `FIB` e.g. `S>*`). 61 | 62 | |`metric` 63 | |String 64 | |String 65 | |The metric information. 66 | 67 | |`bh` (Optional) 68 | |String 69 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 70 | |Whether this interface is a blackhole. 71 | 72 | |`via` (Optional) 73 | |String 74 | |String 75 | |The next hop address information. 76 | 77 | |`intf` (Optional) 78 | |String 79 | |String 80 | |The next hop interface. 81 | |=== 82 | 83 | === `route-type` Types 84 | 85 | [cols="1,1,2", options="header"] 86 | |=== 87 | |Name 88 | |Type 89 | |Description 90 | 91 | |`S` 92 | |Static 93 | |A static route (used by `blackhole`, `interface`, `gateway`). 94 | 95 | |`C` 96 | |`connected` 97 | |Connected route. 98 | 99 | |`O` 100 | |`ospf` 101 | |Connected OSPF route. 102 | 103 | |`R` 104 | |`rip` 105 | |Connected RIP route. 106 | 107 | |`K` 108 | |`kernel` 109 | |Connected Kernel route. 110 | |=== 111 | 112 | === `Selected` Types 113 | 114 | [cols="1,1,2", options="header"] 115 | |=== 116 | |Name 117 | |Type 118 | |Description 119 | 120 | |`>` 121 | |Selected 122 | |The route is able to be used. 123 | 124 | | 125 | |Not Selected 126 | |The route is not able to be used (but is in the config file). 127 | |=== 128 | 129 | === `FIB` Types 130 | 131 | [cols="1,1,2", options="header"] 132 | |=== 133 | |Name 134 | |Type 135 | |Description 136 | 137 | |`*` 138 | |In FIB 139 | |The route is in the Forwarding Information Base (FIB). 140 | 141 | | 142 | |Not In FIB 143 | |The route is not in the Forwarding Information Base (FIB). 144 | |=== 145 | 146 | == Examples 147 | 148 | === Successful Response 149 | 150 | .GET */api/edge/data.json?data=routes* Response 151 | [source,json] 152 | ---- 153 | {"success": "1", "output": [{"pfx": "0.0.0.0/0", "nh": [{"t": "S>*", "metric": "210/0", "via": "xxx.xxx.xxx.xxx", "intf": "eth0"}]}, {"pfx": "xxx.xxx.xxx.xxx/21", "nh": [{"t": "C>*", "intf": "eth0"}]}, {"pfx": "127.0.0.0/8", "nh": [{"t": "C>*", "intf": "lo"}]}, {"pfx": "192.168.0.0/24", "nh": [{"t": "C>*", "intf": "eth1"}]}]} 154 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Data - System Information.adoc: -------------------------------------------------------------------------------- 1 | = Data - System Information 2 | :toc: preamble 3 | 4 | A HTTP GET to `/api/edge/data.json?data=sys_info` obtains basic system information. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`success` 18 | |String 19 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 20 | |Whether the API request was successful. 21 | 22 | |`output` 23 | |Object 24 | |`output` object 25 | |The output to the data request. 26 | |=== 27 | 28 | === `output` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`sw_ver` 38 | |String 39 | |String 40 | |The installed software version. 41 | 42 | |`unms` 43 | |Object 44 | |`unms` Object 45 | |The UNMS status information. 46 | 47 | |`fw-latest` 48 | |Object 49 | |`fw-latest` Object 50 | |The latest known firmware information. 51 | |=== 52 | 53 | === `unms` Object 54 | 55 | [cols="1,1,1,2", options="header"] 56 | |=== 57 | |Name 58 | |Type 59 | |Values 60 | |Description 61 | 62 | |`daemon` 63 | |String 64 | |`Running` or `Not running` 65 | |The UNMS daemon status. 66 | 67 | |`status` 68 | |Empty String 69 | | 70 | |The UNMS status information. 71 | 72 | |`last` 73 | |Empty String 74 | | 75 | |The time the UNMS' status was last updated. 76 | |=== 77 | 78 | === `fw-latest` Object 79 | 80 | [cols="1,1,1,2", options="header"] 81 | |=== 82 | |Name 83 | |Type 84 | |Values 85 | |Description 86 | 87 | |`version` 88 | |String 89 | |Firmware Version 90 | |The latest software version available online. 91 | 92 | |`url` 93 | |String 94 | |URL 95 | |The URL to download the latest firmware from. 96 | 97 | |`md5` 98 | |String 99 | |MD5 Hash 100 | |The MD5 hash of the latest firmware. 101 | 102 | |`state` 103 | |String 104 | |`up-to-date`, `can-upgrade`, `downloading`, `upgrading` or `reboot-needed` 105 | |The firmware upgrade status information. 106 | |=== 107 | 108 | == Examples 109 | 110 | === Successful Response 111 | 112 | .GET */api/edge/data.json?data=sys_info* Response 113 | [source,json] 114 | ---- 115 | {"success": "1", "output": {"sw_ver": "EdgeRouter.ER-e300.v2.0.9-beta.3.5296219.200507.1538", "unms": {"daemon": "Not running", "status": "", "last": ""}, "fw-latest": {"version": "v2.0.8-hotfix.1", "url": "https://fw-download.ubnt.com/data/e300/669e-edgerouter-2.0.8-hotfix.1-752ed9f0476a4cb3adcce84ec537b228.tar", "md5": "d4b30e3821621f16f6e960d753eaf073", "state": "up-to-date"}}} 116 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Authenticate.adoc: -------------------------------------------------------------------------------- 1 | = General - Authenticate 2 | :toc: preamble 3 | 4 | A HTTP POST to `/api/edge/auth.json` will create a session on the device, however this method is designed to be used internally (and *is* used internally by the login form), so it does not expose any session ID headers useful for validating login status but does pass it to the internal code. 5 | 6 | == Request 7 | 8 | A HTTP POST to `\https://host-or-ip/` with the username and password encoded as a simple `application/x-www-form-urlencoded` form. 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`username` 18 | |String 19 | |String 20 | |The username of a user. 21 | 22 | |`password` 23 | |String 24 | |String 25 | |The password of a user. 26 | |=== 27 | 28 | == Response 29 | 30 | === Root 31 | 32 | [cols="1,1,1,2", options="header"] 33 | |=== 34 | |Name 35 | |Type 36 | |Values 37 | |Description 38 | 39 | |`success` 40 | |String 41 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 42 | |Whether the API request was successful. 43 | 44 | |`error` (Optional) 45 | |String 46 | |An error message (e.g. `"The username or password you entered is incorrect"`) 47 | |The error that occurred while trying to process this authentication request. 48 | 49 | |`level` 50 | |String 51 | |`"admin"` or `"operator"` 52 | |A value that represents the role / privilege level of the authenticated user. 53 | 54 | |`started` 55 | |String 56 | |A number encapsulated in a string (e.g. `"1513"`) 57 | |Device uptime in seconds. 58 | 59 | |`default-config` 60 | |String 61 | |A boolean encapsulated in a string (e.g. `"false"` or `"true"`) 62 | |Whether the device is running the factory default configuration. 63 | 64 | |`platform` 65 | |Object 66 | |`platform` object 67 | |Contains information about the current device capabilities. 68 | |=== 69 | 70 | === `platform` Object 71 | 72 | [cols="1,1,1,2", options="header"] 73 | |=== 74 | |Name 75 | |Type 76 | |Values 77 | |Description 78 | 79 | |`model` 80 | |String 81 | |A model name (e.g. `"ER-4"`) 82 | |A string that represents a device model from `devices.json`. 83 | 84 | |`poe_cap` 85 | |Dictionary 86 | |`poe_cap` object(s) 87 | |A dictionary that represents the device Power over Ethernet (PoE) capabilities. 88 | |=== 89 | 90 | === `poe_cap` Object 91 | 92 | [cols="1,1,1,2", options="header"] 93 | |=== 94 | |Name 95 | |Type 96 | |Values 97 | |Description 98 | 99 | |Key 100 | |String 101 | |An interface name (e.g. `"eth0"`) 102 | |The unique name of a physical interface. 103 | 104 | |Value 105 | |String 106 | |A signed numeric value encapsulated in a string (e.g. `"1"`, `"0"` or `"-1"`) 107 | |The Power over Ethernet (PoE) capabilities of a specific physical interface. 108 | |=== 109 | 110 | == Examples 111 | 112 | === Valid Login 113 | 114 | 115 | .POST */api/edge/auth.json* Request 116 | [source,subs="+quotes"] 117 | ---- 118 | username=*USERNAME*&password=*PASSWORD* 119 | ---- 120 | 121 | .POST */api/edge/auth.json* Response 122 | [source,json] 123 | ---- 124 | {"success": "1", "level": "admin", "started": "1513", "default-config": "false", "platform": {"model": "ER-4", "poe_cap": {"eth0": "0", "eth1": "0", "eth2": "0", "eth3": "0", "eth4": "-1"}}} 125 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Configuration Settings Batch.adoc: -------------------------------------------------------------------------------- 1 | = General - Configuration Settings Batch 2 | :toc: preamble 3 | 4 | The `/api/edge/batch.json` endpoint allows you to make batch queries/deletions/updates to specific parts of the device's configuration. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Request 11 | 12 | === Root 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`SET` (Optional) 22 | |Object 23 | |JSON configuration 24 | |The JSON configuration attributes to set. 25 | 26 | |`DELETE` (Optional) 27 | |Object 28 | |JSON configuration 29 | |The JSON configuration attributes to delete. 30 | 31 | |`GET` (Optional) 32 | |Object 33 | |JSON configuration 34 | |The JSON configuration attributes to get. 35 | |=== 36 | 37 | == Response 38 | 39 | === Root 40 | 41 | [cols="1,1,1,2", options="header"] 42 | |=== 43 | |Name 44 | |Type 45 | |Values 46 | |Description 47 | 48 | |`SET` 49 | |Object 50 | |`status` object 51 | |An object that contains status values for the set request. 52 | 53 | |`DELETE` 54 | |Object 55 | |`status` object 56 | |An object that contains status values for the deletion request. 57 | 58 | |`SESSION_ID` 59 | |String 60 | |A session ID 61 | |The authorisation string for this session that confirms the user is correctly authenticated. 62 | 63 | |`GET` 64 | |String 65 | |JSON configuration 66 | |The requested section of the configuration after the operation is performed (defaults to the requested section for deletion/setting by default). 67 | 68 | |`COMMIT` 69 | |Object 70 | |`status` object 71 | |An object that contains status values for the configuration commit request. 72 | 73 | |`SAVE` 74 | |Object 75 | |`status` object 76 | |An object that contains status values for the configuration save request. 77 | 78 | |`success` 79 | |Boolean 80 | |`true` or `false` 81 | |Whether the API request was successful. 82 | |=== 83 | 84 | === `status` Object 85 | 86 | [cols="1,1,1,2", options="header"] 87 | |=== 88 | |Name 89 | |Type 90 | |Values 91 | |Description 92 | 93 | |`failure` (Optional) 94 | |String 95 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 96 | |Whether the operation failed. 97 | 98 | |`success` 99 | |String 100 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 101 | |Whether the configuration settings batch operation was successful. 102 | |=== 103 | 104 | == Examples 105 | 106 | === Set UNMS Hostname & Enable 107 | .POST */api/edge/batch.json* Request 108 | [source,json] 109 | ---- 110 | { 111 | "SET":{"system":{"host-name":""},"service":{"unms":{"disable":null}}}, 112 | "GET":{"system":null,"service":null} 113 | } 114 | ---- 115 | 116 | .POST */api/edge/batch.json* Response 117 | [source,json,subs="+quotes"] 118 | ---- 119 | { 120 | "SET": {"failure": "0", "success": "1"}, 121 | "SESSION_ID": "session_id", 122 | "GET": { 123 | "system": { *system as json* }, 124 | "service": { *service as json* }, 125 | .... 126 | }, 127 | "COMMIT": {"failure": "0", "success": "1"}, 128 | "SAVE": {"success": "1"}, 129 | "success": true 130 | } 131 | ---- 132 | 133 | === Delete Custom Attribute 134 | 135 | .POST */api/edge/batch.json* Request 136 | [source,json] 137 | ---- 138 | {"DELETE":{"custom-attribute":null}} 139 | ---- 140 | 141 | .POST */api/edge/batch.json* Response 142 | [source,json,subs="+quotes"] 143 | ---- 144 | {"DELETE": {"failure": "0", "success": "1"}, "SESSION_ID": "742dfcc13b8d449aa36a4a1847bfcef7", "GET": { .. Configuration .. }, "COMMIT": {"failure": "0", "success": "1"}, "SAVE": {"success": "1"}, "success": true} 145 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Configuration Settings Delete.adoc: -------------------------------------------------------------------------------- 1 | = General - Configuration Settings Delete 2 | :toc: preamble 3 | 4 | The `/api/edge/delete.json` endpoint allows you to delete a specific part of the device's configuration. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Request 11 | 12 | A HTTP POST to `/api/edge/delete.json` with the JSON configuration attributes to delete as the request content. 13 | 14 | == Response 15 | 16 | === Root 17 | 18 | [cols="1,1,1,2", options="header"] 19 | |=== 20 | |Name 21 | |Type 22 | |Values 23 | |Description 24 | 25 | |`DELETE` 26 | |Object 27 | |`status` object 28 | |An object that contains status values for the deletion request. 29 | 30 | |`SESSION_ID` 31 | |String 32 | |A session ID 33 | |The authorisation string for this session that confirms the user is correctly authenticated. 34 | 35 | |`GET` 36 | |String 37 | |JSON configuration 38 | |The parent section of the deleted value after the deletion. 39 | 40 | |`COMMIT` 41 | |Object 42 | |`status` object 43 | |An object that contains status values for the configuration commit request. 44 | 45 | |`SAVE` 46 | |Object 47 | |`status` object 48 | |An object that contains status values for the configuration save request. 49 | 50 | |`success` 51 | |Boolean 52 | |`true` or `false` 53 | |Whether the API request was successful. 54 | |=== 55 | 56 | === `status` Object 57 | 58 | [cols="1,1,1,2", options="header"] 59 | |=== 60 | |Name 61 | |Type 62 | |Values 63 | |Description 64 | 65 | |`failure` 66 | |String 67 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 68 | |Whether the operation failed. 69 | 70 | |`success` 71 | |String 72 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 73 | |Whether the configuration settings delete operation was successful. 74 | |=== 75 | 76 | == Examples 77 | 78 | === Custom Attribute Successful Deletion 79 | 80 | .POST */api/edge/delete.json* Request 81 | [source,json] 82 | ---- 83 | {"custom-attribute":{"hi":null}} 84 | ---- 85 | 86 | .POST */api/edge/delete.json* Response 87 | [source,json,subs="+quotes"] 88 | ---- 89 | {"DELETE": {"failure": "0", "success": "1"}, "SESSION_ID": "742dfcc13b8d449aa36a4a1847bfcef7", "GET": {"custom-attribute": ""}, "COMMIT": {"failure": "0", "success": "1"}, "SAVE": {"success": "1"}, "success": true} 90 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Configuration Settings Get Predefined List.adoc: -------------------------------------------------------------------------------- 1 | = General - Configuration Settings Get Predefined List 2 | 3 | A HTTP GET to `/api/edge/get.json` can be used to get a pre-defined JSON formatted dictionary containing the configuration (and the current `SESSION_ID`) of the following: 4 | 5 | * firewall 6 | * interfaces 7 | * layer2 8 | * service 9 | * system 10 | * vpn 11 | * protocols 12 | * traffic-control 13 | * onu-list 14 | * onu-profiles 15 | * onu-policies 16 | 17 | It is not possible to alter the returned list as it is hardcoded. -------------------------------------------------------------------------------- /Documentation/REST API/General - Configuration Settings Get Sections.adoc: -------------------------------------------------------------------------------- 1 | = General - Configuration Settings Get Sections 2 | :toc: preamble 3 | 4 | Used internally by the link:Config%20-%20Download%20Configuration.adoc[configuration download] and link:Operation%20-%20Generate%20Support%20File.adoc[generate support file] features to obtain the system section information `/api/edge/partial.json?struct={"system": null}` this allows you to access just a specific section of the configuration. 5 | 6 | To get the full configuration you can use `/api/edge/partial.json`, `/api/edge/partial.json?struct=null` or `/api/edge/partial.json?struct={}` 7 | 8 | == Request 9 | 10 | === Request Querystring 11 | 12 | [cols="1,1,1,2", options="header"] 13 | |=== 14 | |Name 15 | |Type 16 | |Values 17 | |Description 18 | 19 | |`struct` (Optional) 20 | |List (Object) 21 | |JSON configuration 22 | |The specific configuration sections requested. 23 | |=== 24 | 25 | == Response 26 | 27 | === Root 28 | 29 | [cols="1,1,1,2", options="header"] 30 | |=== 31 | |Name 32 | |Type 33 | |Values 34 | |Description 35 | 36 | |`SESSION_ID` 37 | |String 38 | |A session ID 39 | |The authorisation string for this session that confirms the user is correctly authenticated. 40 | 41 | |`GET` 42 | |String 43 | |JSON configuration 44 | |The requested parent section. 45 | 46 | |`success` 47 | |Boolean 48 | |`true` or `false` 49 | |Whether the API request was successful. 50 | |=== 51 | 52 | == Examples 53 | 54 | === Interfaces Example 55 | 56 | .GET */api/edge/partial.json?struct={"interfaces": null}* Response 57 | [source,json] 58 | ---- 59 | {"SESSION_ID": "742dfcc13b8d449aa36a4a1847bfcef7", "GET": {"interfaces": {"ethernet": {"eth0": {"address": ["dhcp"], "description": "WAN", "duplex": "auto", "firewall": {"in": {"name": "WAN_IN"}, "local": {"name": "WAN_LOCAL"}}, "speed": "auto"}, "eth1": {"address": ["192.168.0.254/24"], "description": "LAN", "duplex": "auto", "speed": "auto"}, "eth2": {"address": ["192.168.1.254/24"], "description": "LAN2", "duplex": "auto", "speed": "auto"}, "eth3": {"disable": null, "duplex": "auto", "speed": "auto"}}, "loopback": {"lo": null}}}, "success": true} 60 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Configuration Settings Set.adoc: -------------------------------------------------------------------------------- 1 | = General - Configuration Settings Set 2 | :toc: preamble 3 | 4 | The `/api/edge/set.json` endpoint allows you to set a specific part of the device's configuration. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Request 11 | 12 | A HTTP POST to `/api/edge/set.json` with the JSON configuration attributes to set as the request content. 13 | 14 | == Response 15 | 16 | === Root 17 | 18 | [cols="1,1,1,2", options="header"] 19 | |=== 20 | |Name 21 | |Type 22 | |Values 23 | |Description 24 | 25 | |`SET` 26 | |Object 27 | |`status` object 28 | |An object that contains status values for the set request. 29 | 30 | |`SESSION_ID` 31 | |String 32 | |A session ID 33 | |The authorisation string for this session that confirms the user is correctly authenticated. 34 | 35 | |`GET` 36 | |String 37 | |JSON configuration 38 | |The parent section of the set value after the set. 39 | 40 | |`COMMIT` 41 | |Object 42 | |`status` object 43 | |An object that contains status values for the configuration commit request. 44 | 45 | |`SAVE` 46 | |Object 47 | |`status` object 48 | |An object that contains status values for the configuration save request. 49 | 50 | |`success` 51 | |Boolean 52 | |`true` or `false` 53 | |Whether the API request was successful. 54 | |=== 55 | 56 | === `status` Object 57 | 58 | [cols="1,1,1,2", options="header"] 59 | |=== 60 | |Name 61 | |Type 62 | |Values 63 | |Description 64 | 65 | |`failure` 66 | |String 67 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 68 | |Whether the configuration settings set operation failed. 69 | 70 | |`success` 71 | |String 72 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 73 | |Whether the configuration settings set operation was successful. 74 | |=== 75 | 76 | == Examples 77 | 78 | === Custom Attribute Successful Set 79 | 80 | .POST */api/edge/set.json* Request 81 | [source,json] 82 | ---- 83 | {"custom-attribute":{"hi":null}} 84 | ---- 85 | 86 | .POST */api/edge/set.json* Response 87 | [source,json,subs="+quotes"] 88 | ---- 89 | {"SET": {"failure": "0", "success": "1"}, "SESSION_ID": "742dfcc13b8d449aa36a4a1847bfcef7", "GET": {"custom-attribute": {"hi": null}}, "COMMIT": {"failure": "0", "success": "1"}, "SAVE": {"success": "1"}, "success": true} 90 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Get Data.adoc: -------------------------------------------------------------------------------- 1 | = General - Get Data 2 | 3 | The `/api/edge/data.json` endpoint can query a variety of pre-defined statistics and data: 4 | 5 | [cols="1,1,2", options="header"] 6 | |=== 7 | |Name 8 | |Data String 9 | |Description 10 | 11 | |link:Data%20-%20Default%20Configuration%20Status.adoc[Default Configuration Status] 12 | |`default_config` 13 | |Whether the device is operating with no user supplied configuration. 14 | 15 | |link:Data%20-%20DHCP%20Leases.adoc[DHCP Leases] 16 | |`dhcp_leases` 17 | |Lists the current DHCP leases. 18 | 19 | |link:Data%20-%20DHCP%20Statistics.adoc[DHCP Statistics] 20 | |`dhcp_stats` 21 | |Lists the current DHCP usage statistics. 22 | 23 | |link:Data%20-%20Firewall%20Statistics.adoc[Firewall Statistics] 24 | |`fw_stats` 25 | |Lists the current Firewall statistics. 26 | 27 | |GPON ONU List 28 | |`gpon_onu_list` 29 | |Lists the Gigabit Passive Optical Networks (GPON) Optical Network Units (ONU). 30 | 31 | |link:Data%20-%20NAT%20Statistics.adoc[NAT Statistics] 32 | |`nat_stats` 33 | |Lists the current Network Address Translation (NAT) statistics. 34 | 35 | |link:Data%20-%20Routes.adoc[Routes] 36 | |`routes` 37 | |Lists the current route information. 38 | 39 | |link:Data%20-%20System%20Information.adoc[System Information] 40 | |`sys_info` 41 | |Lists the current system information. 42 | |=== -------------------------------------------------------------------------------- /Documentation/REST API/General - Session Heartbeat.adoc: -------------------------------------------------------------------------------- 1 | = General - Session Heartbeat 2 | :toc: preamble 3 | 4 | A session can be extended with a HTTP GET to `/api/edge/heartbeat.json`. 5 | 6 | The web UI includes an ignored `t` querystring parameter to prevent a browser or network device cache from preventing the remote connection from reaching the remote device. 7 | The URL format the web UI uses is `/api/edge/heartbeat.json?t=*epoch*` where `epoch` is the current time in Unix epoch notation (such as `1591537772865`). 8 | 9 | == Response 10 | 11 | === Root 12 | 13 | [cols="1,1,1,2", options="header"] 14 | |=== 15 | |Name 16 | |Type 17 | |Values 18 | |Description 19 | 20 | |`SESSION` 21 | |Boolean 22 | |`true` or `false` 23 | |Whether the user has a valid session. 24 | 25 | |`PING` 26 | |Boolean 27 | |`true` or `false` 28 | |Whether the ping heartbeat extension was successful. 29 | |=== 30 | 31 | == Examples 32 | 33 | === Successful Ping Request Response 34 | 35 | .POST */api/edge/heartbeat.json?t=1591537772865* Response 36 | [source,json,subs="+quotes"] 37 | ---- 38 | {"SESSION": true, "PING": true} 39 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Upgrade Firmware.adoc: -------------------------------------------------------------------------------- 1 | = General - Upgrade Firmware 2 | :toc: preamble 3 | 4 | To upgrade the device firmware send a HTTP POST to `/api/edge/upgrade.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=*X-CSRF-Token*` as a `multipart/form-data` request with the `qqfile` key containing a valid `.tar` firmware file. 5 | 6 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 7 | 8 | It does not support a HTTP GET. 9 | 10 | == Request 11 | 12 | === Request Querystring 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`header` 22 | |String 23 | |`text/html` 24 | |Unknown hard-coded value. 25 | 26 | |`noraw` 27 | |Number 28 | |`1` 29 | |Unknown hard-coded value. 30 | 31 | |`X-CSRF-TOKEN` 32 | |String 33 | |A 256-bit hexadecimal CSRF token 34 | |The Cross-Site Request Forgery (CSRF) token from a cookie set during login. 35 | |=== 36 | 37 | === Request Content 38 | 39 | [cols="1,1,1,2", options="header"] 40 | |=== 41 | |Name 42 | |Type 43 | |Values 44 | |Description 45 | 46 | |`qqfile` 47 | |String 48 | |Firmware file 49 | |The firmware update file to flash. 50 | |=== 51 | 52 | == Response 53 | 54 | === Root 55 | 56 | [cols="1,1,1,2", options="header"] 57 | |=== 58 | |Name 59 | |Type 60 | |Values 61 | |Description 62 | 63 | |`UPGRADE` 64 | |Object 65 | |`UPGRADE` object 66 | |The upgrade result information. 67 | 68 | |`errors` (Optional) 69 | |Array (String) 70 | |Array of `errors` 71 | |An array of the errors that occurred. 72 | 73 | |`success` 74 | |Boolean 75 | |`true` or `false` 76 | |Whether the API request was successful. 77 | |=== 78 | 79 | === `UPGRADE` Object 80 | 81 | [cols="1,1,1,2", options="header"] 82 | |=== 83 | |Name 84 | |Type 85 | |Values 86 | |Description 87 | 88 | |`success` 89 | |String 90 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 91 | |Whether the firwmare upgrade request was successful. 92 | |=== 93 | 94 | == Examples 95 | 96 | === Successful Firmware Upgrade Example 97 | 98 | .POST */api/edge/upgrade.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=56e73342f1a8938f8741fe1458767f64e33e1a9db2a69a31f06e357d27042f4c* Request 99 | [source,http,subs="+quotes"] 100 | ---- 101 | -----------------------------1201211059169276340197013685 102 | Content-Disposition: form-data; name="qqfile"; filename="ER-e300.v2.0.9-beta.4.5305682.tar" 103 | Content-Type: application/x-tar 104 | 105 | vmlinux.tmp................ 106 | ---- 107 | 108 | .POST */api/edge/upgrade.json?header=text%2Fhtml&noraw=1&X-CSRF-TOKEN=56e73342f1a8938f8741fe1458767f64e33e1a9db2a69a31f06e357d27042f4c* Response 109 | [source,json,subs="+quotes"] 110 | ---- 111 | {"UPGRADE": {"success": "1"}, "success": true} 112 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Wizard Feature.adoc: -------------------------------------------------------------------------------- 1 | = General - Wizard Feature 2 | :toc: preamble 3 | 4 | The `/api/edge/feature.json` endpoint allows you to view and make changes to specific parts of the device's configuration with a user-friendly form. 5 | 6 | It does not support a HTTP GET. 7 | 8 | .POST */api/edge/feature.json* Request 9 | [source,json] 10 | ---- 11 | {"data":{"scenario":"DNS_host_names","action":"load"}} 12 | ---- 13 | 14 | .POST */api/edge/feature.json* Response 15 | [source,json] 16 | ---- 17 | {"FEATURE": {"success": "1", "data": {"static-mapping": [{"hostname": "NAS.LAN", "alias": "", "inet": "192.168.0.100"}, {"hostname": "Router.LAN", "alias": "", "inet": "192.168.0.254"}], "dynamic-mapping": [{"dname": "ULTRABOOK", "dpool": "LAN1", "dinet": "192.168.0.1", "dinfo": "static-IP"}, {"dname": "GuestLaptop", "dpool": "LAN1", "dinet": "192.168.0.165", "dinfo": ""}, {"dname": "MikroTik", "dpool": "LAN1", "dinet": "192.168.0.100", "dinfo": "static-IP"}]}}, "success": true} 18 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/General - Wizard Setup.adoc: -------------------------------------------------------------------------------- 1 | = General - Wizard Setup 2 | 3 | The `/api/edge/setup.json` endpoint allows you to view and make changes to specific parts of the device's configuration with a user-friendly form. 4 | 5 | It does not support a HTTP GET. 6 | 7 | .POST */api/edge/setup.json* Request 8 | [source,json] 9 | ---- 10 | {"data":{"scenario":"Basic_Setup","action":"load"}} 11 | ---- 12 | 13 | .POST */api/edge/setup.json* Response 14 | [source,json] 15 | ---- 16 | {"SETUP": {"success": "0", "error": "Request has no action"}, "success": true} 17 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/ONU - Generate Support File.adoc: -------------------------------------------------------------------------------- 1 | = Optical Network Unit (ONU) - Generate Support File 2 | 3 | A support file can be generated by sending a HTTP POST to `/onu/get-support-file.json` and then make an additional HTTP GET request to `/onu/support-file/`. 4 | 5 | The temporarily stored file will be deleted once the request has been made. -------------------------------------------------------------------------------- /Documentation/REST API/ONU - Reboot.adoc: -------------------------------------------------------------------------------- 1 | = ONU - Reboot 2 | :toc: preamble 3 | 4 | The Optical Network Unit (ONU) can be rebooted by sending a HTTP POST to `/api/edge/onu/reboot.json` 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Response 11 | 12 | === Root 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`REBOOT_ONU` 22 | |String 23 | |REBOOT_ONU response 24 | |Status text for the reboot ONU request. 25 | 26 | |`SESSION_ID` 27 | |String 28 | |A session ID 29 | |The authorisation string for this session that confirms the user is correctly authenticated. 30 | 31 | |`success` 32 | |Boolean 33 | |`true` or `false` 34 | |Whether the API request was successful. 35 | |=== 36 | 37 | == Examples 38 | 39 | === Successful Reboot Request Response 40 | 41 | .POST */api/edge/onu/reboot.json* Response 42 | [source,json,subs="+quotes"] 43 | ---- 44 | {"REBOOT_ONU": "", "SESSION_ID": "39957ec91aec4fd0b51580a3fa95b353", "success": true} 45 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Check For Firmware Updates.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Check For Firmware Updates 2 | :toc: preamble 3 | 4 | A check for firmware updates can be performed by sending an empty HTTP POST to `/api/edge/operation/refresh-fw-latest-status.json`. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Response 11 | 12 | === Root 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`OPERATION` 22 | |Object 23 | |`OPERATION` object 24 | |The operation result information. 25 | 26 | |`success` 27 | |Boolean 28 | |`true` or `false` 29 | |Whether the API request was successful. 30 | |=== 31 | 32 | === `OPERATION` Object 33 | 34 | [cols="1,1,1,2", options="header"] 35 | |=== 36 | |Name 37 | |Type 38 | |Values 39 | |Description 40 | 41 | |`success` 42 | |String 43 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 44 | |Whether the check for firmware updates request was successful. 45 | |=== 46 | 47 | == Examples 48 | 49 | === Successful Check For Firmware Updates 50 | 51 | .POST */api/edge/operation/refresh-fw-latest-status.json* Response 52 | [source,json] 53 | ---- 54 | {"OPERATION": {"success": "1"}, "success": true} 55 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Clear Traffic Analysis.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Clear Traffic Analysis 2 | :toc: preamble 3 | 4 | The Traffic Analysis data can be cleared by sending a HTTP POST to `/api/edge/operation/clear-traffic-analysis.json`. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Response 11 | 12 | === Root 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`OPERATION` 22 | |Object 23 | |`OPERATION` object 24 | |The operation result information. 25 | 26 | |`success` 27 | |Boolean 28 | |`true` or `false` 29 | |Whether the API request was successful. 30 | |=== 31 | 32 | === `OPERATION` Object 33 | 34 | [cols="1,1,1,2", options="header"] 35 | |=== 36 | |Name 37 | |Type 38 | |Values 39 | |Description 40 | 41 | |`success` 42 | |String 43 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 44 | |Whether the clear Traffic Analysis data request was successful. 45 | |=== 46 | 47 | == Examples 48 | 49 | === Successful Clear Traffic Analysis data 50 | 51 | .POST */api/edge/operation/clear-traffic-analysis.json* Response 52 | [source,json] 53 | ---- 54 | {"OPERATION": {"success": "1"}, "success": true} 55 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Factory Reset.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Factory Reset 2 | 3 | The device can be reset back to factory-default state by sending a HTTP POST to `/api/edge/operation/factory-reset.json`. This erases all user-generated files and deletes the backup firmware image. 4 | 5 | It does not support a HTTP GET. 6 | 7 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Generate Support File.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Generate Support File 2 | :toc: preamble 3 | 4 | A support file can be generated by sending a HTTP POST to `/api/edge/operation/get-support-file.json` and then make an additional HTTP GET request to `/files/support-file/`. 5 | 6 | The temporarily stored file will be deleted once the request has been made. 7 | 8 | It does not support a HTTP GET. 9 | 10 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 11 | 12 | == Response 13 | 14 | === Root 15 | 16 | [cols="1,1,1,2", options="header"] 17 | |=== 18 | |Name 19 | |Type 20 | |Values 21 | |Description 22 | 23 | |`OPERATION` 24 | |Object 25 | |`OPERATION` object 26 | |The saved support file information. 27 | 28 | |`success` 29 | |Boolean 30 | |`true` or `false` 31 | |Whether the API request was successful. 32 | |=== 33 | 34 | === `OPERATION` Object 35 | 36 | [cols="1,1,1,2", options="header"] 37 | |=== 38 | |Name 39 | |Type 40 | |Values 41 | |Description 42 | 43 | |`path` 44 | |String 45 | |File path (e.g. `/tmp/sysd-save.ycYPpL`) 46 | |A temporary file path on the local device where the support file was saved. 47 | 48 | |`success` 49 | |String 50 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 51 | |Whether the support file generation was successful. 52 | 53 | |=== 54 | 55 | == Examples 56 | 57 | === Successful Save Response 58 | 59 | .GET */api/edge/operation/get-support-file.json* Response 60 | [source,json] 61 | ---- 62 | {"OPERATION": {"path": "/tmp/support_file.T2WQI5.tar.gz", "success": "1"}, "success": true} 63 | ---- 64 | -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Reboot.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Reboot 2 | :toc: preamble 3 | 4 | The device can be rebooted by sending a HTTP POST to `/api/edge/operation/reboot.json` 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`OPERATION` 18 | |Object 19 | |`OPERATION` object 20 | |The operation result information. 21 | 22 | |`success` 23 | |Boolean 24 | |`true` or `false` 25 | |Whether the API request was successful. 26 | |=== 27 | 28 | === `OPERATION` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`success` 38 | |String 39 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 40 | |Whether the reboot request was successful. 41 | |=== 42 | 43 | == Examples 44 | 45 | === Successful Reboot Request Response 46 | 47 | .POST */api/edge/operation/reboot.json* Response 48 | [source,json,subs="+quotes"] 49 | ---- 50 | {"OPERATION": {"success": "1"}, "success": true} 51 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Release DHCP Lease.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Release DHCP Lease 2 | :toc: preamble 3 | 4 | The DHCP lease can be released by sending a HTTP POST to `/api/edge/operation/release-dhcp.json`. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Request 11 | 12 | === Request Content 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`interface` 22 | |String 23 | |Interface 24 | |The specific interface to request to release the DHCP lease (e.g. `eth0`). 25 | |=== 26 | 27 | == Response 28 | 29 | === Root 30 | 31 | [cols="1,1,1,2", options="header"] 32 | |=== 33 | |Name 34 | |Type 35 | |Values 36 | |Description 37 | 38 | |`OPERATION` 39 | |Object 40 | |`OPERATION` object 41 | |The operation result information. 42 | 43 | |`success` 44 | |Boolean 45 | |`true` or `false` 46 | |Whether the API request was successful. 47 | |=== 48 | 49 | === `OPERATION` Object 50 | 51 | [cols="1,1,1,2", options="header"] 52 | |=== 53 | |Name 54 | |Type 55 | |Values 56 | |Description 57 | 58 | |`success` 59 | |String 60 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 61 | |Whether the request to release the DHCP lease was successful. 62 | 63 | |`error` (Optional) 64 | |String 65 | |String 66 | |Why the API request was unsuccessful. 67 | |=== 68 | 69 | == Examples 70 | 71 | === Unsuccessful DHCP Lease Release 72 | 73 | .GET */api/edge/operation/release-dhcp.json* Request 74 | [source,http] 75 | ---- 76 | interface=eth0 77 | ---- 78 | 79 | .GET */api/edge/operation/release-dhcp.json* Response 80 | [source,json] 81 | ---- 82 | {"OPERATION": {"success": "0", "error": "OPERATION request failed"}, "success": true} 83 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Renew DHCP Lease.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Renew DHCP Lease 2 | :toc: preamble 3 | 4 | The DHCP lease can be renewed by sending a HTTP POST to `/api/edge/operation/renew-dhcp.json`. 5 | 6 | It does not support a HTTP GET. 7 | 8 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). 9 | 10 | == Request 11 | 12 | === Request Content 13 | 14 | [cols="1,1,1,2", options="header"] 15 | |=== 16 | |Name 17 | |Type 18 | |Values 19 | |Description 20 | 21 | |`interface` 22 | |String 23 | |Interface 24 | |The specific interface to request to renew the DHCP lease (e.g. `eth0`). 25 | |=== 26 | 27 | == Response 28 | 29 | === Root 30 | 31 | [cols="1,1,1,2", options="header"] 32 | |=== 33 | |Name 34 | |Type 35 | |Values 36 | |Description 37 | 38 | |`OPERATION` 39 | |Object 40 | |`OPERATION` object 41 | |The operation result information. 42 | 43 | |`success` 44 | |Boolean 45 | |`true` or `false` 46 | |Whether the API request was successful. 47 | |=== 48 | 49 | === `OPERATION` Object 50 | 51 | [cols="1,1,1,2", options="header"] 52 | |=== 53 | |Name 54 | |Type 55 | |Values 56 | |Description 57 | 58 | |`success` 59 | |String 60 | |A boolean encapsulated in a string (e.g. `"0"` or `"1"`) 61 | |Whether the request to renew the DHCP lease was successful. 62 | 63 | |`error` (Optional) 64 | |String 65 | |String 66 | |Why the API request was unsuccessful. 67 | |=== 68 | 69 | == Examples 70 | 71 | === Unsuccessful DHCP Lease Renewal 72 | 73 | .GET */api/edge/operation/renew-dhcp.json* Request 74 | [source,http] 75 | ---- 76 | interface=eth0 77 | ---- 78 | 79 | .GET */api/edge/operation/renew-dhcp.json* Response 80 | [source,json] 81 | ---- 82 | {"OPERATION": {"success": "0", "error": "OPERATION request failed"}, "success": true} 83 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Reset Default Configuration.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Reset Default Configuration 2 | 3 | The device configuration can be reset back to default values by sending a HTTP POST to `/api/edge/operation/reset-default-config.json`. Backup firmware image and user-generated files will remain intact. 4 | 5 | It does not support a HTTP GET. 6 | 7 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). -------------------------------------------------------------------------------- /Documentation/REST API/Operation - Shutdown.adoc: -------------------------------------------------------------------------------- 1 | = Operation - Shutdown 2 | 3 | The device can be shutdown by sending a HTTP POST to `/api/edge/operation/shutdown.json`. 4 | 5 | It does not support a HTTP GET. 6 | 7 | This method is CSRF protected so also requires a `X-CSRF-TOKEN` (see link:../README.adoc#Sensitive-Requests-CSRF-Protection[Sensitive Requests (CSRF Protection)]). -------------------------------------------------------------------------------- /Documentation/REST API/Wizard - List All Wizards.adoc: -------------------------------------------------------------------------------- 1 | = Wizard - List All Wizards 2 | :toc: preamble 3 | 4 | A list of all the available wizards can be obtained by sending a HTTP GET to `/api/wizard/all.json` 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`wizards` 18 | |Object 19 | |`wizards` object 20 | |An object that contains the wizards. 21 | 22 | |`success` 23 | |Boolean 24 | |`true` or `false` 25 | |Whether the API request was successful. 26 | |=== 27 | 28 | === `wizards` Object 29 | 30 | [cols="1,1,1,2", options="header"] 31 | |=== 32 | |Name 33 | |Type 34 | |Values 35 | |Description 36 | 37 | |`custom` 38 | |Boolean 39 | |`true` or `false` 40 | |Whether the wizard is user defined. 41 | 42 | |`type` 43 | |String 44 | |`"feature"` or `"setup"` 45 | |Whether the wizard should be categorised as a configurable feature wizard or one used to setup the router. 46 | 47 | |`id` 48 | |String 49 | |System ID 50 | |The unique ID to refer to this wizard (typically `type`-`key`). 51 | 52 | |`key` 53 | |String 54 | |Wizard key 55 | |The unique wizard's key for its type. 56 | 57 | |`name` 58 | |String 59 | |Wizard Name 60 | |The name as it should appear in the web UI. 61 | |=== 62 | 63 | 64 | == Examples 65 | 66 | === Get All Wizards 67 | .GET */api/wizard/all.json* Response 68 | [source,json] 69 | ---- 70 | {"wizards": [{"custom": false, "type": "feature", "id": "feature-.Basic_Queue", "key": ".Basic_Queue", "name": ".Basic Queue"}, {"custom": false, "type": "feature", "id": "feature-.DDns", "key": ".DDns", "name": ".DDns"}, {"custom": false, "type": "feature", "id": "feature-.Port_Forwarding", "key": ".Port_Forwarding", "name": ".Port Forwarding"}, {"custom": false, "type": "feature", "id": "feature-.Sql", "key": ".Sql", "name": ".Sql"}, {"custom": false, "type": "feature", "id": "feature-.Vpn2", "key": ".Vpn2", "name": ".Vpn2"}, {"custom": false, "type": "setup", "id": "setup-Basic_Setup", "key": "Basic_Setup", "name": "Basic Setup"}, {"custom": false, "type": "feature", "id": "feature-DNS_host_names", "key": "DNS_host_names", "name": "DNS host names"}, {"custom": false, "type": "setup", "id": "setup-Load_Balancing", "key": "Load_Balancing", "name": "Load Balancing"}, {"custom": false, "type": "setup", "id": "setup-Load_Balancing2", "key": "Load_Balancing2", "name": "Load Balancing2"}, {"custom": false, "type": "setup", "id": "setup-Switch", "key": "Switch", "name": "Switch"}, {"custom": false, "type": "feature", "id": "feature-TCP_MSS_clamping", "key": "TCP_MSS_clamping", "name": "TCP MSS clamping"}, {"custom": false, "type": "feature", "id": "feature-UPnP", "key": "UPnP", "name": "UPnP"}, {"custom": false, "type": "feature", "id": "feature-VPN_status", "key": "VPN_status", "name": "VPN status"}, {"custom": false, "type": "setup", "id": "setup-WAN+2LAN", "key": "WAN+2LAN", "name": "WAN+2LAN"}, {"custom": false, "type": "setup", "id": "setup-WAN+2LAN2", "key": "WAN+2LAN2", "name": "WAN+2LAN2"}], "success": true} 71 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Wizard - Specific Wizard Create.adoc: -------------------------------------------------------------------------------- 1 | = Wizard - Specific Wizard Create 2 | 3 | A specific wizard can be created by sending a HTTP POST to `/api/wizard/create.json`. This reads a session variable from link:Wizard%20-%20Specific%20Wizard%20Upload.adoc[Specific Wizard Upload] 4 | 5 | It does not support a HTTP GET. -------------------------------------------------------------------------------- /Documentation/REST API/Wizard - Specific Wizard Download.adoc: -------------------------------------------------------------------------------- 1 | = Wizard - Download Specific Wizard 2 | :toc: preamble 3 | 4 | A specific wizard can be downloaded by sending a HTTP GET to `/api/wizard/*Type*/*Key*.json` substituting the type and key. 5 | 6 | Typically type will be one of: 7 | 8 | * `feature` 9 | * `setup` 10 | 11 | The default wizards are: 12 | 13 | [cols="1,1,1", options="header"] 14 | |=== 15 | |Name 16 | |Key 17 | |Type 18 | 19 | |Basic Setup (symlink'd to WAN+2LAN2) 20 | |`Basic_Setup` 21 | |setup 22 | 23 | |Load Balancing 24 | |`Load_Balancing` 25 | |setup 26 | 27 | |Load Balancing2 28 | |`Load_Balancing2` 29 | |setup 30 | 31 | |Switch 32 | |`Switch` 33 | |setup 34 | 35 | |WAN+2LAN 36 | |`WAN+2LAN` 37 | |setup 38 | 39 | |WAN+2LAN2 40 | |`WAN+2LAN2` 41 | |setup 42 | 43 | |.Basic_Queue 44 | |`.Basic_Queue` 45 | |feature 46 | 47 | |.DDns 48 | |`.DDns` 49 | |feature 50 | 51 | |.Port Forwarding 52 | |`.Port_Forwarding` 53 | |feature 54 | 55 | |.Sql 56 | |`.Sql` 57 | |feature 58 | 59 | |.Vpn2 60 | |`.Vpn2` 61 | |feature 62 | 63 | |DNS host names 64 | |`DNS_host_names` 65 | |feature 66 | 67 | |TCP MSS clamping 68 | |`TCP_MSS_clamping` 69 | |feature 70 | 71 | |UPnP 72 | |`UPnP` 73 | |feature 74 | 75 | |VPN status 76 | |`VPN_status` 77 | |feature 78 | |=== 79 | 80 | == Example 81 | 82 | .GET */api/wizard/feature/DNS_host_names.json* Response 83 | [source,json] 84 | ---- 85 | {"html": "
\n DNS host names configuration\n
\n\n
\n Static host names\n
\n
\n
This field is mandatory, for example:
firstname\"/>
\n
This field is optional, for example:
secondname,thirdname\"/>
\n
This field is mandatory, for example:
192.168.1.100\"/>
\n
\n
\n \n \n \n
Host NameAliasIP Address
\n \n
\n
\n\n
\n Dynamic host names\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
Host NamePoolIP Address
\n \n
\n
\n", "success": true, "validator": {"rules": {"alias": {"required": false, "hostnames": 1}, "hostname": {"required": true, "hostname": 1}, "inet": {"required": true, "ipv4": 1}}}} 86 | ---- -------------------------------------------------------------------------------- /Documentation/REST API/Wizard - Specific Wizard Remove.adoc: -------------------------------------------------------------------------------- 1 | = Wizard - Specific Wizard Remove 2 | 3 | A specific wizard can be removed by sending a HTTP GET to `/api/wizard/remove/*Key*.json` substituting the key. -------------------------------------------------------------------------------- /Documentation/REST API/Wizard - Specific Wizard Upload.adoc: -------------------------------------------------------------------------------- 1 | = Wizard - Specific Wizard Upload 2 | 3 | A specific wizard can be uploaded by sending a HTTP POST to `/api/wizard/upload.json`. This then sets a session variable ready for the link:Wizard%20-%20Specific%20Wizard%20Create.adoc[Specific Wizard Create] endpoint. 4 | 5 | It does not support a HTTP GET. 6 | 7 | == Example 8 | 9 | === Upload Invalid Wizard 10 | .POST */api/wizard/upload.json* Response 11 | [source,json] 12 | ---- 13 | {"errors": ["ReadError('file could not be opened successfully',)"], "success": false} 14 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/Command Line Interface (CLI).adoc: -------------------------------------------------------------------------------- 1 | = Command Line Interface (CLI) 2 | 3 | The CLI can be accessed from `wss://host-or-ip/ws/cli`. The data sent to the WebSocket will be as you would type on CLI and the received data is the raw response. -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - Configuration Change.adoc: -------------------------------------------------------------------------------- 1 | = JSON - Configuration Change 2 | :toc: preamble 3 | 4 | This message is generated only when EdgeOS is processing a configuration change. 5 | 6 | It is used by the web UI to detect when the displayed configuration is out of date and requires refreshing. 7 | 8 | == Response 9 | 10 | === Root 11 | 12 | [cols="1,1,1,2", options="header"] 13 | |=== 14 | |Name 15 | |Type 16 | |Values 17 | |Description 18 | 19 | |`commit` 20 | |String 21 | |`started` or `ended` 22 | |The progress of the configuration change. 23 | |=== 24 | 25 | == Examples 26 | 27 | === Commit Started 28 | 29 | .Commit Started Example 30 | [source,json] 31 | ---- 32 | 61 33 | { 34 | "config-change": { 35 | "commit": "started" 36 | } 37 | } 38 | 39 | ---- 40 | 41 | === Commit Ended 42 | 43 | .Commit Ended Example 44 | [source,json] 45 | ---- 46 | 59 47 | { 48 | "config-change": { 49 | "commit": "ended" 50 | } 51 | } 52 | 53 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - Device Discovery.adoc: -------------------------------------------------------------------------------- 1 | = JSON - Device Discovery 2 | :toc: preamble 3 | 4 | This returns periodic messages containing discovered device information where EdgeOS has discovered another device (typically via UBNT Discovery). 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`devices` 18 | |Array (Object) or String 19 | |Array of `Device` or empty string 20 | |An array of discovered devices or an empty string if no devices have been discovered. 21 | |=== 22 | 23 | === `Device` Object 24 | 25 | [cols="1,1,1,2", options="header"] 26 | |=== 27 | |Name 28 | |Type 29 | |Values 30 | |Description 31 | 32 | |`interface` 33 | |String 34 | |Interface name (e.g. `eth2`) 35 | |The interface the discovery packet was broadcast on. 36 | 37 | |`hwaddr` 38 | |String 39 | |MAC Address (e.g. `FF:FF:FF:FF:FF:01`) 40 | |The base MAC address of the device. 41 | 42 | |`ipv4` 43 | |String 44 | |IP Address (e.g. `192.168.0.1`) 45 | |One of the IP addresses currently of the device. 46 | 47 | |`hostname` 48 | |String 49 | |Hostname (e.g. `Router`) 50 | |The current hostname of the discovered device. 51 | 52 | |`product` 53 | |String 54 | |Model (e.g. `ER-4`) 55 | |The model of the discovered device. 56 | 57 | |`uptime` 58 | |String 59 | |Time in days, hours, minutes and seconds (e.g. `1d2h3m4s`) 60 | |How long the discovered device has currently been powered for. 61 | 62 | |`wmode` 63 | |String 64 | |Unknown (e.g. `unknown (-1)`) 65 | |The current wireless mode of the discovered device. 66 | 67 | |`essid` 68 | |String 69 | |Unknown (e.g. ``) 70 | |The current wireless network name or Extended Service Set Identification (ESSID) of the discovered device (if applicable). 71 | 72 | |`addresses` 73 | |Array (Object) 74 | |Array of `addresses` 75 | |The current addresses the discovered device has on each of its interfaces. 76 | 77 | |`fwversion` 78 | |String 79 | |Firmware version string (e.g. `EdgeRouter.ER-e300.v2.0.9-beta.3.5296219.200507.1538`) 80 | |The firmware version the discovered device is currently running. 81 | 82 | |`system_status` 83 | |String 84 | |Hexadecimal string (e.g. `0x566eccb8`) 85 | |An unknown encoded hexadecimal value that represents the discovered device's current status. 86 | |=== 87 | 88 | === `addresses` Object 89 | 90 | [cols="1,1,1,2", options="header"] 91 | |=== 92 | |Name 93 | |Type 94 | |Values 95 | |Description 96 | 97 | |`hwaddr` 98 | |String 99 | |MAC Address (e.g. `FF:FF:FF:FF:FF:02`) 100 | |The MAC address of the interface. 101 | 102 | |`ipv4` 103 | |String 104 | |IP Address (e.g. `192.168.0.1`) 105 | |The IP addresses of the interface on this device. 106 | |=== 107 | 108 | == Examples 109 | 110 | === No Discovered Devices 111 | 112 | .No Discovered Devices Example 113 | [source,json] 114 | ---- 115 | 50 116 | { 117 | "discover": { 118 | "devices": "" 119 | } 120 | } 121 | 122 | ---- 123 | 124 | === Single Discovered Device 125 | 126 | .Single Discovered Device Example 127 | [source,json] 128 | ---- 129 | 871 130 | { 131 | "discover": { 132 | "devices": [ 133 | { 134 | "interface": "eth2", 135 | "hwaddr": "FF:FF:FF:FF:FF:01", 136 | "ipv4": "255.255.255.255", 137 | "hostname": "Router", 138 | "product": "ER-4", 139 | "uptime": "8h45m49s", 140 | "wmode": "unknown (-1)", 141 | "essid": "", 142 | "addresses": [ 143 | { 144 | "hwaddr": "FF:FF:FF:FF:FF:02", 145 | "ipv4": "255.255.255.255" 146 | }, 147 | { 148 | "hwaddr": "FF:FF:FF:FF:FF:03", 149 | "ipv4": "255.255.255.255" 150 | } 151 | ], 152 | "fwversion": "EdgeRouter.ER-e300.v2.0.9-beta.3.5296219.200507.1538", 153 | "system_status": "0x566eccb8" 154 | } 155 | ] 156 | } 157 | } 158 | 159 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - Interfaces.adoc: -------------------------------------------------------------------------------- 1 | = JSON - Interfaces 2 | 3 | This returns periodic messages containing network interface information for each of the EdgeOS network interfaces. -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - Number Of Routes.adoc: -------------------------------------------------------------------------------- 1 | = JSON - Number Of Routes 2 | :toc: preamble 3 | 4 | This returns periodic messages containing counts of the EdgeOS network routes. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`connected` 18 | |Number 19 | |Number 20 | |The number of routes that are currently connected. 21 | 22 | |`static` 23 | |Number 24 | |Number 25 | |The number of static routes. 26 | 27 | |`total` 28 | |Number 29 | |Number 30 | |The total number of routes (should be the number of static + connected routes). 31 | |=== 32 | 33 | == Examples 34 | 35 | === Routes 36 | 37 | .Routes Example 38 | [source,json] 39 | ---- 40 | 100 41 | { 42 | "num-routes": { 43 | "connected": "3", 44 | "static": "1", 45 | "total": "4" 46 | } 47 | } 48 | 49 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - System Statistics.adoc: -------------------------------------------------------------------------------- 1 | = JSON - System Statistics 2 | :toc: preamble 3 | 4 | This returns periodic messages containing system statistics about the EdgeOS device. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`cpu` 18 | |Number 19 | |Number (0 - 100) 20 | |The CPU usage (as a percentage) of the EdgeOS device. 21 | 22 | |`uptime` 23 | |Number 24 | |Number (> 0) 25 | |How long this EdgeOS device has been running for. 26 | 27 | |`mem` 28 | |Number 29 | |Number (0 - 100) 30 | |The amount of memory in use (as a percentage) on the EdgeOS device. 31 | |=== 32 | 33 | == Examples 34 | 35 | === System Statistics 36 | 37 | .System Statistics Example 38 | [source,json] 39 | ---- 40 | 99 41 | { 42 | "system-stats": { 43 | "cpu": "1", 44 | "uptime": "32884", 45 | "mem": "12" 46 | } 47 | } 48 | 49 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - UDAPI Statistics.adoc: -------------------------------------------------------------------------------- 1 | = JSON - UDAPI Statistics 2 | 3 | This returns periodic messages containing device statistics in a specific Ubiquiti Device API format (UDAPI), used by UNMS. -------------------------------------------------------------------------------- /Documentation/WebSocket API/JSON - Users.adoc: -------------------------------------------------------------------------------- 1 | = JSON - Users 2 | :toc: preamble 3 | 4 | This returns periodic messages containing the users logged into the EdgeOS device (including via SSH, Web and VPN). 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`local` 18 | |Array (Object) 19 | |Array of `users` 20 | |The users currently connected. 21 | |=== 22 | 23 | === `users` Object 24 | 25 | [cols="1,1,1,2", options="header"] 26 | |=== 27 | |Name 28 | |Type 29 | |Values 30 | |Description 31 | 32 | |Key 33 | |String 34 | |Username (e.g. `admin`) 35 | |The username currently connected. 36 | 37 | |Value 38 | |Array (Object) 39 | |Array of `UserConnection` 40 | |The connection details of the username currently connected. 41 | |=== 42 | 43 | === `UserConnection` Object 44 | 45 | [cols="1,1,1,2", options="header"] 46 | |=== 47 | |Name 48 | |Type 49 | |Values 50 | |Description 51 | 52 | |`tty` 53 | |String 54 | |`ConnectionType` (e.g. `Web`) 55 | |The method the user is currently connected. 56 | 57 | |`idle` 58 | |Number 59 | |Number (0+) 60 | |How long the user has been idle for. 61 | 62 | |`host` 63 | |String 64 | |String (`Laptop`) or empty string 65 | |The hostname the user has been resolved to (if known). 66 | 67 | |`uptime` 68 | |String 69 | |Time in days, hours, minutes and seconds (e.g. `1d2h3m4s`) 70 | |How long the user has been connected for. 71 | |=== 72 | 73 | === `ConnectionType` Types 74 | 75 | These are the currently known connection types: 76 | 77 | * Web 78 | * pts/n 79 | 80 | == Examples 81 | 82 | === 2 Connected Users 83 | .Users Example 84 | [source,json] 85 | ---- 86 | 502 87 | { 88 | "users": { 89 | "local": [ 90 | { 91 | "admin": { 92 | "tty": "Web", 93 | "idle": "0", 94 | "host": "", 95 | "uptime": "01h55m03s" 96 | } 97 | }, 98 | { 99 | "admin": { 100 | "tty": "pts\/0", 101 | "idle": "4901", 102 | "host": "192.168.0.100", 103 | "uptime": "01h33m44s" 104 | } 105 | } 106 | ] 107 | } 108 | } 109 | 110 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/README.adoc: -------------------------------------------------------------------------------- 1 | = WebSocket 2 | 3 | * link:Command%20Line%20Interface%20%28CLI%29.adoc[Command Line Interface (CLI)] 4 | * link:Statistics.adoc[Statistics] -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Bandwidth Test.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Bandwidth Test 2 | :toc: preamble 3 | 4 | By setting the correct parameters in the subscription request, a bandwidth test (using `iperf`) can be performed. 5 | 6 | == Request 7 | 8 | === Client Specific Parameters 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`server` 18 | |String 19 | |String 20 | |The `iperf` destination server to use to test bandwidth. 21 | 22 | |`duration` (Optional) 23 | |String 24 | |A number encapsulated in a string (e.g. `"1"`) between 0 and 1000 25 | |The duration in seconds. 26 | 27 | |`protocol` (Optional) 28 | |String 29 | |`tcp` or `udp` 30 | |The protocol to use for bandwidth testing. 31 | 32 | |`udp-bandwidth` (Optional) 33 | |String 34 | |A number encapsulated in a string (e.g. `"500"`) between 500 and 1000000 35 | |The UDP bandwidth in Kbps. 36 | 37 | |`parallel-flows` (Optional) 38 | |String 39 | |A number encapsulated in a string (e.g. `"1"`) between 1 and 20 40 | |The number of parallel flows. 41 | 42 | |`tcp-window-size` (Optional) 43 | |String 44 | |A number encapsulated in a string (e.g. `"64"`) between 64 and 1024 45 | |The TCP window size. 46 | 47 | |`reverse-direction` (Optional) 48 | |Boolean 49 | |`true` or `false` 50 | |Whether to reverse the direction of the traffic. 51 | 52 | |=== 53 | 54 | 55 | === Server Specific Parameters 56 | 57 | [cols="1,1,1,2", options="header"] 58 | |=== 59 | |Name 60 | |Type 61 | |Values 62 | |Description 63 | 64 | |`server-mode` (Optional) 65 | |Boolean 66 | |`true` or `false` 67 | |Whether to operate `iperf` in server mode. 68 | |=== 69 | 70 | == Examples 71 | 72 | === Simple Client Request 73 | 74 | .Simple Client Request 75 | [source,json] 76 | ---- 77 | 150 78 | {"SUBSCRIBE":[{"name":"bwtest-feed","sub_id":"bandwidth5","server":"192.168.0.253"}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 79 | ---- 80 | 81 | === Advanced Client Request 82 | 83 | .Advanced Client Request 84 | [source,json] 85 | ---- 86 | 273 87 | {"SUBSCRIBE":[{"name":"bwtest-feed","sub_id":"bandwidth2","server":"192.168.0.254","duration":"1","protocol":"udp","udp-bandwidth":"500","parallel-flows":"1","tcp-window-size":"64","reverse-direction":true}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 88 | ---- 89 | 90 | === Server Request 91 | 92 | .Server Request 93 | [source,json] 94 | ---- 95 | 144 96 | {"SUBSCRIBE":[{"name":"bwtest-feed","sub_id":"bandwidth5","server-mode":true}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 97 | ---- 98 | -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Firewall Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Firewall Statistics 2 | :toc: preamble 3 | 4 | Returns per-rule firewall stats. 5 | 6 | == Request 7 | 8 | === Firewall Statistics Specific Parameters 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`chain` 18 | |String 19 | |String 20 | |The firewall chain to request statistics for (e.g. `WAN_IN`). 21 | |=== 22 | 23 | == Response 24 | 25 | The raw string response is pretty similar to a raw feed. 26 | 27 | === Root 28 | 29 | [cols="1,1,1,2", options="header"] 30 | |=== 31 | |Name 32 | |Type 33 | |Values 34 | |Description 35 | 36 | |`sub_id` 37 | |String 38 | |String 39 | |The raw response in the format Chain, Rule Number, Packets, Bytes, Action, Description separated by a new-line. 40 | |=== 41 | 42 | == Examples 43 | 44 | === Firewall Statistics Example 45 | 46 | .Subscription Request 47 | [source,json] 48 | ---- 49 | 142 50 | {"SUBSCRIBE":[{"name":"fw-stats","sub_id":"fwstat:WAN_IN","chain":"WAN_IN"}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 51 | ---- 52 | 53 | 54 | .Response 55 | [source,json] 56 | ---- 57 | 276 58 | { 59 | "fwstat:WAN_IN": "WAN_IN 10 2048285 387019792 ACCEPT \"Allow Established\/Related\"\nWAN_IN 20 0 0 DROP \"Drop Invalid State\"\nWAN_IN 21 162 16317 ACCEPT \"Allow OpenVPN\"\nWAN_IN 22 0 0 ACCEPT \"Allow Emergency iLO\"\nWAN_IN 10000 7 435 DROP \"DEFAULT ACTION\"\n\n" 60 | } 61 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Log Feed.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Log Feed 2 | :toc: preamble 3 | 4 | This subscription type effectively performs a tail -f /var/log/messages. 5 | 6 | == Response 7 | 8 | === Root 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`sub_id` 18 | |String 19 | |String 20 | |The raw log file contents separated by a new-line. 21 | |=== 22 | 23 | == Examples 24 | 25 | === Log Monitor Example 26 | 27 | .Response 28 | [source,json] 29 | ---- 30 | 315 31 | { 32 | "logmon3": "Jun 27 21:45:54 Router sudo: root : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/sbin\/iptables-save -c -t nat\nJun 27 21:45:54 Router sudo: pam_unix(sudo:session): session opened for user root by (uid=0)\nJun 27 21:45:54 Router sudo: pam_unix(sudo:session): session closed for user root\n" 33 | } 34 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - NAT Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Raw - NAT Statistics 2 | :toc: preamble 3 | 4 | Returns per-rule NAT stats. 5 | 6 | == Response 7 | 8 | The raw string response is pretty similar to a raw feed. 9 | 10 | === Root 11 | 12 | [cols="1,1,1,2", options="header"] 13 | |=== 14 | |Name 15 | |Type 16 | |Values 17 | |Description 18 | 19 | |`sub_id` 20 | |String 21 | |String 22 | |The raw response in the format Rule Number, Packets, Action (`MASQ` or `DST`), Interface, Description separated by a new-line. 23 | |=== 24 | 25 | == Examples 26 | 27 | === NAT Statistics Example 28 | 29 | .Response 30 | [source,json] 31 | ---- 32 | 1115 33 | { 34 | "nat-stats": "1 15 DST eth0 \"Allow OpenVPN To VPN\"\n2 0 DST eth1 \"Allow OpenVPN To VPN (Hairpin)\"\n3 28 DST eth0 \"Allow qBittorrent\"\n4 0 DST eth0 \"Allow Emergency iLO (HTTP)\" DISABLED\n5 0 DST eth0 \"Allow Emergency iLO (Console)\" DISABLED\n6 7192 DST eth1 \"Redirect Google DNS To Router\"\n7 3920 DST eth1 \"Redirect Google ICMP To Router\"\n5001 46501 MASQ eth0 \"Masquerade For WAN\"\n5002 0 MASQ eth1 \"Allow OpenVPN To VPN (Hairpin)\"\n1 15 DST eth0 \"Allow OpenVPN To VPN\"\n2 0 DST eth1 \"Allow OpenVPN To VPN (Hairpin)\"\n3 28 DST eth0 \"Allow qBittorrent\"\n4 0 DST eth0 \"Allow Emergency iLO (HTTP)\" DISABLED\n5 0 DST eth0 \"Allow Emergency iLO (Console)\" DISABLED\n6 7192 DST eth1 \"Redirect Google DNS To Router\"\n7 3920 DST eth1 \"Redirect Google ICMP To Router\"\n5001 46501 MASQ eth0 \"Masquerade For WAN\"\n5002 0 MASQ eth1 \"Allow OpenVPN To VPN (Hairpin)\"\n1 15 DST eth0 \"Allow OpenVPN To VPN\"\n2 0 DST eth1 \"Allow OpenVPN To VPN (Hairpin)\"\n3 28 DST eth0 \"Allow qBittorrent\"\n4 0 DST eth0 \"Allow Emergency iLO (HTTP)\" DISABLED\n5 0 DST eth0 \"Allow Emergency iLO " 35 | } 36 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Packet Capture.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Packet Capture 2 | :toc: preamble 3 | 4 | By setting the correct parameters in the subscription request, a packet capture (using `tcpdump`) can be performed. 5 | 6 | == Request 7 | 8 | === Packet Capture Specific Parameters 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`interface` 18 | |String 19 | |String 20 | |The interface to capture on. 21 | 22 | |`pkt_count` 23 | |String 24 | |String 25 | |The packet capture limit (in number of packets). 26 | 27 | |`resolve` 28 | |Boolean 29 | |`true` or `false` 30 | |Whether to resolve addresses. 31 | 32 | |`f_proto` 33 | |String 34 | |String (e.g. `tcp`) 35 | |The protocol to filter on. 36 | 37 | |`f_address` 38 | |String 39 | |String 40 | |The address to filter on. 41 | 42 | |`f_port` 43 | |String 44 | |A number encapsulated in a string (e.g. `"1"`) between 1 and 65535 45 | |The port to filter on. 46 | 47 | |`f_neg` 48 | |Boolean 49 | |`true` or `false` 50 | |Whether to negate the filter. 51 | |=== 52 | 53 | == Response 54 | 55 | The raw string response is pretty similar to a raw feed. 56 | 57 | === Root 58 | 59 | [cols="1,1,1,2", options="header"] 60 | |=== 61 | |Name 62 | |Type 63 | |Values 64 | |Description 65 | 66 | |`sub_id` 67 | |String 68 | |String 69 | |The raw response e.g. `"21:14:04.221110 IP xxx.xxx.xxx.xxx.42539 > xxx.xxx.xxx.xxx.443: UDP, length 23\n"`. 70 | |=== 71 | 72 | == Examples 73 | 74 | === Packet Capture Example 75 | 76 | .Subscription Request 77 | [source,json] 78 | ---- 79 | 224 80 | {"SUBSCRIBE":[{"name":"packets-feed","sub_id":"packets4","interface":"1","pkt_count":"1","resolve":true,"f_proto":"","f_address":"","f_port":"","f_neg":true}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 81 | ---- 82 | 83 | 84 | .Response 85 | [source,json] 86 | ----- 87 | 101 88 | { 89 | "packets4": "21:14:04.221110 IP xxx.xxx.xxx.xxx.42539 > xxx.xxx.xxx.xxx.443: UDP, length 23\n" 90 | } 91 | -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Ping.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Ping 2 | :toc: preamble 3 | 4 | By setting the correct parameters in the subscription request, a ping can be performed. 5 | 6 | == Request 7 | 8 | === Ping Specific Parameters 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`target` 18 | |String 19 | |String 20 | |The destination/host to ping. 21 | 22 | |`count` 23 | |String 24 | |A number encapsulated in a string (e.g. `"1"`) between 1 and 4294967295 25 | |How many times to ping. 26 | 27 | |`size` 28 | |String or empty string 29 | |A number encapsulated in a string (e.g. `"1"`) between 1 and 65507 30 | |The packet size of each ping request. 31 | |=== 32 | 33 | == Response 34 | 35 | The raw string response is pretty similar to a raw feed. 36 | 37 | === Root 38 | 39 | [cols="1,1,1,2", options="header"] 40 | |=== 41 | |Name 42 | |Type 43 | |Values 44 | |Description 45 | 46 | |`sub_id` 47 | |String 48 | |String 49 | |The raw response e.g. `"PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.\n\n"`. 50 | |=== 51 | 52 | == Examples 53 | 54 | === Ping Example 55 | 56 | .Subscription Request 57 | [source,json] 58 | ---- 59 | 163 60 | {"SUBSCRIBE":[{"name":"ping-feed","sub_id":"ping1","target":"192.168.0.1","count":"1","size":""}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 61 | ---- 62 | 63 | .Response 64 | [source,json] 65 | ---- 66 | 76 67 | { 68 | "ping1": "PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.\n\n" 69 | } 70 | ---- -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Port Forwarding Statistics.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Port Forwarding Statistics 2 | :toc: preamble 3 | 4 | This returns periodic messages containing port forwarding statistics. 5 | 6 | While similar to the destination NAT feature, this message will only contain information on the Port Forwarding rules. 7 | 8 | == Response 9 | 10 | === Root 11 | 12 | [cols="1,1,1,2", options="header"] 13 | |=== 14 | |Name 15 | |Type 16 | |Values 17 | |Description 18 | 19 | |`sub_id` 20 | |String 21 | |String 22 | |The status of the port forwarding in the format `rule_number packets bytes\n`. 23 | |=== 24 | 25 | == Examples 26 | 27 | 28 | .Port Forward Rule #1 Statistic Example 29 | [source,json] 30 | ---- 31 | 39 32 | { 33 | "pfstats": "1 62333 2897688\n" 34 | } 35 | 36 | ---- 37 | 38 | .Port Forward Rule #2 Statistic Example 39 | [source,json] 40 | ---- 41 | 39 42 | { 43 | "pfstats": "2 28618 1557029\n" 44 | } 45 | 46 | ---- 47 | -------------------------------------------------------------------------------- /Documentation/WebSocket API/Raw - Traceroute.adoc: -------------------------------------------------------------------------------- 1 | = Raw - Traceroute 2 | :toc: preamble 3 | 4 | By setting the correct parameters in the subscription request, a traceroute can be performed. 5 | 6 | == Request 7 | 8 | === Traceroute Specific Parameters 9 | 10 | [cols="1,1,1,2", options="header"] 11 | |=== 12 | |Name 13 | |Type 14 | |Values 15 | |Description 16 | 17 | |`target` 18 | |String 19 | |String 20 | |The destination to ping. 21 | 22 | |`resolve` 23 | |Boolean 24 | |`true` or `false` 25 | |Whether IP addresses should be resolved. 26 | |=== 27 | 28 | == Response 29 | 30 | The raw string response is pretty similar to a raw feed. 31 | 32 | === Root 33 | 34 | [cols="1,1,1,2", options="header"] 35 | |=== 36 | |Name 37 | |Type 38 | |Values 39 | |Description 40 | 41 | |`sub_id` 42 | |String 43 | |String 44 | |The raw response e.g. `"traceroute to 192.168.0.254 (192.168.0.254), 30 hops max, 38 byte packets\n 1"`. 45 | |=== 46 | 47 | == Examples 48 | 49 | === Traceroute Example 50 | 51 | .Subscription Request 52 | [source,json] 53 | ---- 54 | 165 55 | {"SUBSCRIBE":[{"name":"traceroute-feed","sub_id":"trace6","target":"192.168.0.254","resolve":true}],"UNSUBSCRIBE":[],"SESSION_ID":"9a00126c5bf04e29835f7c13fe5ab155"} 56 | ---- 57 | 58 | .Response 59 | [source,json] 60 | ---- 61 | 98 62 | { 63 | "trace6": "traceroute to 192.168.0.254 (192.168.0.254), 30 hops max, 38 byte packets\n 1" 64 | } 65 | ---- -------------------------------------------------------------------------------- /EdgeOS.API/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following set of attributes. 6 | // Change these attribute values to modify the information associated with an assembly. 7 | [assembly: AssemblyTitle("EdgeOS.API")] 8 | [assembly: AssemblyDescription("Provides a framework for communicating with EdgeOS.")] 9 | [assembly: AssemblyConfiguration("Production")] 10 | [assembly: AssemblyCompany("Matthew1471!")] 11 | [assembly: AssemblyProduct("EdgeOS.API")] 12 | [assembly: AssemblyCopyright("Copyright © Matthew1471! 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. 17 | // If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("7293f771-90db-4d52-a651-4bd061b25d1e")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | [assembly: NeutralResourcesLanguage("en-GB")] -------------------------------------------------------------------------------- /EdgeOS.API/ServerCertificateValidationCallback.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Net.Security; 5 | using System.Security.Cryptography.X509Certificates; 6 | 7 | namespace EdgeOS.API 8 | { 9 | /// A class that contains methods suitable as a delegate that pins self-signed certificates to a trusted stored certificate. 10 | class ServerCertificateValidationCallback 11 | { 12 | /// Used for TLS Certificate pinning by PinPublicKey. 13 | public static string DataDirectory; 14 | 15 | /// Disable automatic generated default constructor. 16 | private ServerCertificateValidationCallback() { } 17 | 18 | /// A method suitable as a delegate that pins self-signed certificates to a trusted stored certificate. 19 | /// An object that contains state information for this validation. 20 | /// The certificate used to authenticate the remote party. 21 | /// The chain of certificate authorities associated with the remote certificate. 22 | /// One or more errors associated with the remote certificate. 23 | /// A value that determines whether the specified certificate is accepted for authentication. 24 | /// See also 25 | public static bool PinPublicKey(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 26 | { 27 | // Having no valid certificate provided by the connection is automatically invalid/incorrect behaviour. 28 | if (certificate == null) { return false; } 29 | 30 | // To ensure a valid (but compromised) server is not being impersonated we need to know what server we were making the request to. 31 | HttpWebRequest originalRequest = sender as HttpWebRequest; 32 | if (sender == null) { return false; } 33 | 34 | // If this file exists we will use this to validate the server instead of the usual rules. 35 | string expectedCertificatePath = DataDirectory + originalRequest.Address.Host.Replace("-", "").Replace(".", "") + ".crt"; 36 | 37 | // Check to see if we are manually accepting a server certificate. 38 | if (File.Exists(expectedCertificatePath)) 39 | { 40 | // If this is so far valid then we validate. If this chain failed to validate, is the reason this failed to match due to the unknown root and optionally hostname (other errors are fatal)? 41 | if (sslPolicyErrors == SslPolicyErrors.None || ((sslPolicyErrors &~ SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateChainErrors && chain.ChainStatus.Length == 1 && chain.ChainStatus[0].Status == X509ChainStatusFlags.UntrustedRoot)) 42 | { 43 | // We fail a name mismatch if it is not the standard EdgeRouter name. 44 | if ((sslPolicyErrors &= SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateNameMismatch && !certificate.Subject.Equals("L=New York, S=New York, O=Ubiquiti Inc., CN=UbiquitiRouterUI, C=US")) { return false; } 45 | 46 | // Obtain the certificate from the file. 47 | using (X509Certificate2 storedCertificate = new X509Certificate2(expectedCertificatePath)) 48 | { 49 | // Do the 2 public keys match? 50 | return certificate.GetPublicKeyString().Equals(storedCertificate.GetPublicKeyString()); 51 | } 52 | } 53 | 54 | // A hardcoded certificate exists but this does not match or another error occurred (we also do not perform normal validation in this case in case we have been MITM'd by a compromised but trusted CA). 55 | return false; 56 | } 57 | 58 | // Should otherwise do standard validation (https://stackoverflow.com/questions/28679120/how-to-call-default-servercertificatevalidationcallback-inside-customized-valida). 59 | return sslPolicyErrors == SslPolicyErrors.None; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /EdgeOS.API/SubscriptionDataEvent.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Responses; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | 7 | namespace EdgeOS.API 8 | { 9 | /// A class containing received EdgeOS data from a subscription. 10 | public class SubscriptionDataEvent : EventArgs 11 | { 12 | /// A C# object representing all of the JSON data EdgeOS has returned. 13 | public IResponse rootObject; 14 | 15 | /// Constructor, deserializes a JSON message into the IResponse. 16 | /// The JSON message from EdgeOS. 17 | /// The mappings for the JSON result types. 18 | public SubscriptionDataEvent(string message, Dictionary responseTypeMappings = null) 19 | { 20 | using (JsonTextReader reader = new JsonTextReader(new StringReader(message))) 21 | { 22 | // JSON streams always follow a specific path, so attempt to keep reading until we have our first property name. 23 | if (reader.Read() && reader.TokenType == JsonToken.StartObject && reader.Read() && reader.TokenType == JsonToken.PropertyName) 24 | { 25 | string propertyName = reader.Value.ToString(); 26 | 27 | if (responseTypeMappings.ContainsKey(propertyName)) 28 | { 29 | // EdgeOS has a very inconsistent way of returning data that means it is sometimes difficult to work out the type of the returned data. 30 | Type requestedType = responseTypeMappings[propertyName]; 31 | 32 | // Error if something cannot be deserialized. 33 | JsonSerializerSettings settings = new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error }; 34 | 35 | // Deserialize the JSON into C# objects. 36 | rootObject = (IResponse)JsonConvert.DeserializeObject(message, requestedType, settings); 37 | } 38 | else 39 | { 40 | // The property name is dynamic for console types. 41 | if (reader.Read() && reader.TokenType == JsonToken.String) 42 | { 43 | rootObject = new ConsoleResponse 44 | { 45 | sub_id = propertyName, 46 | Message = reader.Value.ToString() 47 | }; 48 | 49 | if (reader.Read() && reader.TokenType != JsonToken.EndObject && reader.Read() != false) { throw new NotImplementedException("The \"" + propertyName + "\" response is not implemeneted."); } 50 | } 51 | 52 | } 53 | } 54 | else 55 | { 56 | // The data did not follow the expected format or ran out of data too soon. 57 | throw new FormatException("Bad JSON data returned."); 58 | } 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Configuration/Configuration.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Configuration 4 | { 5 | /// A class representing an EdgeOS configuration tree. 6 | public class Configuration 7 | { 8 | /// Custom attribute name 9 | [JsonProperty(PropertyName = "custom-attribute")] 10 | public string[] CustomAttribute; 11 | 12 | /// Firewall 13 | [JsonProperty(PropertyName = "firewall")] 14 | public Firewall Firewall; 15 | 16 | /// Network interfaces 17 | [JsonProperty(PropertyName = "interfaces")] 18 | public object Interfaces; 19 | 20 | /// Load Balance 21 | [JsonProperty(PropertyName = "load-balance")] 22 | public object LoadBalance; 23 | 24 | /// Routing policy 25 | [JsonProperty(PropertyName = "policy")] 26 | public object Policy; 27 | 28 | /// Port forwarding 29 | [JsonProperty(PropertyName = "port-forward")] 30 | public object PortForward; 31 | 32 | /// Routing protocol parameters 33 | [JsonProperty(PropertyName = "protocols")] 34 | public object Protocols; 35 | 36 | /// Services 37 | [JsonProperty(PropertyName = "service")] 38 | public object Service; 39 | 40 | /// System parameters 41 | [JsonProperty(PropertyName = "system")] 42 | public object System; 43 | 44 | /// Traffic control (QOS) type 45 | [JsonProperty(PropertyName = "traffic-control")] 46 | public object TrafficControl; 47 | 48 | /// Quality of Service (QOS) policy type 49 | [JsonProperty(PropertyName = "traffic-policy")] 50 | public object TrafficPolicy; 51 | 52 | /// Virtual Private Network (VPN) 53 | [JsonProperty(PropertyName = "vpn")] 54 | public object VPN; 55 | 56 | /// Configure zone-policy 57 | [JsonProperty(PropertyName = "zone-policy")] 58 | public object ZonePolicy; 59 | } 60 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Configuration/ConfigurationBool.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace EdgeOS.API.Types.Configuration 4 | { 5 | /// EdgeOS Configuration Boolean. 6 | public enum ConfigurationBool : byte 7 | { 8 | /// This setting has not been configured. 9 | [EnumMember(Value = null)] 10 | NotConfigured, 11 | 12 | /// This setting is enabled. 13 | [EnumMember(Value = "enable")] 14 | Enable, 15 | 16 | /// This setting is disabled. 17 | [EnumMember(Value = "disable")] 18 | Disable 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Configuration/Firewall.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Configuration 4 | { 5 | /// A class representing an EdgeOS Firewall configuration tree. 6 | public class Firewall 7 | { 8 | /// Policy for handling of all IPv4 ICMP echo requests 9 | [JsonProperty(PropertyName = "all-ping")] 10 | public ConfigurationBool AllPing; 11 | 12 | /// Policy for handling broadcast IPv4 ICMP echo and timestamp requests 13 | [JsonProperty(PropertyName = "broadcast-ping")] 14 | public ConfigurationBool BroadcastPing; 15 | 16 | /// Firewall group 17 | [JsonProperty(PropertyName = "group")] 18 | public FirewallGroup Group; 19 | 20 | /// IPv6 modify rule-set name 21 | [JsonProperty(PropertyName = "ipv6-modify")] 22 | public object IPv6Modify; 23 | 24 | /// IPv6 firewall rule-set name 25 | [JsonProperty(PropertyName = "ipv6-name")] 26 | public object IPv6Name; 27 | 28 | /// Policy for handling received ICMPv6 redirect messages 29 | [JsonProperty(PropertyName = "ipv6-receive-redirects")] 30 | public ConfigurationBool IPv6ReceiveRedirects; 31 | 32 | /// Policy for handling IPv6 packets with routing extension header 33 | [JsonProperty(PropertyName = "ipv6-src-route")] 34 | public ConfigurationBool IPv6SrcRoute; 35 | 36 | /// Policy for handling IPv4 packets with source route option 37 | [JsonProperty(PropertyName = "ip-src-route")] 38 | public ConfigurationBool IPSrcRoute; 39 | 40 | /// Policy for logging IPv4 packets with invalid addresses 41 | [JsonProperty(PropertyName = "log-martians")] 42 | public ConfigurationBool LogMartians; 43 | 44 | /// IPv4 modify rule-set name 45 | [JsonProperty(PropertyName = "modify")] 46 | public object Modify; 47 | 48 | /// IPv4 firewall rule-set name 49 | [JsonProperty(PropertyName = "name")] 50 | public object Name; 51 | 52 | /// Firewall options 53 | [JsonProperty(PropertyName = "options")] 54 | public object Options; 55 | 56 | /// Policy for handling received IPv4 ICMP redirect messages 57 | [JsonProperty(PropertyName = "receive-redirects")] 58 | public ConfigurationBool ReceiveRedirects; 59 | 60 | /// Policy for sending IPv4 ICMP redirect messages 61 | [JsonProperty(PropertyName = "send-redirects")] 62 | public ConfigurationBool SendRedirects; 63 | 64 | /// Policy for source validation by reversed path, as specified in RFC3704 65 | [JsonProperty(PropertyName = "source-validation")] 66 | public ConfigurationBool SourceValidation; 67 | 68 | /// Policy for using TCP SYN cookies with IPv4 69 | [JsonProperty(PropertyName = "syn-cookies")] 70 | public ConfigurationBool SYNCookies; 71 | } 72 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Configuration/Firewall/FirewallGroup.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.Configuration 5 | { 6 | /// A class representing an EdgeOS Firewall Group configuration tree. 7 | public class FirewallGroup 8 | { 9 | /// Firewall address-group 10 | [JsonProperty(PropertyName = "address-group")] 11 | public Dictionary AddressGroup; 12 | 13 | /// Firewall address-group 14 | [JsonProperty(PropertyName = "ipv6-address-group")] 15 | public Dictionary IPv6AddressGroup; 16 | 17 | /// Firewall network-group 18 | [JsonProperty(PropertyName = "ipv6-network-group")] 19 | public Dictionary IPv6NetworkGroup; 20 | 21 | /// Firewall network-group 22 | [JsonProperty(PropertyName = "network-group")] 23 | public Dictionary NetworkGroup; 24 | 25 | /// Firewall port-group 26 | [JsonProperty(PropertyName = "port-group")] 27 | public Dictionary PortGroup; 28 | } 29 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Configuration/Firewall/Group/AddressGroupEntry.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Configuration 4 | { 5 | /// A class representing an EdgeOS Firewall Group AddressGroup Entry configuration tree. 6 | public class AddressGroupEntry 7 | { 8 | /// Address-group member 9 | [JsonProperty(PropertyName = "address")] 10 | public string[] Address; 11 | 12 | /// Address-group description 13 | [JsonProperty(PropertyName = "description")] 14 | public string Description; 15 | } 16 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/PingRequest.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace EdgeOS.API.Types 5 | { 6 | /// A class representing an ignored ping message to keep-alive the EdgeOS connection. 7 | public class PingRequest 8 | { 9 | /// EdgeOS empty string. 10 | [JsonProperty(PropertyName = "CLIENT_PING")] 11 | public string ClientPing = ""; 12 | 13 | /// EdgeOS authenticates based off a PHP session ID. 14 | [JsonProperty(PropertyName = "SESSION_ID")] 15 | public string SessionID; 16 | 17 | /// Prevent the compiler from creating a default constructor without the SessionID. 18 | private PingRequest() { } 19 | 20 | /// Constructor for a PingRequest that sets the required SessionID field. 21 | /// 22 | public PingRequest(string sessionID) 23 | { 24 | SessionID = sessionID; 25 | } 26 | 27 | /// Represents the class as a JSON string suitable for sending to the EdgeOS device. 28 | /// An EdgeOS friendly JSON string. 29 | public string ToJson() 30 | { 31 | return JsonConvert.SerializeObject(this, new StringEnumConverter()); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/AuthenticateResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | 5 | namespace EdgeOS.API.Types.REST 6 | { 7 | /// A class representing an authentication response from EdgeOS. 8 | public class AuthenticateResponse 9 | { 10 | /// Whether the API request was successful. 11 | [JsonProperty(PropertyName = "success")] 12 | public string Success; 13 | 14 | /// The error that occurred while trying to process this authentication request. 15 | [JsonProperty(PropertyName = "error")] 16 | public string Error; 17 | 18 | /// A value that represents the role / privilege level of the authenticated user. 19 | [JsonProperty(PropertyName = "level")] 20 | public PermissionLevel Level; 21 | 22 | /// Device uptime in seconds. 23 | [JsonProperty(PropertyName = "started")] 24 | public string Started; 25 | 26 | /// Whether the device is running the factory default configuration. 27 | [JsonProperty(PropertyName = "default-config")] 28 | public bool DefaultConfig; 29 | 30 | /// Contains information about the current device capabilities. 31 | [JsonProperty(PropertyName = "platform")] 32 | public EdgeOSPlatform Platform; 33 | 34 | /// A value that represents the role / privilege level of a user. 35 | public enum PermissionLevel 36 | { 37 | /// Not defined or configured. 38 | Unknown, 39 | 40 | /// The user can make changes to the EdgeRouter configuration. 41 | [EnumMember(Value = "admin")] 42 | Admin, 43 | 44 | /// The user can view the EdgeRouter configuration but cannot make changes. 45 | [EnumMember(Value = "operator")] 46 | Operator 47 | } 48 | 49 | /// Contains information about the device capabilities. 50 | public class EdgeOSPlatform 51 | { 52 | /// A string that represents a device model from devices.json. 53 | [JsonProperty(PropertyName = "model")] 54 | public string Model; 55 | 56 | /// A dictionary that represents the device Power over Ethernet (PoE) capabilities. 57 | [JsonProperty(PropertyName = "poe_cap")] 58 | public Dictionary PoECapabilities; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationDownloadPrepareResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a configuration download preparation response from EdgeOS. 6 | public class ConfigurationDownloadPrepareResponse 7 | { 8 | /// Status values for the configuration download preparation request. 9 | [JsonProperty(PropertyName = "CONFIG")] 10 | public ConfigurationDownloadPrepareStatus Configuration; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public bool Success; 15 | 16 | /// A class representing a single status item for a configuration download preparation response from EdgeOS. 17 | public class ConfigurationDownloadPrepareStatus 18 | { 19 | /// Whether the configuration save was successful. 20 | [JsonProperty(PropertyName = "success")] 21 | public byte Success; 22 | 23 | /// A temporary file path on the local device where the configuration was saved. 24 | [JsonProperty(PropertyName = "Path")] 25 | public string Path; 26 | 27 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 28 | /// A string showing the relation between all the fields in a human friendly readable format. 29 | public override string ToString() { return "Success : " + Success + (Path != null ? ", Path : \"" + Path + "\"": null); } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a configuration response from EdgeOS. 6 | public class ConfigurationResponse 7 | { 8 | /// Status values for the configuration request. 9 | [JsonProperty(PropertyName = "CONFIG")] 10 | public OperationStatus Configuration; 11 | 12 | /// The error(s) that occurred while trying to process this request. 13 | [JsonProperty(PropertyName = "errors")] 14 | public string[] Errors; 15 | 16 | /// Whether the API request was successful. 17 | [JsonProperty(PropertyName = "success")] 18 | public bool Success; 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsBatchRequest.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a batch configuration request to EdgeOS. 6 | public class ConfigurationSettingsBatchRequest 7 | { 8 | /// The JSON configuration attributes to set. 9 | [JsonProperty(PropertyName = "SET")] 10 | public Configuration.Configuration Set; 11 | 12 | /// The JSON configuration attributes to delete. 13 | [JsonProperty(PropertyName = "DELETE")] 14 | public Configuration.Configuration Delete; 15 | 16 | /// The JSON configuration attributes to get. 17 | [JsonProperty(PropertyName = "GET")] 18 | public Configuration.Configuration Get; 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsBatchResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a batch configuration response from EdgeOS. 6 | public class ConfigurationSettingsBatchResponse 7 | { 8 | /// Status values for the set request. 9 | [JsonProperty(PropertyName = "SET")] 10 | public ConfigurationSettingsStatus Set; 11 | 12 | /// Status values for the deletion request. 13 | [JsonProperty(PropertyName = "DELETE")] 14 | public ConfigurationSettingsStatus Delete; 15 | 16 | /// The authorisation string for this session that confirms the user is correctly authenticated. 17 | [JsonProperty(PropertyName = "SESSION_ID")] 18 | public string SessionID; 19 | 20 | /// The requested section of the configuration after the operation is performed (defaults to the requested section for deletion/setting by default). 21 | [JsonProperty(PropertyName = "GET")] 22 | public Configuration.Configuration Get; 23 | 24 | /// Status values for the configuration commit request. 25 | [JsonProperty(PropertyName = "COMMIT")] 26 | public ConfigurationSettingsStatus Commit; 27 | 28 | /// Status values for the configuration save request. 29 | [JsonProperty(PropertyName = "SAVE")] 30 | public ConfigurationSettingsStatus Save; 31 | 32 | /// Whether the API request was successful. 33 | [JsonProperty(PropertyName = "success")] 34 | public bool Success; 35 | } 36 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsDeleteResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a delete configuration response from EdgeOS. 6 | public class ConfigurationSettingsDeleteResponse 7 | { 8 | /// Status values for the deletion request. 9 | [JsonProperty(PropertyName = "DELETE")] 10 | public ConfigurationSettingsStatus Delete; 11 | 12 | /// The authorisation string for this session that confirms the user is correctly authenticated. 13 | [JsonProperty(PropertyName = "SESSION_ID")] 14 | public string SessionID; 15 | 16 | /// The parent section of the deleted value after the deletion. 17 | [JsonProperty(PropertyName = "GET")] 18 | public Configuration.Configuration Get; 19 | 20 | /// Status values for the configuration commit request. 21 | [JsonProperty(PropertyName = "COMMIT")] 22 | public ConfigurationSettingsStatus Commit; 23 | 24 | /// Status values for the configuration save request. 25 | [JsonProperty(PropertyName = "SAVE")] 26 | public ConfigurationSettingsStatus Save; 27 | 28 | /// Whether the API request was successful. 29 | [JsonProperty(PropertyName = "success")] 30 | public bool Success; 31 | } 32 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsGetResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a get configuration response from EdgeOS. 6 | public class ConfigurationSettingsGetResponse 7 | { 8 | /// The authorisation string for this session that confirms the user is correctly authenticated. 9 | [JsonProperty(PropertyName = "SESSION_ID")] 10 | public string SessionID; 11 | 12 | /// The requested section of the configuration. 13 | [JsonProperty(PropertyName = "GET")] 14 | public Configuration.Configuration Get; 15 | 16 | /// Whether the API request was successful. 17 | [JsonProperty(PropertyName = "success")] 18 | public bool Success; 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsGetTreeResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.REST 5 | { 6 | /// A class representing a configuration tree response from EdgeOS. 7 | public class ConfigurationSettingsGetTreeResponse 8 | { 9 | /// The requested tree section of the configuration. 10 | [JsonProperty(PropertyName = "GETCFG")] 11 | public GetConfig Get; 12 | 13 | /// Whether the API request was successful. 14 | [JsonProperty(PropertyName = "success")] 15 | public bool Success; 16 | 17 | /// An object that contains the sections of the configuration for the request. 18 | public class GetConfig 19 | { 20 | /// The requested children of the configuration. 21 | [JsonProperty(PropertyName = "children")] 22 | public object[] Children; 23 | 24 | /// The definitions of the requested configuration. 25 | [JsonProperty(PropertyName = "defs")] 26 | public Dictionary Definitions; 27 | 28 | /// An array of values contained within this configuration node. 29 | [JsonProperty(PropertyName = "tags")] 30 | public string[] Tags; 31 | 32 | /// Whether the operation was successful. 33 | [JsonProperty(PropertyName = "success")] 34 | public byte Success; 35 | 36 | /// The error that occurred while trying to process this GETCFG request. 37 | [JsonProperty(PropertyName = "error")] 38 | public string Error; 39 | 40 | /// An object that represents a particular configuration key or value. 41 | public class Definition 42 | { 43 | /// The type of the configurable value 44 | public enum ValueType { 45 | /// This value has not been set. 46 | Unknown, 47 | 48 | /// A string of text. 49 | txt, 50 | 51 | /// Unsigned 32bit number. 52 | u32, 53 | 54 | /// An IPv4 Address. 55 | ipv4, 56 | 57 | /// An IPv6 Address. 58 | ipv6, 59 | 60 | /// A true or false. 61 | @bool, 62 | 63 | /// A MAC Address. 64 | macaddr, 65 | 66 | /// An IPv4 Network (CIDR). 67 | ipv4net, 68 | 69 | /// An IPv6 Network (CIDR). 70 | ipv6net 71 | }; 72 | 73 | /// The type of the configurable value (in the format ). 74 | [JsonProperty(PropertyName = "type")] 75 | public ValueType Type; 76 | 77 | /// An additional permitted type of the configurable value (in the format ). 78 | [JsonProperty(PropertyName = "type2")] 79 | public ValueType Type2; 80 | 81 | /// A default value for this setting. 82 | [JsonProperty(PropertyName = "default")] 83 | public string Default; 84 | 85 | /// Whether this value can be specified multiple times. 86 | [JsonProperty(PropertyName = "multi")] 87 | public bool Multiple; 88 | 89 | /// Whether this is a tag (list in web UI) that can contain children. 90 | [JsonProperty(PropertyName = "tag")] 91 | public bool Tag; 92 | 93 | /// An explanation of the key or value that is used in the web UI as the tooltip text. 94 | [JsonProperty(PropertyName = "help")] 95 | public string Help; 96 | } 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsSetResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a set configuration response from EdgeOS. 6 | public class ConfigurationSettingsSetResponse 7 | { 8 | /// Status values for the insertion request. 9 | [JsonProperty(PropertyName = "SET")] 10 | public ConfigurationSettingsStatus Set; 11 | 12 | /// The authorisation string for this session that confirms the user is correctly authenticated. 13 | [JsonProperty(PropertyName = "SESSION_ID")] 14 | public string SessionID; 15 | 16 | /// The parent section of the set value after the set. 17 | [JsonProperty(PropertyName = "GET")] 18 | public Configuration.Configuration Get; 19 | 20 | /// Status values for the configuration commit request. 21 | [JsonProperty(PropertyName = "COMMIT")] 22 | public ConfigurationSettingsStatus Commit; 23 | 24 | /// Status values for the configuration save request. 25 | [JsonProperty(PropertyName = "SAVE")] 26 | public ConfigurationSettingsStatus Save; 27 | 28 | /// Whether the API request was successful. 29 | [JsonProperty(PropertyName = "success")] 30 | public bool Success; 31 | } 32 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ConfigurationSettingsStatus.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a single status item for the configuration settings response from EdgeOS. 6 | public class ConfigurationSettingsStatus 7 | { 8 | /// Whether the operation failed. 9 | [JsonProperty(PropertyName = "failure")] 10 | public byte Failure; 11 | 12 | /// Whether the operation was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public byte Success; 15 | 16 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 17 | /// A string showing the relation between all the fields in a human friendly readable format. 18 | public override string ToString() { return "Failure : " + Failure + ", Success : " + Success; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataDHCPLeasesResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.REST 5 | { 6 | /// A class representing a DHCP leases data response from EdgeOS. 7 | public class DataDHCPLeasesResponse 8 | { 9 | /// The output for the data request. 10 | [JsonProperty(PropertyName = "output")] 11 | public DataDHCPLeases Output; 12 | 13 | /// Whether the API request was successful. 14 | [JsonProperty(PropertyName = "success")] 15 | public byte Success; 16 | 17 | /// An object that contains each of the DHCP servers and their leases. 18 | public class DataDHCPLeases 19 | { 20 | /// A dictionary that contains each of the DHCP servers and their leases. 21 | [JsonProperty(PropertyName = "dhcp-server-leases")] 22 | public Dictionary DHCPServerLeases; 23 | 24 | /// An object that represents a particular DHCP server lease. 25 | public class DataDHCPLeaseDetails 26 | { 27 | /// The date of a specific lease expiry. 28 | [JsonProperty(PropertyName = "expiration")] 29 | public string Expiration; 30 | 31 | /// The pool this lease corresponds to (appears to be a repetition of the DHCP server name). 32 | [JsonProperty(PropertyName = "pool")] 33 | public string Pool; 34 | 35 | /// The MAC address of this particular DHCP server lease. 36 | [JsonProperty(PropertyName = "mac")] 37 | public string MAC; 38 | 39 | /// The client supplied hostname for a DHCP server lease. 40 | [JsonProperty(PropertyName = "client-hostname")] 41 | public string ClientHostname; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataDHCPStatisticsResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.REST 5 | { 6 | /// A class representing a DHCP statistics data response from EdgeOS. 7 | public class DataDHCPStatisticsResponse 8 | { 9 | /// The output for the data request. 10 | [JsonProperty(PropertyName = "output")] 11 | public DataDHCPServerStatistics Output; 12 | 13 | /// Whether the API request was successful. 14 | [JsonProperty(PropertyName = "success")] 15 | public byte Success; 16 | 17 | /// An object that contains each of the DHCP servers and their pool statistics. 18 | public class DataDHCPServerStatistics 19 | { 20 | /// A dictionary that contains each of the DHCP servers and their pool statistics. 21 | [JsonProperty(PropertyName = "dhcp-server-stats")] 22 | public Dictionary DHCPServerStatistics; 23 | 24 | /// An object that represents a particular DHCP server’s pool statistics. 25 | public class DataDHCPPoolStatistics 26 | { 27 | /// The total size of the dynamic DHCP pool. 28 | [JsonProperty(PropertyName = "pool_size")] 29 | public uint PoolSize; 30 | 31 | /// The number of dynamically leased addresses. 32 | [JsonProperty(PropertyName = "leased")] 33 | public uint Leased; 34 | 35 | /// The number of remaining available addresses in the dynamic DHCP pool. 36 | [JsonProperty(PropertyName = "available")] 37 | public uint Available; 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataDefaultConfigurationStatusResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a default configuration status data response from EdgeOS. 6 | public class DataDefaultConfigurationStatusResponse 7 | { 8 | /// The output for the data request. 9 | [JsonProperty(PropertyName = "output")] 10 | public DefaultConfigurationStatus Output; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public byte Success; 15 | 16 | /// The status of the configuration. 17 | public class DefaultConfigurationStatus 18 | { 19 | /// Whether the device is running the factory default configuration. 20 | [JsonProperty(PropertyName = "is_default")] 21 | public byte IsDefault; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataFirewallStatisticsResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.REST 5 | { 6 | /// A class representing a Firewall statistics data response from EdgeOS. 7 | public class DataFirewallStatisticsResponse 8 | { 9 | /// The output for the data request. 10 | [JsonProperty(PropertyName = "output")] 11 | public DataFirewallStatistics Output; 12 | 13 | /// Whether the API request was successful. 14 | [JsonProperty(PropertyName = "success")] 15 | public byte Success; 16 | 17 | /// An object that contains each of the firewall types (e.g. IPv4 and IPv6). 18 | public class DataFirewallStatistics 19 | { 20 | /// An array of dictionary items that contains each of the IPv4 firewall rulesets and their rule statistics. 21 | [JsonProperty(PropertyName = "name")] 22 | public Dictionary[] Name; 23 | 24 | /// An array of dictionary items that contains each of the IPv6 firewall rulesets and their rule statistics. 25 | [JsonProperty(PropertyName = "ipv6-name")] 26 | public Dictionary[] IPv6Name; 27 | 28 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 29 | /// A string showing the relation between all the fields in a human friendly readable format. 30 | public override string ToString() 31 | { 32 | return "Name: " + Name.Length + " Rulesets, IPv6Name: " + IPv6Name.Length + " Rulesets"; 33 | } 34 | 35 | /// An object that represents a particular firewall rule’s statistics.. 36 | public class DataFirewallRuleStatistics 37 | { 38 | /// The rule number for this particular firewall entry. 39 | [JsonProperty(PropertyName = "rule")] 40 | public uint Rule; 41 | 42 | /// The number of packets that this firewall rule has matched. 43 | [JsonProperty(PropertyName = "pkts")] 44 | public uint Packets; 45 | 46 | /// The number of bytes that this firewall rule has matched. 47 | [JsonProperty(PropertyName = "bytes")] 48 | public uint Bytes; 49 | 50 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 51 | /// A string showing the relation between all the fields in a human friendly readable format. 52 | public override string ToString() 53 | { 54 | return "Rule #" + Rule + " - Packets: " + Packets + ", Bytes: " + Bytes; 55 | } 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataNATStatisticsResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a Network Address Translation (NAT) statistics data response from EdgeOS. 6 | public class DataNATStatisticsResponse 7 | { 8 | /// The output for the data request. 9 | [JsonProperty(PropertyName = "output")] 10 | public NATStatistics Output; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public byte Success; 15 | 16 | /// The status of the configuration. 17 | public class NATStatistics 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/DataRoutesResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing the routes data response from EdgeOS. 6 | public class DataRoutesResponse 7 | { 8 | /// The output for the data request. 9 | [JsonProperty(PropertyName = "output")] 10 | public Routes[] Output; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public byte Success; 15 | 16 | /// The EdgeOS routes. 17 | public class Routes 18 | { 19 | /// The route prefix. 20 | [JsonProperty(PropertyName = "pfx")] 21 | public string Prefix; 22 | 23 | /// The route next hop information. 24 | [JsonProperty(PropertyName = "nh")] 25 | public NextHopDetails[] NextHop; 26 | 27 | /// Contains route next hop information. 28 | public class NextHopDetails 29 | { 30 | /// The different EdgeOS route types. 31 | public enum RouteType 32 | { 33 | /// Not defined or known. 34 | Unknown, 35 | 36 | /// A static route (used by blackhole, interface, gateway). 37 | Static = 'S', 38 | 39 | /// Connected route. 40 | Connected = 'C', 41 | 42 | /// Connected OSPF route. 43 | OSPF = 'O', 44 | 45 | /// Connected RIP route. 46 | RIP = 'R', 47 | 48 | /// Connected Kernel route. 49 | Kernel = 'K' 50 | } 51 | 52 | /// The route type (in the format RouteType, Selected, FIB e.g. S>*). 53 | [JsonProperty(PropertyName = "t")] 54 | public string Type; 55 | 56 | /// The metric information. 57 | [JsonProperty(PropertyName = "metric")] 58 | public string Metric; 59 | 60 | /// Whether this interface is a blackhole. 61 | [JsonProperty(PropertyName = "bh")] 62 | public byte Blackhole; 63 | 64 | /// The next hop address information. 65 | [JsonProperty(PropertyName = "via")] 66 | public string Via; 67 | 68 | /// The next hop interface. 69 | [JsonProperty(PropertyName = "intf")] 70 | public string Interface; 71 | 72 | /// Parses the EdgeOS Route Type value into its component parts. 73 | /// The converted route type components. 74 | public ConvertedRouteType GetConvertedRouteType() 75 | { 76 | return new ConvertedRouteType() 77 | { 78 | Type = (RouteType)Type[0], 79 | Selected = Type[2] == '>', 80 | FIB = Type[3] == '*' 81 | }; 82 | } 83 | 84 | /// The component parts of an EdgeOS route type. 85 | public class ConvertedRouteType 86 | { 87 | /// The type of this route. 88 | public RouteType Type; 89 | 90 | /// Whether the route is able to be used (or just declared in the config file). 91 | public bool Selected; 92 | 93 | /// Whether the route is in the Forwarding Information Base (FIB). 94 | public bool FIB; 95 | } 96 | } 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/ONURebootResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing an ONU reboot response from EdgeOS. 6 | public class ONURebootResponse 7 | { 8 | /// Status text for the reboot ONU request. 9 | [JsonProperty(PropertyName = "REBOOT_ONU")] 10 | public string RebootONU; 11 | 12 | /// The authorisation string for this session that confirms the user is correctly authenticated. 13 | [JsonProperty(PropertyName = "SESSION_ID")] 14 | public string SessionID; 15 | 16 | /// Whether the API request was successful. 17 | [JsonProperty(PropertyName = "success")] 18 | public bool Success; 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/OperationResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing an operation response from EdgeOS. 6 | public class OperationResponse 7 | { 8 | /// Status values for the operation request. 9 | [JsonProperty(PropertyName = "OPERATION")] 10 | public OperationStatus Operation; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public bool Success; 15 | } 16 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/OperationStatus.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a single status item for an operation response from EdgeOS. 6 | public class OperationStatus 7 | { 8 | /// Whether the operation was successful. 9 | [JsonProperty(PropertyName = "success")] 10 | public byte Success; 11 | 12 | /// The error that occurred while trying to process this request. 13 | [JsonProperty(PropertyName = "error")] 14 | public string Error; 15 | 16 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 17 | /// A string showing the relation between all the fields in a human friendly readable format. 18 | public override string ToString() { return "Success : " + Success + (Error != null ? ", Error \": " + Error + "\"": null); } 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/OperationSupportFileDownloadPrepareResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing a support file download preparation response from EdgeOS. 6 | public class OperationSupportFileDownloadPrepareResponse 7 | { 8 | /// Status values for the support file download preparation request. 9 | [JsonProperty(PropertyName = "OPERATION")] 10 | public ConfigurationDownloadPrepareStatus Operation; 11 | 12 | /// Whether the API request was successful. 13 | [JsonProperty(PropertyName = "success")] 14 | public bool Success; 15 | 16 | /// A class representing a single status item for the support file download preparation response from EdgeOS. 17 | public class ConfigurationDownloadPrepareStatus 18 | { 19 | /// Whether the support file save was successful. 20 | [JsonProperty(PropertyName = "success")] 21 | public byte Success; 22 | 23 | /// A temporary file path on the local device where the support file was saved. 24 | [JsonProperty(PropertyName = "Path")] 25 | public string Path; 26 | 27 | /// Outputs a human friendly readable form of the fields and their relations contained in this object. 28 | /// A string showing the relation between all the fields in a human friendly readable format. 29 | public override string ToString() { return "Success : " + Success + (Path != null ? ", Path : \"" + Path + "\"": null); } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/REST/UpgradeResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.REST 4 | { 5 | /// A class representing an upgrade response from EdgeOS. 6 | public class UpgradeResponse 7 | { 8 | /// Status values for the upgrade request. 9 | [JsonProperty(PropertyName = "UPGRADE")] 10 | public OperationStatus Upgrade; 11 | 12 | /// The error(s) that occurred while trying to process this request. 13 | [JsonProperty(PropertyName = "errors")] 14 | public string[] Errors; 15 | 16 | /// Whether the API request was successful. 17 | [JsonProperty(PropertyName = "success")] 18 | public bool Success; 19 | } 20 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscription.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Requests 2 | { 3 | /// Represents a subscription that calls an application (with no parameters) that returns the data as a value to a sub_id JSON property. Can be overridden for applications that require parameters. 4 | public class ConsoleSubscription : Subscription 5 | { 6 | /// The subscription ID that the JSON will contain as the property name for responses to this subscription request. 7 | public string sub_id; 8 | } 9 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/BandwidthTestClient.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 4 | { 5 | /// A request to run iperf as a client to an existing iperf server to test network bandwidth. 6 | public class BandwidthTestClient : ConsoleSubscription 7 | { 8 | /// Receiver IP. 9 | public string server; 10 | 11 | /// Duration in seconds (0 - 1000 or null). 12 | public ushort? duration; 13 | 14 | /// The protocol (e.g. UDP, TCP or null). 15 | public string protocol; 16 | 17 | /// The UDP bandwidth in Kbps (500 - 1000000 or null). 18 | [JsonProperty(PropertyName = "udp-bandwidth")] 19 | public uint? udpBandwidth; 20 | 21 | /// The number of parallel flows (1 - 20 or null). 22 | [JsonProperty(PropertyName = "parallel-flows")] 23 | public byte? parallelFlows; 24 | 25 | /// The TCP window size (64 - 1024 or null). 26 | [JsonProperty(PropertyName = "tcp-window-size")] 27 | public ushort? tcpWindowSize; 28 | 29 | /// Whether to reverse the direction. 30 | [JsonProperty(PropertyName = "reverse-direction")] 31 | public bool? reverseDirection; 32 | } 33 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/BandwidthTestServer.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Requests; 2 | using Newtonsoft.Json; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 5 | { 6 | /// A request to run iperf as a server to test network bandwidth. 7 | public class BandwidthTestServer : ConsoleSubscription 8 | { 9 | /// Whether to run the bandwidth test as a server. 10 | [JsonProperty(PropertyName = "server-mode")] 11 | public bool serverMode; 12 | } 13 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/FirewallStatistics.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Requests; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 4 | { 5 | /// Requests statistics from the firewall, optionally for a specific chain. 6 | public class FirewallStatistics : ConsoleSubscription 7 | { 8 | /// The firewall chain to specify. 9 | public string chain; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/PacketCaptureFeed.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Requests; 2 | using Newtonsoft.Json; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 5 | { 6 | /// A request to run tcpdump and capture packets. 7 | public class PacketCaptureFeed : ConsoleSubscription 8 | { 9 | /// The interface to capture on. 10 | [JsonProperty(PropertyName = "interface")] 11 | public string captureInterface; 12 | 13 | /// The packet capture limit (in number of packets). 14 | public string pkt_count; 15 | 16 | /// Whether to resolve addresses. 17 | public bool resolve; 18 | 19 | /// The filter protocol. 20 | public string f_proto = string.Empty; 21 | 22 | /// The filter address. 23 | public string f_address = string.Empty; 24 | 25 | /// The filter port. 26 | public string f_port = string.Empty; 27 | 28 | /// Whether to negate the filter. 29 | public bool f_neg; 30 | } 31 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/PingSubscription.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Requests; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 4 | { 5 | /// A request to ping a host. 6 | public class PingSubscription : ConsoleSubscription 7 | { 8 | /// The destination/host to ping. 9 | public string target; 10 | 11 | /// How many times to ping (1 - 4294967295). 12 | public uint? count; 13 | 14 | /// The packet size of each ping request (1 - 65507). 15 | public uint? size; 16 | } 17 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/ConsoleSubscriptions/TracertSubscription.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Requests.ConsoleSubscriptions 2 | { 3 | /// A request to run tracert to trace a route to a host. 4 | public class TracertSubscription : ConsoleSubscription 5 | { 6 | /// The destination host. 7 | public string target; 8 | 9 | /// Resolve IP addresses. 10 | public bool resolve; 11 | } 12 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/Subscription.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Requests 2 | { 3 | /// Represents a standard subscription with no parameters. Can be overriden to provide further parameters. 4 | public class Subscription 5 | { 6 | /// The name of the type of subscription we are requesting. 7 | public SubscriptionMessageType name; 8 | } 9 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/SubscriptionMessageType.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | using System.Runtime.Serialization; 4 | 5 | namespace EdgeOS.API.Types.Subscription.Requests 6 | { 7 | /// The type of messages that EdgeOS should deliver. 8 | [JsonConverter(typeof(StringEnumConverter))] 9 | public enum SubscriptionMessageType 10 | { 11 | // Returns JSON objects. 12 | 13 | /// Request messages containing status information when EdgeOS is processing a configuration change. 14 | [EnumMember(Value = "config-change")] 15 | ConfigurationChange, 16 | 17 | /// Request periodic messages containing discovered device information where EdgeOS has discovered another device (typically via UBNT Discovery). 18 | [EnumMember(Value = "discover")] 19 | DeviceDiscovery, 20 | 21 | /// Request periodic messages containing network interface information for each of the EdgeOS network interfaces. 22 | [EnumMember(Value = "interfaces")] 23 | Interfaces, 24 | 25 | /// Request periodic messages containing counts of the EdgeOS network routes. 26 | [EnumMember(Value = "num-routes")] 27 | NumberOfRoutes, 28 | 29 | /// Request periodic messages containing system statistics about the EdgeOS device. 30 | [EnumMember(Value = "system-stats")] 31 | SystemStatistics, 32 | 33 | /// Request periodic messages containing traffic analysis information for each host when EdgeOS has observed certain application types via Deep Packet Inspection (DPI). 34 | [EnumMember(Value = "export")] 35 | TrafficAnalysis, 36 | 37 | /// Request periodic messages containing the users logged into the EdgeOS device (including via SSH, Web and VPN). 38 | [EnumMember(Value = "users")] 39 | Users, 40 | 41 | /// Request periodic messages containing device statistics in a specific API format, potentially used by UNMS. 42 | [EnumMember(Value = "udapi-statistics")] 43 | UDAPIStatistics, 44 | 45 | // Returns RAW Console Output. 46 | 47 | /// Request periodic system log messages. 48 | [EnumMember(Value = "log-feed")] 49 | LogFeed, 50 | 51 | /// Request periodic Network Address Translation (NAT) statistics. 52 | [EnumMember(Value = "nat-stats")] 53 | NATStatistics, 54 | 55 | /// Request periodic port forwarding statistics. 56 | [EnumMember(Value = "pf-stats")] 57 | PortForwardingStatistics, 58 | 59 | // Returns RAW Console Output but requires additional parameters. 60 | 61 | /// Request a bandwidth test (using iperf) is performed or hosted. 62 | [EnumMember(Value = "bwtest-feed")] 63 | BandwidthTestFeed, 64 | 65 | /// Request periodic firewall statistics. 66 | [EnumMember(Value = "fw-stats")] 67 | FirewallStatistics, 68 | 69 | /// Request a packet capture (using tcpdump) is performed. 70 | [EnumMember(Value = "packets-feed")] 71 | PacketCaptureFeed, 72 | 73 | /// Request a ping is performed and the results are returned as they are available. 74 | [EnumMember(Value = "ping-feed")] 75 | PingFeed, 76 | 77 | /// Request to run tracert to trace a route to a host. 78 | [EnumMember(Value = "traceroute-feed")] 79 | TracerouteFeed, 80 | 81 | // Not Fully Implemented In This API Version. 82 | 83 | /// Request information about Link Layer Discovery Protocol (LLDP) connected neighbours. 84 | [EnumMember(Value = "lldp-detail")] 85 | LLDPNeighbours, 86 | 87 | /// List Network to Network Interface (NNI) statistics. 88 | [EnumMember(Value = "nni-stats")] 89 | NNIStatistics, 90 | 91 | /// List Optical Network Unit (ONU) details. 92 | [EnumMember(Value = "onu-list")] 93 | ONUList, 94 | 95 | /// List Passive Optical Network (PON) statistics. 96 | [EnumMember(Value = "pon-stats")] 97 | PONStatistics, 98 | }; 99 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Requests/SubscriptionRequest.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Requests 5 | { 6 | /// A class representing the required subscription and unsubscription of EdgeOS. 7 | public class SubscriptionRequest 8 | { 9 | /// EdgeOS message types that we wish to subscribe to. 10 | [JsonProperty(PropertyName = "SUBSCRIBE")] 11 | public Subscription[] Subscribe; 12 | 13 | /// EdgeOS message types that we wish to unsubscribe from. 14 | [JsonProperty(PropertyName = "UNSUBSCRIBE")] 15 | public Subscription[] Unsubscribe; 16 | 17 | /// EdgeOS authenticates based off a PHP session ID. 18 | [JsonProperty(PropertyName = "SESSION_ID")] 19 | public string SessionID; 20 | 21 | /// Represents the class as a JSON string suitable for sending to the EdgeOS device. 22 | /// An EdgeOS friendly JSON string. 23 | public string ToJson() 24 | { 25 | return JsonConvert.SerializeObject(this, new StringEnumConverter()); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/ConfigurationChangeResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses 4 | { 5 | /// A JSON message from EdgeOS that is serialised into this class. 6 | public class ConfigurationChangeResponse : IResponse 7 | { 8 | /// The object that contains status information when EdgeOS is processing a configuration change. 9 | [JsonProperty(PropertyName = "config-change")] 10 | public ConfigurationChangeDetails ConfigurationChange; 11 | 12 | /// An object that contains status information when EdgeOS is processing a configuration change. 13 | public class ConfigurationChangeDetails 14 | { 15 | /// The configuration change status message. 16 | public string commit; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/ConsoleResponse.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses 2 | { 3 | /// A string message from EdgeOS that is serialised into this class. 4 | public class ConsoleResponse : IResponse 5 | { 6 | /// The subscription ID that the JSON will contain as the property name for responses to this subscription request. 7 | public string sub_id; 8 | 9 | /// A generic JSON message from either a tool or an error message. 10 | public string Message; 11 | } 12 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/DiscoverResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses 4 | { 5 | /// A JSON message from EdgeOS that is serialised into this class. 6 | public class DiscoverResponse : IResponse 7 | { 8 | /// The object that contains discovered device information when EdgeOS has discovered another device (typically via UBNT Discovery). 9 | [JsonProperty(PropertyName = "discover")] 10 | public string Discover; 11 | } 12 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/IResponse.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses 2 | { 3 | /// A JSON message from EdgeOS that is serialised into this class. 4 | public interface IResponse 5 | { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/InterfacesResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Responses 5 | { 6 | /// A JSON message from EdgeOS that is serialised into this class. 7 | public class InterfacesResponse : IResponse 8 | { 9 | /// The object that contains network interface information for each of the EdgeOS network interfaces. 10 | [JsonProperty(PropertyName = "interfaces")] 11 | public Dictionary Interfaces; 12 | 13 | /// An object that contains network interface information for a specific EdgeOS network interface. 14 | public class Interface 15 | { 16 | /// Whether or not the interface is currently enabled. 17 | public bool up; 18 | 19 | /// Whether the physical layer is currently plugged-in. 20 | public bool l1up; 21 | 22 | /// Whether this interface is set to auto-negotiate. 23 | public bool autoneg; 24 | 25 | /// The duplex setting for this interface. 26 | public string duplex; 27 | 28 | /// The speed this interface is operating at. 29 | public ushort speed; 30 | 31 | /// Whether this interface is virtual. 32 | public bool on_switch; 33 | 34 | /// Whether this is an interface that can operate in either copper or in fiber mode. 35 | public bool is_combo; 36 | 37 | /// Whether this is an interface that has Small Form-factor Pluggable (SFP) support. 38 | public bool is_sfp; 39 | 40 | /// Whether a small form-factor pluggable module is physically present. 41 | public bool sfp_present; 42 | 43 | /// The MAC address for this interface. 44 | public string mac; 45 | 46 | /// The Maximum Transmission Unit (MTU) for this interface. 47 | public uint mtu; 48 | 49 | /// Any addresses assigned to this interface. 50 | public string[] addresses; 51 | 52 | /// A breakdown of statistics for this interface. 53 | public InterfaceStats stats; 54 | 55 | /// An object that contains network interface statistics information for a specific EdgeOS network interface. 56 | public class InterfaceStats 57 | { 58 | /// The number of packets this interface has received. 59 | public ulong rx_packets; 60 | 61 | /// The number of packets this interface has trasmitted. 62 | public ulong tx_packets; 63 | 64 | /// The number of bytes this interface has received. 65 | public ulong rx_bytes; 66 | 67 | /// The number of bytes this interface has trasmitted. 68 | public ulong tx_bytes; 69 | 70 | /// The number of frames this interface has failed to recieve. 71 | public ulong rx_errors; 72 | 73 | /// The number of frames this interface has failed to transmit. 74 | public ulong tx_errors; 75 | 76 | /// The number of packets received that were ultimately dropped. 77 | public ulong rx_dropped; 78 | 79 | /// The number of packets transmitted that were ultimately dropped. 80 | public ulong tx_dropped; 81 | 82 | /// The number of multicast packets processed by this interface. 83 | public ulong multicast; 84 | 85 | /// The current bits per second this interface is receiving. 86 | public ulong rx_bps; 87 | 88 | /// The current bits per second this interface is transmitting. 89 | public ulong tx_bps; 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/NumberOfRoutesResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses 4 | { 5 | /// A JSON message from EdgeOS that is serialised into this class. 6 | public class NumberOfRoutesResponse : IResponse 7 | { 8 | /// The object containing counts of the EdgeOS network routes. 9 | [JsonProperty(PropertyName = "num-routes")] 10 | public NumberOfRoutesDetails NumberOfRoutes; 11 | 12 | /// An object containing counts of the EdgeOS network routes. 13 | public class NumberOfRoutesDetails 14 | { 15 | /// The number of routes that are currently connected. 16 | [JsonProperty(PropertyName = "connected")] 17 | public byte connectedRoutes; 18 | 19 | /// The number of static routes. 20 | [JsonProperty(PropertyName = "static")] 21 | public byte staticRoutes; 22 | 23 | /// The total number of routes (should be the number of static + connected routes). 24 | [JsonProperty(PropertyName = "total")] 25 | public byte totalRoutes; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/SystemStatsResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses 4 | { 5 | /// A JSON message from EdgeOS that is serialised into this class. 6 | public class SystemStatsResponse : IResponse 7 | { 8 | /// The object containing system statistics about the EdgeOS device. 9 | [JsonProperty(PropertyName = "system-stats")] 10 | public SystemStatsDetails SystemStats; 11 | 12 | /// An object containing system statistics about the EdgeOS device. 13 | public class SystemStatsDetails 14 | { 15 | /// The CPU usage (as a percentage) of the EdgeOS device. 16 | public byte cpu; 17 | 18 | /// How long this EdgeOS device has been running for. 19 | public ushort uptime; 20 | 21 | /// The amount of memory in use (as a percentage) on the EdgeOS device. 22 | public byte mem; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/TrafficAnalysisResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Responses 5 | { 6 | /// A JSON message from EdgeOS that is serialised into this class. 7 | public class TrafficAnalysisResponse : IResponse 8 | { 9 | /// The object that contains traffic analysis information for each host when EdgeOS has observed certain application types via Deep Packet Inspection (DPI). 10 | [JsonProperty(PropertyName = "export")] 11 | public Dictionary> TrafficAnalysis; 12 | 13 | /// An object that contains traffic statistics for a certain observed application type via Deep Packet Inspection (DPI). 14 | public class ApplicationStats 15 | { 16 | /// The number of bytes transmitted from this observed application. 17 | [JsonProperty(PropertyName = "tx_bytes")] 18 | public uint tx_bytes; 19 | 20 | /// The rate at which bytes are currently being transmitted from this observed application. 21 | [JsonProperty(PropertyName = "tx_rate")] 22 | public uint tx_rate; 23 | 24 | /// The number of bytes received by this observed application. 25 | [JsonProperty(PropertyName = "rx_bytes")] 26 | public uint rx_bytes; 27 | 28 | /// The rate at which bytes are currently being received by this observed application. 29 | [JsonProperty(PropertyName = "rx_rate")] 30 | uint rx_rate; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPIStatisticsResponse.cs: -------------------------------------------------------------------------------- 1 | using EdgeOS.API.Types.Subscription.Responses.UDAPITypes; 2 | using Newtonsoft.Json; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Responses 5 | { 6 | /// A JSON message from EdgeOS that is serialised into this class. 7 | public class UDAPIStatisticsResponse : IResponse 8 | { 9 | /// The object containing device API statistics, potentially used by UNMS. 10 | [JsonProperty(PropertyName = "udapi-statistics")] 11 | public UDAPIStatistics[] UDAPIStatistics; 12 | } 13 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/CPU.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains information about a processor. 4 | public class CPU 5 | { 6 | /// How to refer to this CPU (typically its make and model). 7 | public string identifier; 8 | 9 | /// The current CPU load usage (as a percentage). 10 | public string usage; 11 | 12 | /// The physical temperature of this CPU if available. 13 | public string temperature; 14 | } 15 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/Device.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that represents a device. 4 | public class Device 5 | { 6 | /// Information about all the CPUs this device has. 7 | public CPU[] cpu; 8 | 9 | /// Information on this device's RAM. 10 | public RAM ram; 11 | 12 | /// Information about all the power supplys this device has. 13 | public Power[] power; 14 | 15 | /// Information about all the storage this device has. 16 | public Storage[] storage; 17 | 18 | /// Temperature readings from all of the temperature sensors on this device. 19 | public Temperature[] temperatures; 20 | 21 | /// Information about all the fans this device has. 22 | public FanSpeed[] fanSpeeds; 23 | 24 | /// How long this device has been powered for in seconds. 25 | public string uptime; 26 | } 27 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/FanSpeed.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 4 | { 5 | /// An object that contains information on a FanSpeed. 6 | public class FanSpeed 7 | { 8 | /// Unknown. 9 | [JsonProperty(PropertyName = "&ubnt_arr_type;")] 10 | public string ArrayType; 11 | } 12 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/Interface.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains Interface information on a single interface. 4 | public class Interface 5 | { 6 | /// The interface name. 7 | public string name; 8 | 9 | /// The ID for this interface. 10 | public string id; 11 | 12 | /// A breakdown of statistics for this interface. 13 | public UDAPIInterfaceStats statistics; 14 | } 15 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/InterfaceSFPStats.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains information on an interface's Small Form-factor Pluggable (SFP). 4 | public class InterfaceSFPStats 5 | { 6 | /// The temperature of the SFP module. 7 | public string temperature; 8 | 9 | /// The transmit power of the module. 10 | public string txPower; 11 | 12 | /// The receive power of the module. 13 | public string rxPower; 14 | 15 | /// The module voltage. 16 | public string voltage; 17 | 18 | /// The module current. 19 | public string current; 20 | } 21 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/InterfaceStats.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains statistics information on a single interface. 4 | public class UDAPIInterfaceStats 5 | { 6 | /// The current bits per second this interface is receiving. 7 | public string rxRate; 8 | 9 | /// The current bits per second this interface is transmitting. 10 | public string txRate; 11 | 12 | /// The number of bytes this interface has received. 13 | public string rxBytes; 14 | 15 | /// The number of bytes this interface has trasmitted. 16 | public string txBytes; 17 | 18 | /// The number of packets this interface has received. 19 | public string rxPackets; 20 | 21 | /// The number of packets this interface has trasmitted. 22 | public string txPackets; 23 | 24 | /// The total number of packets that were ultimately dropped. 25 | public string dropped; 26 | 27 | /// The number of packets received that were ultimately dropped. 28 | public string rxDropped; 29 | 30 | /// The number of packets transmitted that were ultimately dropped. 31 | public string txDropped; 32 | 33 | /// The total number of frames this interface has failed to process. 34 | public string errors; 35 | 36 | /// The number of frames this interface has failed to recieve. 37 | public string rxErrors; 38 | 39 | /// The number of frames this interface has failed to transmit. 40 | public string txErrors; 41 | 42 | /// Statistics on the Power over Ethernet (PoE) power. 43 | public string poePower; 44 | 45 | /// Statistics on the SFP port. 46 | public InterfaceSFPStats sfp; 47 | } 48 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/Power.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains information on a power supply. 4 | public class Power 5 | { 6 | /// The PSU type (AC, DC etc.). 7 | public string psuType; 8 | 9 | /// The PSU power (if available). 10 | public string power; 11 | 12 | /// The PSU voltage (if available). 13 | public string voltage; 14 | 15 | /// The PSU current (if available). 16 | public string current; 17 | 18 | /// The PSU temperature (if available). 19 | public string temperature; 20 | } 21 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/RAM.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains information on the Random Access Memory (RAM). 4 | public class RAM 5 | { 6 | /// The current RAM usage on the device (as a percentage). 7 | public string usage; 8 | 9 | /// How many bytes of RAM are free. 10 | public string free; 11 | 12 | /// How much total RAM is installed on the device. 13 | public string total; 14 | } 15 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/Storage.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object that contains information on the storage. 4 | public class Storage 5 | { 6 | /// The name of this storage. 7 | public string name; 8 | 9 | /// The type of storage this is (e.g. flash). 10 | public string type; 11 | 12 | /// The system's name for the storage (often the system device name such as /dev/root). 13 | public string sysName; 14 | 15 | /// How many bytes are used of the storage device. 16 | public string used; 17 | 18 | /// What the capacity of this storage device is. 19 | public string size; 20 | 21 | /// The physical temperature of this storage device (if available). 22 | public string temperature; 23 | } 24 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/Temperature.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 4 | { 5 | /// An object that contains a temperature reading. 6 | public class Temperature 7 | { 8 | /// Unknown. 9 | [JsonProperty(PropertyName = "&ubnt_arr_type;")] 10 | public string ArrayType; 11 | } 12 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UDAPITypes/UDAPIStatistics.cs: -------------------------------------------------------------------------------- 1 | namespace EdgeOS.API.Types.Subscription.Responses.UDAPITypes 2 | { 3 | /// An object containing device statistics in a specific API format, potentially used by UNMS. 4 | public class UDAPIStatistics 5 | { 6 | /// When this information was collected (in epoch). 7 | public string timestamp; 8 | 9 | /// Contains physical information about this device. 10 | public Device device; 11 | 12 | /// Contains information about this device's interfaces. 13 | public Interface[] interfaces; 14 | } 15 | } -------------------------------------------------------------------------------- /EdgeOS.API/Types/Subscription/Responses/UserResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace EdgeOS.API.Types.Subscription.Responses 5 | { 6 | /// A JSON message from EdgeOS that is serialised into this class. 7 | public class UserResponse : IResponse 8 | { 9 | /// The object that contains EdgeOS connected user information. 10 | [JsonProperty(PropertyName = "users")] 11 | public Users users; 12 | 13 | /// An object that contains connected EdgeOS user information. 14 | public class Users 15 | { 16 | /// The users currently connected. 17 | [JsonProperty(PropertyName = "local")] 18 | public Dictionary[] local; 19 | 20 | /// An object that contains locally connected EdgeOS user information. 21 | public class LocalUserInfo 22 | { 23 | /// The method the user is currently connected. 24 | public string tty; 25 | 26 | /// How long the user has been idle for. 27 | public string idle; 28 | 29 | /// The hostname the user has been resolved to (if known). 30 | public string host; 31 | 32 | /// How long the user has been connected for. 33 | public string uptime; 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /EdgeOS.API/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /EdgeOS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30128.74 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdgeOS.API", "EdgeOS.API\EdgeOS.API.csproj", "{7293F771-90DB-4D52-A651-4BD061B25D1E}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{BC771259-F293-42A0-8D8F-3D1AAA34147D}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigurationTreeWalker", "Examples\ConfigurationTreeWalker\ConfigurationTreeWalker.csproj", "{32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InterfacesChart", "Examples\InterfacesChart\InterfacesChart.csproj", "{D1033190-05B6-44D6-9E7B-3BE72E74CEDF}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogFeed", "Examples\LogFeed\LogFeed.csproj", "{09F1F624-43E2-4618-A448-2F015878D446}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebClientDemo", "Examples\WebClientDemo\WebClientDemo.csproj", "{0A06A074-7FBF-4989-9B4F-686C5AA022D5}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {7293F771-90DB-4D52-A651-4BD061B25D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {7293F771-90DB-4D52-A651-4BD061B25D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {7293F771-90DB-4D52-A651-4BD061B25D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {7293F771-90DB-4D52-A651-4BD061B25D1E}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {09F1F624-43E2-4618-A448-2F015878D446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {09F1F624-43E2-4618-A448-2F015878D446}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {09F1F624-43E2-4618-A448-2F015878D446}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {09F1F624-43E2-4618-A448-2F015878D446}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5}.Release|Any CPU.Build.0 = Release|Any CPU 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(NestedProjects) = preSolution 49 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB} = {BC771259-F293-42A0-8D8F-3D1AAA34147D} 50 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF} = {BC771259-F293-42A0-8D8F-3D1AAA34147D} 51 | {09F1F624-43E2-4618-A448-2F015878D446} = {BC771259-F293-42A0-8D8F-3D1AAA34147D} 52 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5} = {BC771259-F293-42A0-8D8F-3D1AAA34147D} 53 | EndGlobalSection 54 | GlobalSection(ExtensibilityGlobals) = postSolution 55 | SolutionGuid = {3433EB05-F422-498E-9293-58E538F44DC3} 56 | EndGlobalSection 57 | EndGlobal 58 | -------------------------------------------------------------------------------- /Examples/ConfigurationTreeWalker/ConfigurationTreeWalker.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {32B5A9EC-3E86-46D0-85ED-ADBD2EB30FBB} 8 | Exe 9 | ConfigurationTreeWalker 10 | ConfigurationTreeWalker 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {7293f771-90db-4d52-a651-4bd061b25d1e} 52 | EdgeOS.API 53 | 54 | 55 | 56 | 57 | echo Copying any new authorised self-signed or pinned certificate(s) to trust. 58 | xcopy "$(SolutionDir)Certificates\*.crt" "$(TargetDir)" /Y /D 59 | 60 | -------------------------------------------------------------------------------- /Examples/ConfigurationTreeWalker/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following set of attributes. 6 | // Change these attribute values to modify the information associated with an assembly. 7 | [assembly: AssemblyTitle("ConfigurationTreeWalker")] 8 | [assembly: AssemblyDescription("Walks through EdgeOS configuration and generates the classes for the API.")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Matthew1471!")] 11 | [assembly: AssemblyProduct("ConfigurationTreeWalker")] 12 | [assembly: AssemblyCopyright("Copyright © Matthew1471 2021")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. 17 | // If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("32b5a9ec-3e86-46d0-85ed-adbd2eb30fbb")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | [assembly: NeutralResourcesLanguage("en-GB")] -------------------------------------------------------------------------------- /Examples/InterfacesChart/App.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matthew1471/EdgeOS-API/f79f4ab682a31d9c2418db20f30d11727edf7e21/Examples/InterfacesChart/App.ico -------------------------------------------------------------------------------- /Examples/InterfacesChart/Credits.txt: -------------------------------------------------------------------------------- 1 | App.ico = https://www.iconfinder.com/icons/1376009/chart_graph_infographic_investment_report_stocks_icon -------------------------------------------------------------------------------- /Examples/InterfacesChart/InterfacesChart.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace InterfacesChart 2 | { 3 | partial class InterfacesChart 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | #region Windows Form Designer generated code 11 | 12 | /// 13 | /// Required method for Designer support - do not modify 14 | /// the contents of this method with the code editor. 15 | /// 16 | private void InitializeComponent() 17 | { 18 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 19 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 20 | System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 21 | System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); 22 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InterfacesChart)); 23 | this.bandwidthChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); 24 | ((System.ComponentModel.ISupportInitialize)(this.bandwidthChart)).BeginInit(); 25 | this.SuspendLayout(); 26 | // 27 | // bandwidthChart 28 | // 29 | this.bandwidthChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 30 | | System.Windows.Forms.AnchorStyles.Left) 31 | | System.Windows.Forms.AnchorStyles.Right))); 32 | chartArea1.AlignWithChartArea = "ChartAreaRx"; 33 | chartArea1.AxisX.LabelStyle.Enabled = false; 34 | chartArea1.Name = "ChartAreaTx"; 35 | chartArea2.AlignWithChartArea = "ChartAreaTx"; 36 | chartArea2.AxisX.LabelStyle.Enabled = false; 37 | chartArea2.Name = "ChartAreaRx"; 38 | this.bandwidthChart.ChartAreas.Add(chartArea1); 39 | this.bandwidthChart.ChartAreas.Add(chartArea2); 40 | legend1.LegendItemOrder = System.Windows.Forms.DataVisualization.Charting.LegendItemOrder.ReversedSeriesOrder; 41 | legend1.Name = "Legend1"; 42 | this.bandwidthChart.Legends.Add(legend1); 43 | this.bandwidthChart.Location = new System.Drawing.Point(13, 13); 44 | this.bandwidthChart.Name = "bandwidthChart"; 45 | this.bandwidthChart.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.None; 46 | this.bandwidthChart.Size = new System.Drawing.Size(479, 416); 47 | this.bandwidthChart.TabIndex = 0; 48 | this.bandwidthChart.Text = "chart1"; 49 | title1.Name = "Title1"; 50 | title1.Text = "Interfaces"; 51 | this.bandwidthChart.Titles.Add(title1); 52 | // 53 | // InterfacesChart 54 | // 55 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 56 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 57 | this.ClientSize = new System.Drawing.Size(504, 441); 58 | this.Controls.Add(this.bandwidthChart); 59 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 60 | this.Name = "InterfacesChart"; 61 | this.Text = "EdgeOS Bandwidth Chart"; 62 | this.Load += new System.EventHandler(this.FormBandwidthChart_Load); 63 | ((System.ComponentModel.ISupportInitialize)(this.bandwidthChart)).EndInit(); 64 | this.ResumeLayout(false); 65 | 66 | } 67 | 68 | #endregion 69 | 70 | private System.Windows.Forms.DataVisualization.Charting.Chart bandwidthChart; 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /Examples/InterfacesChart/InterfacesChart.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D1033190-05B6-44D6-9E7B-3BE72E74CEDF} 8 | WinExe 9 | InterfacesChart 10 | InterfacesChart 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | App.ico 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Form 51 | 52 | 53 | InterfacesChart.cs 54 | 55 | 56 | 57 | 58 | InterfacesChart.cs 59 | Designer 60 | 61 | 62 | ResXFileCodeGenerator 63 | Resources.Designer.cs 64 | Designer 65 | 66 | 67 | True 68 | Resources.resx 69 | 70 | 71 | SettingsSingleFileGenerator 72 | Settings.Designer.cs 73 | 74 | 75 | True 76 | Settings.settings 77 | True 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | {7293f771-90db-4d52-a651-4bd061b25d1e} 86 | EdgeOS.API 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | echo Copying any new authorised self-signed or pinned certificate(s) to trust. 95 | xcopy "$(SolutionDir)Certificates\*.crt" "$(TargetDir)" /Y /D 96 | 97 | -------------------------------------------------------------------------------- /Examples/InterfacesChart/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace InterfacesChart 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new InterfacesChart()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Examples/InterfacesChart/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following set of attributes. 6 | // Change these attribute values to modify the information associated with an assembly. 7 | [assembly: AssemblyTitle("InterfacesChart")] 8 | [assembly: AssemblyDescription("Connects to an EdgeOS device and charts its interface bandwidth.")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Matthew1471!")] 11 | [assembly: AssemblyProduct("InterfacesChart")] 12 | [assembly: AssemblyCopyright("Copyright © Matthew1471 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. 17 | // If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("d1033190-05b6-44d6-9e7b-3be72e74cedf")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | [assembly: NeutralResourcesLanguage("en-GB")] -------------------------------------------------------------------------------- /Examples/InterfacesChart/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace InterfacesChart.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InterfacesChart.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Examples/InterfacesChart/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace InterfacesChart.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Examples/InterfacesChart/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/InterfacesChart/Sample.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Examples/LogFeed/LogFeed.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {09F1F624-43E2-4618-A448-2F015878D446} 8 | Exe 9 | LogFeed 10 | LogFeed 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {7293F771-90DB-4D52-A651-4BD061B25D1E} 51 | EdgeOS.API 52 | 53 | 54 | 55 | 56 | echo Copying any new authorised self-signed or pinned certificate(s) to trust. 57 | xcopy "$(SolutionDir)Certificates\*.crt" "$(TargetDir)" /Y /D 58 | 59 | -------------------------------------------------------------------------------- /Examples/LogFeed/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following set of attributes. 6 | // Change these attribute values to modify the information associated with an assembly. 7 | [assembly: AssemblyTitle("LogFeed")] 8 | [assembly: AssemblyDescription("Connects to an EdgeOS device and retrieves its syslog messages.")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Matthew1471!")] 11 | [assembly: AssemblyProduct("LogFeed")] 12 | [assembly: AssemblyCopyright("Copyright © Matthew1471 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. 17 | // If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("09f1f624-43e2-4618-a448-2f015878d446")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | [assembly: NeutralResourcesLanguage("en-GB")] -------------------------------------------------------------------------------- /Examples/WebClientDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following set of attributes. 6 | // Change these attribute values to modify the information associated with an assembly. 7 | [assembly: AssemblyTitle("WebClientDemo")] 8 | [assembly: AssemblyDescription("Connects to an EdgeOS device and makes some example configuration changes.")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Matthew1471!")] 11 | [assembly: AssemblyProduct("WebClientDemo")] 12 | [assembly: AssemblyCopyright("Copyright © Matthew1471 2021")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. 17 | // If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("0a06a074-7fbf-4989-9b4f-686c5aa022d5")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | [assembly: NeutralResourcesLanguage("en-GB")] -------------------------------------------------------------------------------- /Examples/WebClientDemo/WebClientDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0A06A074-7FBF-4989-9B4F-686C5AA022D5} 8 | Exe 9 | WebClientDemo 10 | WebClientDemo 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {7293f771-90db-4d52-a651-4bd061b25d1e} 52 | EdgeOS.API 53 | 54 | 55 | 56 | 57 | echo Copying any new authorised self-signed or pinned certificate(s) to trust. 58 | xcopy "$(SolutionDir)Certificates\*.crt" "$(TargetDir)" /Y /D 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EdgeOS-API 2 | An API for Ubiquiti EdgeOS, the operating system used by Ubiquiti Inc's EdgeRouter & UFiber OLT products (part of the EdgeMAX product range). 3 | 4 | The EdgeOS API itself being documented at [Documentation/README.adoc](Documentation/README.adoc) -------------------------------------------------------------------------------- /Resources/Endpoint URLs.txt: -------------------------------------------------------------------------------- 1 | / 2 | /cli/ 3 | /files/config/ 4 | /files/support-file/ 5 | /logout 6 | /unms/connect -------------------------------------------------------------------------------- /Resources/ITQ Sample/WebSockets.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matthew1471/EdgeOS-API/f79f4ab682a31d9c2418db20f30d11727edf7e21/Resources/ITQ Sample/WebSockets.zip -------------------------------------------------------------------------------- /Resources/ITQ Sample/Websockets.txt: -------------------------------------------------------------------------------- 1 | https://itq.eu/wp-content/uploads/2013/09/WebSockets.zip -------------------------------------------------------------------------------- /Resources/REST Endpoint URLs.txt: -------------------------------------------------------------------------------- 1 | /api/edge/auth.json 2 | /api/edge/batch.json 3 | /api/edge/data.json 4 | /api/edge/delete.json 5 | /api/edge/feature.json 6 | /api/edge/get.json 7 | /api/edge/getcfg.json 8 | /api/edge/heartbeat.json 9 | /api/edge/partial.json 10 | /api/edge/set.json 11 | /api/edge/setup.json 12 | /api/edge/upgrade.json 13 | 14 | /api/edge/config/restore.json 15 | /api/edge/config/save.json 16 | 17 | /api/edge/onu/reboot.json 18 | /api/edge/onu/upgrade.json 19 | 20 | /api/edge/operation/get-support-file.json 21 | 22 | - /api/edge/operation/.json (via ubnt-util) - 23 | /api/edge/operation/clear-traffic-analysis.json 24 | /api/edge/operation/reboot.json 25 | /api/edge/operation/refresh-fw-latest-status.json 26 | /api/edge/operation/release-dhcp.json 27 | /api/edge/operation/renew-dhcp.json 28 | /api/edge/operation/reset-default-config.json 29 | /api/edge/operation/shutdown.json 30 | 31 | /api/olt/get-onu-macs.json 32 | 33 | /api/olt/onu/get-support-file.json 34 | /api/olt/onu/get-wifi-clients.json 35 | /api/olt/onu/locate.json 36 | /api/olt/onu/reset.json 37 | /api/olt/onu/support-file/ 38 | 39 | /api/wizard/$type$/$key$.json 40 | /api/wizard/all.json 41 | /api/wizard/create.json 42 | /api/wizard/remove/$key$.json 43 | /api/wizard/runtime.json 44 | /api/wizard/upload.json -------------------------------------------------------------------------------- /Resources/Useful URLs.txt: -------------------------------------------------------------------------------- 1 | https://ubntwiki.com/products/software/edgeos/api 2 | https://caitiem.com/2013/12/02/a-websocket-primer/ 3 | http://thesoftwarechef.blogspot.com/2013/09/websockets-in-net-45.html 4 | https://webcache.googleusercontent.com/search?q=cache:X7yi9rABZHkJ:https://itq.eu/net-4-5-websocket-client-without-a-browser/+ 5 | https://gist.github.com/xamlmonkey/4737291 -------------------------------------------------------------------------------- /Resources/Windows UWP Sample/WebSocket_sample.txt: -------------------------------------------------------------------------------- 1 | https://docs.microsoft.com/en-us/samples/microsoft/windows-universal-samples/websocket/ -------------------------------------------------------------------------------- /Resources/Windows UWP Sample/WebSocket_sample.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matthew1471/EdgeOS-API/f79f4ab682a31d9c2418db20f30d11727edf7e21/Resources/Windows UWP Sample/WebSocket_sample.zip -------------------------------------------------------------------------------- /ToDo.adoc: -------------------------------------------------------------------------------- 1 | * General - Wizard Feature 2 | * General - Wizard Setup 3 | * Wizard - Download Specific Wizard 4 | * JSON - Interfaces --------------------------------------------------------------------------------