mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-23 05:42:34 +02:00

* use auto generated schemas * go version bump and dependencies upgrade * clarify some error messages --------- Co-authored-by: yusing <yusing@6uo.me>
364 lines
13 KiB
JSON
364 lines
13 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"CIDR": {
|
|
"anyOf": [
|
|
{
|
|
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"pattern": "^.*:.*:.*:.*:.*:.*:.*:.*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*/[0-9]*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"pattern": "^::[0-9]*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"pattern": "^.*::/[0-9]*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"pattern": "^.*:.*::/[0-9]*$",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"MiddlewareComposeMap": {
|
|
"anyOf": [
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"use": {
|
|
"enum": [
|
|
"CustomErrorPage",
|
|
"ErrorPage",
|
|
"customErrorPage",
|
|
"custom_error_page",
|
|
"errorPage",
|
|
"error_page"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"use": {
|
|
"enum": [
|
|
"RedirectHTTP",
|
|
"redirectHTTP",
|
|
"redirect_http"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"use": {
|
|
"enum": [
|
|
"SetXForwarded",
|
|
"setXForwarded",
|
|
"set_x_forwarded"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"use": {
|
|
"enum": [
|
|
"HideXForwarded",
|
|
"hideXForwarded",
|
|
"hide_x_forwarded"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"allow": {
|
|
"items": {
|
|
"$ref": "#/definitions/CIDR"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"message": {
|
|
"default": "IP not allowed",
|
|
"description": "Error message when blocked",
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/StatusCode",
|
|
"default": 403,
|
|
"description": "HTTP status code when blocked (alias of status_code)"
|
|
},
|
|
"status_code": {
|
|
"$ref": "#/definitions/StatusCode",
|
|
"default": 403,
|
|
"description": "HTTP status code when blocked"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"CIDRWhitelist",
|
|
"cidrWhitelist",
|
|
"cidr_whitelist"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"allow",
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"recursive": {
|
|
"default": false,
|
|
"description": "Recursively resolve the IP",
|
|
"type": "boolean"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"cloudflareRealIp",
|
|
"cloudflare_real_ip"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"add_headers": {
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
},
|
|
"description": "Add HTTP headers",
|
|
"type": "object"
|
|
},
|
|
"hide_headers": {
|
|
"description": "Hide HTTP headers",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"set_headers": {
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
},
|
|
"description": "Set HTTP headers",
|
|
"type": "object"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"ModifyRequest",
|
|
"Request",
|
|
"modifyRequest",
|
|
"modify_request",
|
|
"request"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"add_headers": {
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
},
|
|
"description": "Add HTTP headers",
|
|
"type": "object"
|
|
},
|
|
"hide_headers": {
|
|
"description": "Hide HTTP headers",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"set_headers": {
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
},
|
|
"description": "Set HTTP headers",
|
|
"type": "object"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"ModifyResponse",
|
|
"Response",
|
|
"modifyResponse",
|
|
"modify_response",
|
|
"response"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"allowed_groups": {
|
|
"description": "Allowed groups",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"minItems": 1,
|
|
"type": "array"
|
|
},
|
|
"allowed_users": {
|
|
"description": "Allowed users",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"minItems": 1,
|
|
"type": "array"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"OIDC",
|
|
"oidc"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"average": {
|
|
"description": "Average number of requests allowed in a period",
|
|
"type": "number"
|
|
},
|
|
"burst": {
|
|
"description": "Maximum number of requests allowed in a period",
|
|
"type": "number"
|
|
},
|
|
"period": {
|
|
"default": "1s",
|
|
"description": "Duration of the rate limit",
|
|
"pattern": "^([0-9]+(ms|s|m|h))+$",
|
|
"type": "string"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"RateLimit",
|
|
"rateLimit",
|
|
"rate_limit"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"average",
|
|
"burst",
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"from": {
|
|
"items": {
|
|
"$ref": "#/definitions/CIDR"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"header": {
|
|
"default": "X-Real-IP",
|
|
"description": "Header to get the client IP from",
|
|
"pattern": "^[a-zA-Z0-9\\-]+$",
|
|
"type": "string"
|
|
},
|
|
"recursive": {
|
|
"default": false,
|
|
"description": "Recursive resolve the IP",
|
|
"type": "boolean"
|
|
},
|
|
"use": {
|
|
"enum": [
|
|
"RealIP",
|
|
"realIP",
|
|
"real_ip"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"from",
|
|
"use"
|
|
],
|
|
"type": "object"
|
|
}
|
|
]
|
|
},
|
|
"StatusCode": {
|
|
"anyOf": [
|
|
{
|
|
"pattern": "^[0-9]*$",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "number"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"items": {
|
|
"$ref": "#/definitions/MiddlewareComposeMap"
|
|
},
|
|
"type": "array"
|
|
}
|
|
|