Skip to content

Commit

Permalink
Merge pull request #38 from G-Core/feature/CDN-6181_options
Browse files Browse the repository at this point in the history
CDN-6181 add missing options
  • Loading branch information
freenoth authored Jun 9, 2023
2 parents a189e4e + 7efd177 commit ce4ebb4
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# IDE and editors
.idea

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
272 changes: 215 additions & 57 deletions gcore/options.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,91 @@
package gcore

type Options struct {
EdgeCacheSettings *EdgeCacheSettings `json:"edge_cache_settings"`
BrowserCacheSettings *BrowserCacheSettings `json:"browser_cache_settings"`
HostHeader *HostHeader `json:"hostHeader"`
Webp *Webp `json:"webp"`
Rewrite *Rewrite `json:"rewrite"`
RedirectHttpToHttps *RedirectHttpToHttps `json:"redirect_http_to_https"`
RequestLimiter *RequestLimiter `json:"request_limiter"`
GzipOn *GzipOn `json:"gzipOn"`
Cors *Cors `json:"cors"`
SNI *SNIOption `json:"sni"`
IgnoreQueryString *IgnoreQueryString `json:"ignoreQueryString"`
QueryParamsWhitelist *QueryParamsWhitelist `json:"query_params_whitelist"`
QueryParamsBlacklist *QueryParamsBlacklist `json:"query_params_blacklist"`
StaticRequestHeaders *StaticRequestHeaders `json:"staticRequestHeaders"`
StaticHeaders *StaticHeaders `json:"staticHeaders"`
CacheHttpHeaders *CacheHttpHeaders `json:"cache_http_headers"`
WebSockets *WebSockets `json:"websockets"`
TLSVersions *TLSVersions `json:"tls_versions"`
UseRSALECert *UseRSALECert `json:"use_rsa_le_cert"`
ForceReturn *ForceReturn `json:"force_return"`
AllowedHTTPMethods *AllowedHTTPMethods `json:"allowedHttpMethods"`
BrotliCompression *BrotliCompression `json:"brotli_compression"`
BrowserCacheSettings *BrowserCacheSettings `json:"browser_cache_settings"`
CacheHttpHeaders *CacheHttpHeaders `json:"cache_http_headers"` // deprecated in favor of response_headers_hiding_policy
Cors *Cors `json:"cors"`
CountryACL *CountryACL `json:"country_acl"`
DisableCache *DisableCache `json:"disable_cache"`
DisableProxyForceRanges *DisableProxyForceRanges `json:"disable_proxy_force_ranges"`
EdgeCacheSettings *EdgeCacheSettings `json:"edge_cache_settings"`
FetchCompressed *FetchCompressed `json:"fetch_compressed"`
FollowOriginRedirect *FollowOriginRedirect `json:"follow_origin_redirect"`
ForceReturn *ForceReturn `json:"force_return"`
ForwardHostHeader *ForwardHostHeader `json:"forward_host_header"`
GzipOn *GzipOn `json:"gzipOn"`
HostHeader *HostHeader `json:"hostHeader"`
HTTP3Enabled *HTTP3Enabled `json:"http3_enabled"`
IgnoreCookie *IgnoreCookie `json:"ignore_cookie"`
IgnoreQueryString *IgnoreQueryString `json:"ignoreQueryString"`
ImageStack *ImageStack `json:"image_stack"`
IPAddressACL *IPAddressACL `json:"ip_address_acl"`
LimitBandwidth *LimitBandwidth `json:"limit_bandwidth"`
ProxyCacheMethodsSet *ProxyCacheMethodsSet `json:"proxy_cache_methods_set"`
QueryParamsBlacklist *QueryParamsBlacklist `json:"query_params_blacklist"`
QueryParamsWhitelist *QueryParamsWhitelist `json:"query_params_whitelist"`
RedirectHttpsToHttp *RedirectHttpsToHttp `json:"redirect_https_to_http"`
RedirectHttpToHttps *RedirectHttpToHttps `json:"redirect_http_to_https"`
ReferrerACL *ReferrerACL `json:"referrer_acl"`
RequestLimiter *RequestLimiter `json:"request_limiter"`
ResponseHeadersHidingPolicy *ResponseHeadersHidingPolicy `json:"response_headers_hiding_policy"`
Rewrite *Rewrite `json:"rewrite"`
SecureKey *SecureKey `json:"secure_key"`
Slice *Slice `json:"slice"`
SNI *SNIOption `json:"sni"`
Stale *Stale `json:"stale"`
StaticHeaders *StaticHeaders `json:"staticHeaders"` // deprecated in favor of static_response_headers
StaticRequestHeaders *StaticRequestHeaders `json:"staticRequestHeaders"`
StaticResponseHeaders *StaticResponseHeaders `json:"static_response_headers"`
TLSVersions *TLSVersions `json:"tls_versions"`
UseDefaultLEChain *UseDefaultLEChain `json:"use_default_le_chain"`
UserAgentACL *UserAgentACL `json:"user_agent_acl"`
UseRSALECert *UseRSALECert `json:"use_rsa_le_cert"`
Webp *Webp `json:"webp"` // deprecated in favor of image_stack
WebSockets *WebSockets `json:"websockets"`
}

type AllowedHTTPMethods struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type BrotliCompression struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type BrowserCacheSettings struct {
Enabled bool `json:"enabled"`
Value string `json:"value"`
}

// deprecated in favor of ResponseHeadersHidingPolicy
type CacheHttpHeaders struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type Cors struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type CountryACL struct {
Enabled bool `json:"enabled"`
PolicyType string `json:"policy_type"`
ExceptedValues []string `json:"excepted_values"`
}

type DisableCache struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type DisableProxyForceRanges struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type EdgeCacheSettings struct {
Expand All @@ -30,34 +95,104 @@ type EdgeCacheSettings struct {
Default string `json:"default"`
}

type HostHeader struct {
type FetchCompressed struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type FollowOriginRedirect struct {
Enabled bool `json:"enabled"`
Codes []int `json:"codes"`
}

type ForceReturn struct {
Enabled bool `json:"enabled"`
Value string `json:"value"`
Code int `json:"code"`
Body string `json:"body"`
}

type BrowserCacheSettings struct {
type ForwardHostHeader struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type GzipOn struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type HostHeader struct {
Enabled bool `json:"enabled"`
Value string `json:"value"`
}

type Webp struct {
type HTTP3Enabled struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type IgnoreCookie struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type IgnoreQueryString struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type ImageStack struct {
Enabled bool `json:"enabled"`
JPGQuality int `json:"jpg_quality"`
PNGQuality int `json:"png_quality"`
PNGLossless bool `json:"png_lossless"`
AvifEnabled bool `json:"avif_enabled"`
WebpEnabled bool `json:"webp_enabled"`
Quality int `json:"quality"`
PngLossless bool `json:"png_lossless"`
}

type Rewrite struct {
Enabled bool `json:"enabled"`
Body string `json:"body"`
Flag string `json:"flag"`
type IPAddressACL struct {
Enabled bool `json:"enabled"`
PolicyType string `json:"policy_type"`
ExceptedValues []string `json:"excepted_values"`
}

type LimitBandwidth struct {
Enabled bool `json:"enabled"`
LimitType string `json:"limit_type"`
Speed int `json:"speed"`
Buffer int `json:"buffer"`
}

type ProxyCacheMethodsSet struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type QueryParamsBlacklist struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type QueryParamsWhitelist struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type RedirectHttpsToHttp struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type RedirectHttpToHttps struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type ReferrerACL struct {
Enabled bool `json:"enabled"`
PolicyType string `json:"policy_type"`
ExceptedValues []string `json:"excepted_values"`
}

type RequestLimiter struct {
Enabled bool `json:"enabled"`
Rate int `json:"rate"`
Expand All @@ -66,69 +201,92 @@ type RequestLimiter struct {
Delay int `json:"delay"`
}

type GzipOn struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
type ResponseHeadersHidingPolicy struct {
Enabled bool `json:"enabled"`
Mode string `json:"mode"`
Excepted []string `json:"excepted"`
}

type Cors struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
type Rewrite struct {
Enabled bool `json:"enabled"`
Body string `json:"body"`
Flag string `json:"flag"`
}

type SNIOption struct {
Enabled bool `json:"enabled"`
SNIType string `json:"sni_type"`
CustomHostname string `json:"custom_hostname"`
type SecureKey struct {
Enabled bool `json:"enabled"`
Key string `json:"key"`
Type int `json:"type"`
}

type IgnoreQueryString struct {
type Slice struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type QueryParamsWhitelist struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
type SNIOption struct {
Enabled bool `json:"enabled"`
SNIType string `json:"sni_type"`
CustomHostname string `json:"custom_hostname"`
}

type QueryParamsBlacklist struct {
type Stale struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type StaticRequestHeaders struct {
// deprecated in favor of StaticResponseHeaders
type StaticHeaders struct {
Enabled bool `json:"enabled"`
Value map[string]string `json:"value"`
}

type StaticHeaders struct {
type StaticRequestHeaders struct {
Enabled bool `json:"enabled"`
Value map[string]string `json:"value"`
}

type CacheHttpHeaders struct {
type StaticResponseHeadersItem struct {
Name string `json:"name"`
Value []string `json:"value"`
Always bool `json:"always"`
}

type StaticResponseHeaders struct {
Enabled bool `json:"enabled"`
Value []StaticResponseHeadersItem `json:"value"`
}

type TLSVersions struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
}

type WebSockets struct {
type UseDefaultLEChain struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type TLSVersions struct {
Enabled bool `json:"enabled"`
Value []string `json:"value"`
type UserAgentACL struct {
Enabled bool `json:"enabled"`
PolicyType string `json:"policy_type"`
ExceptedValues []string `json:"excepted_values"`
}

type UseRSALECert struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

type ForceReturn struct {
Enabled bool `json:"enabled"`
Code int `json:"code"`
Body string `json:"body"`
// deprecated in favor of ImageStack
type Webp struct {
Enabled bool `json:"enabled"`
JPGQuality int `json:"jpg_quality"`
PNGQuality int `json:"png_quality"`
PNGLossless bool `json:"png_lossless"`
}

type WebSockets struct {
Enabled bool `json:"enabled"`
Value bool `json:"value"`
}

0 comments on commit ce4ebb4

Please sign in to comment.