diff --git a/ennstatus/api/schema/server.json b/ennstatus/api/schema/server.json new file mode 100644 --- /dev/null +++ b/ennstatus/api/schema/server.json @@ -0,0 +1,255 @@ +{ + "title": "Relay/Exit schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/status_data" + }, + "tor_status": { + "$ref": "#/definitions/status_data" + }, + "country": { + "type": "string", + "enum": [ + "Afghanistan", "Aland Islands", "Albania", "Algeria", + "American Samoa", "Andorra", "Angola", "Anguilla", + "Anonymous Proxy", "Antarctica", "Antigua and Barbuda", + "Argentina", "Armenia", "Aruba", "Asia/Pacific Region", + "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", + "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", + "Benin", "Bermuda", "Bhutan", "Bolivia", + "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", + "Botswana", "Bouvet Island", "Brazil", + "British Indian Ocean Territory", "Brunei Darussalam", + "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", + "Cameroon", "Canada", "Cape Verde", "Cayman Islands", + "Central African Republic", "Chad", "Chile", "China", + "Christmas Island", "Cocos (Keeling) Islands", "Colombia", + "Comoros", "Congo", "Congo, The Democratic Republic of the", + "Cook Islands", "Costa Rica", "Cote D'Ivoire", "Croatia", + "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", + "Dominica", "Dominican Republic", "Ecuador", "Egypt", + "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", + "Ethiopia", "Europe", "Falkland Islands (Malvinas)", + "Faroe Islands", "Fiji", "Finland", "France", + "France, Metropolitan", "French Guiana", "French Polynesia", + "French Southern Territories", "Gabon", "Gambia", "Georgia", + "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", + "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", + "Guinea", "Guinea-Bissau", "Guyana", "Haiti", + "Heard Island and McDonald Islands", + "Holy See (Vatican City State)", "Honduras", "Hong Kong", + "Hungary", "Iceland", "India", "Indonesia", + "Iran, Islamic Republic of", "Iraq", "Ireland", "Isle of Man", + "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", + "Kazakhstan", "Kenya", "Kiribati", + "Korea, Democratic People's Republic of", + "Korea, Republic of", "Kuwait", "Kyrgyzstan", + "Lao People's Democratic Republic", "Latvia", "Lebanon", + "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", + "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", + "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", + "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", + "Micronesia, Federated States of", "Moldova, Republic of", + "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", + "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", + "Netherlands", "Netherlands Antilles", "New Caledonia", + "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", + "Norfolk Island", "Northern Mariana Islands", "Norway", + "Oman", "Other", "Pakistan", "Palau", "Palestinian Territory", + "Panama", "Papua New Guinea", "Paraguay", "Peru", + "Philippines", "Pitcairn Islands", "Poland", "Portugal", + "Puerto Rico", "Qatar", "Reunion", "Romania", + "Russian Federation", "Rwanda", "Saint Barthelemy", + "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia", + "Saint Martin", "Saint Pierre and Miquelon", + "Saint Vincent and the Grenadines", "Samoa", "San Marino", + "Sao Tome and Principe", "Satellite Provider", "Saudi Arabia", + "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", + "Slovakia", "Slovenia", "Solomon Islands", "Somalia", + "South Africa", "South Georgia and the South Sandwich Islands", + "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", + "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", + "Syrian Arab Republic", "Taiwan", "Tajikistan", + "Tanzania, United Republic of", "Thailand", "Timor-Leste", + "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", + "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", + "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", + "United States", "United States Minor Outlying Islands", + "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", + "Virgin Islands, British", "Virgin Islands, U.S.", + "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", + "Zimbabwe" + ] + }, + "fingerprint": { + "type": "string", + "pattern": "^[a-zA-Z0-9]{40}$" + }, + "last_updated": { + "type": "string", + "format": "date-time" + }, + "bandwith": { + "type": [ + "string", + "null" + ], + "default": null + }, + "type": { + "type": "string" + } + }, + "required": [ + "name", + "status", + "tor_status", + "last_updated", + "country", + "fingerprint", + "type" + ], + "definitions": { + "weights": { + "type": "object", + "properties": { + "1_week": { + "$ref": "#/definitions/weights_data" + }, + "1_month": { + "$ref": "#/definitions/weights_data" + }, + "3_months": { + "$ref": "#/definitions/weights_data" + }, + "1_year": { + "$ref": "#/definitions/weights_data" + }, + "5_years": { + "$ref": "#/definitions/weights_data" + } + }, + "required": [ + "1_week", + "1_month", + "3_months", + "1_year", + "5_years" + ], + "additionalProperties": false + }, + "weights_data": { + "type": [ + "number", + "null" + ], + "default": null + }, + "status_data": { + "type": [ + "boolean", + "null" + ], + "default": null + } + }, + "anyOf": [ + { + "properties": { + "type": { + "enum": [ + "exit", + "relay" + ] + }, + "ip": { + "type": "string", + "format": "ipv4" + }, + "ip6": { + "type": "string", + "format": "ipv6" + }, + "mean_consensus_weight": { + "$ref": "#/definitions/weights" + }, + "mean_guard_probability": { + "$ref": "#/definitions/weights" + }, + "mean_exit_probability": { + "$ref": "#/definitions/weights" + }, + "mean_middle_probability": { + "$ref": "#/definitions/weights" + }, + "mean_consensus_weight_fraction": { + "$ref": "#/definitions/weights" + } + }, + "required": [ + "ip" + ], + "not": { + "required": [ + "obfs", + "fteproxy", + "flashproxy", + "meek" + ] + } + }, + { + "properties": { + "type": { + "enum": [ + "bridge" + ] + }, + "obfs": { + "type": [ + "boolean", + "null" + ] + }, + "fteproxy": { + "type": [ + "boolean", + "null" + ] + }, + "flashproxy": { + "type": [ + "boolean", + "null" + ] + }, + "meek": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "obfs", + "fteproxy", + "flashproxy", + "meek" + ], + "not": { + "required": [ + "ip", + "ip6", + "mean_consensus_weight", + "mean_guard_probability", + "mean_exit_probability" + ] + } + } + ] +}