plugins

package
v0.0.0-...-ae88a46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package limit_req

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Package plugins

@author: xwc1125

Index

Constants

View Source
const (
	MatchAllTag      = "*"
	MatchAllForceTag = "**"
)
View Source
const (
	AuthMethod_Client_Secret_Basic = "client_secret_basic"
)

Variables

View Source
var (
	ErrConfConvert = fmt.Errorf("convert to conf err")
)

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*BasicAuth) Name

func (p *BasicAuth) Name() string

func (*BasicAuth) ParseConf

func (p *BasicAuth) ParseConf(in []byte) (interface{}, error)

func (*BasicAuth) Priority

func (p *BasicAuth) Priority() int64

func (*BasicAuth) RequestFilter

func (p *BasicAuth) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*BasicAuth) Version

func (p *BasicAuth) Version() string

type BasicAuthConf

type BasicAuthConf struct {
	Disable bool `json:"disable"`
}

type Cors

type Cors struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Cors) Name

func (p *Cors) Name() string

func (*Cors) ParseConf

func (p *Cors) ParseConf(in []byte) (interface{}, error)

func (*Cors) Priority

func (p *Cors) Priority() int64

func (*Cors) RequestFilter

func (p *Cors) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*Cors) Version

func (p *Cors) Version() string

type CorsConf

type CorsConf struct {
	Disable bool `json:"disable"`
	// AllowOrigins 允许跨域访问的 Origin。格式为 scheme://host:port,示例如 https://somedomain.com:8081
	// 当 allow_credential 为 false 时,
	// 可以使用 * 来表示允许所有 Origin 通过。
	// 你也可以在启用了 allow_credential 后使用 ** 强制允许所有 Origin 均通过,
	// 但请注意这样存在安全隐患。
	AllowOrigins []string `json:"allow_origins,omitempty"`
	// AllowMethods 允许跨域访问的 Method,比如:GET,POST 等。
	// 当 allow_credential 为 false 时,
	// 可以使用 * 来表示允许所有 Method 通过。
	// 你也可以在启用了 allow_credential 后使用 ** 强制允许所有 Method 都通过,
	// 但请注意这样存在安全隐患。
	AllowMethods []string `json:"allow_methods,omitempty"` // 允许跨域访问的 Method
	// AllowHeaders 允许跨域访问时请求方携带哪些非 CORS 规范 以外的 Header。
	// 当 allow_credential 为 false 时,
	// 可以使用 * 来表示允许所有 Header 通过。
	// 你也可以在启用了 allow_credential 后使用 ** 强制允许所有 Header 都通过,
	// 但请注意这样存在安全隐患。
	AllowHeaders []string `json:"allow_headers,omitempty"`
	// ExposeHeaders 允许跨域访问时响应方携带哪些非 CORS 规范 以外的 Header。
	// 当 allow_credential 为 false 时,
	// 可以使用 * 来表示允许任意 Header 。
	// 你也可以在启用了 allow_credential 后使用 ** 强制允许任意 Header,
	// 但请注意这样存在安全隐患。
	ExposeHeaders []string `json:"expose_headers,omitempty"`
	// MaxAge 浏览器缓存 CORS 结果的最大时间,单位为秒。
	// 在这个时间范围内,浏览器会复用上一次的检查结果,-1 表示不缓存。
	// 请注意各个浏览器允许的最大时间不同
	MaxAge uint64 `json:"max_age,omitempty" default:"5"`
	// AllowCredential 是否允许跨域访问的请求方携带凭据(如 Cookie 等)。
	// 根据 CORS 规范,如果设置该选项为 true,
	// 那么将不能在其他属性中使用 *。
	AllowCredential bool `json:"allow_credential,omitempty"`
	// AllowOriginsByRegex 使用正则表达式数组来匹配允许跨域访问的 Origin,
	// 如 [".*\.test.com"] 可以匹配任何 test.com 的子域名 *。
	AllowOriginsByRegex []string `json:"allow_origins_by_regex,omitempty"`
	// AllowOriginsByMetadata 通过引用插件元数据的 allow_origins 配置允许跨域访问的 Origin。
	// 比如当插件元数据为 "allow_origins": {"EXAMPLE": "https://example.com"} 时,
	// 配置 ["EXAMPLE"] 将允许 Origin https://example.com 的访问。
	AllowOriginsByMetadata []string `json:"allow_origins_by_metadata,omitempty"`
}

type GelfUdpLogger

type GelfUdpLogger struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*GelfUdpLogger) Name

func (p *GelfUdpLogger) Name() string

func (*GelfUdpLogger) ParseConf

func (p *GelfUdpLogger) ParseConf(in []byte) (interface{}, error)

func (*GelfUdpLogger) Priority

func (p *GelfUdpLogger) Priority() int64

func (*GelfUdpLogger) RequestFilter

func (p *GelfUdpLogger) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*GelfUdpLogger) Version

func (p *GelfUdpLogger) Version() string

type GelfUdpLoggerConf

type GelfUdpLoggerConf struct {
	Disable         bool   `json:"disable"`
	Host            string `json:"host"`
	Port            uint64 `json:"port"`
	Timeout         uint64 `json:"timeout"`
	LoggerName      string `json:"name"`
	InactiveTimeout uint64 `json:"inactive_timeout"`
	BufferDuration  uint64 `json:"buffer_duration"`
	MaxRetryCount   uint64 `json:"max_retry_count"`
	RetryDelay      uint64 `json:"retry_delay"`
	IncludeReqBody  bool   `json:"include_req_body"`
	BatchMaxSize    uint64 `json:"batch_max_size"`
}

type Gzip

type Gzip struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Gzip) Name

func (p *Gzip) Name() string

func (*Gzip) ParseConf

func (p *Gzip) ParseConf(in []byte) (interface{}, error)

func (*Gzip) Priority

func (p *Gzip) Priority() int64

func (*Gzip) ResponseFilter

func (p *Gzip) ResponseFilter(conf interface{}, w *fasthttp.Response) (err error)

func (*Gzip) Version

func (p *Gzip) Version() string

type GzipConf

type GzipConf struct {
	Disable           bool   `json:"disable"`
	HeaderName        string `json:"header_name,omitempty" default:"X-Request-Id"` // 唯一请求ID的标头名称
	IncludeInResponse bool   `json:"include_in_response,omitempty" default:"true"` // true时,在响应头中添加唯一的请求ID。
	Algorithm         string `json:"algorithm,omitempty" default:"uuid"`           // ["uuid", "snowflake", "nanoid"]
}

type Headers

type Headers struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Headers) Name

func (p *Headers) Name() string

func (*Headers) ParseConf

func (p *Headers) ParseConf(in []byte) (interface{}, error)

func (*Headers) Priority

func (p *Headers) Priority() int64

func (*Headers) RequestFilter

func (p *Headers) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*Headers) Version

func (p *Headers) Version() string

type HeadersConf

type HeadersConf struct {
	Disable  bool                  `json:"disable"`
	Request  types.Map             `json:"request"`
	Response types.Map             `json:"response"`
	STS      *PluginHeadersSTSType `json:"sts"`
}

type HttpLogger

type HttpLogger struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*HttpLogger) Name

func (p *HttpLogger) Name() string

func (*HttpLogger) ParseConf

func (p *HttpLogger) ParseConf(in []byte) (interface{}, error)

func (*HttpLogger) Priority

func (p *HttpLogger) Priority() int64

func (*HttpLogger) RequestFilter

func (p *HttpLogger) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*HttpLogger) Version

func (p *HttpLogger) Version() string

type HttpLoggerConf

type HttpLoggerConf struct {
	Disable         bool   `json:"disable"`
	URI             string `json:"uri"`
	AuthHeader      string `json:"auth_header"`
	Timeout         uint64 `json:"timeout"`
	LoggerName      string `json:"name"`
	BatchMaxSize    uint64 `json:"batch_max_size"`
	InactiveTimeout uint64 `json:"inactive_timeout"`
	BufferDuration  uint64 `json:"buffer_duration"`
	MaxRetryCount   uint64 `json:"max_retry_count"`
	RetryDelay      uint64 `json:"retry_delay"`
	IncludeReqBody  bool   `json:"include_req_body"`
	ConcatMethod    string `json:"concat_method"`
}

type IpRestriction

type IpRestriction struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

IpRestriction ...

func (*IpRestriction) Name

func (p *IpRestriction) Name() string

func (*IpRestriction) ParseConf

func (p *IpRestriction) ParseConf(in []byte) (interface{}, error)

func (*IpRestriction) Priority

func (p *IpRestriction) Priority() int64

func (*IpRestriction) RequestFilter

func (p *IpRestriction) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*IpRestriction) Version

func (p *IpRestriction) Version() string

type IpRestrictionConf

type IpRestrictionConf struct {
	Disable bool `json:"disable"`
	// Whitelist 加入白名单的 IP 地址或 CIDR 范围。
	Whitelist []string `json:"whitelist,omitempty"`
	// 加入黑名单的 IP 地址或 CIDR 范围。
	Blacklist []string `json:"blacklist,omitempty"`
	// Message 不允许访问IP地址时返回的消息[1, 1024]
	Message string `json:"message,omitempty"`
	// contains filtered or unexported fields
}

type JwtAuth

type JwtAuth struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*JwtAuth) Name

func (p *JwtAuth) Name() string

func (*JwtAuth) ParseConf

func (p *JwtAuth) ParseConf(in []byte) (interface{}, error)

func (*JwtAuth) Priority

func (p *JwtAuth) Priority() int64

func (*JwtAuth) RequestFilter

func (p *JwtAuth) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*JwtAuth) Version

func (p *JwtAuth) Version() string

type JwtAuthConf

type JwtAuthConf struct {
	Disable bool `json:"disable"`

	Secret            string `json:"secret"`
	TokenFormat       string `json:"token_format"`
	TokenHeader       string `json:"token_header"`
	ParsedTokenHeader string `json:"parsed_token_header"`
}

type LimitReq

type LimitReq struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*LimitReq) Name

func (p *LimitReq) Name() string

func (*LimitReq) ParseConf

func (p *LimitReq) ParseConf(in []byte) (interface{}, error)

ParseConf is called when the configuration is changed. And its output is unique per route.

func (*LimitReq) Priority

func (p *LimitReq) Priority() int64

func (*LimitReq) RequestFilter

func (p *LimitReq) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

RequestFilter is called when a request hits the route

func (*LimitReq) Version

func (p *LimitReq) Version() string

type LimitReqConf

type LimitReqConf struct {
	Burst int     `json:"burst"`
	Rate  float64 `json:"rate"`
	// contains filtered or unexported fields
}

type MultiResponseRewrite

type MultiResponseRewrite struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*MultiResponseRewrite) Name

func (p *MultiResponseRewrite) Name() string

func (*MultiResponseRewrite) ParseConf

func (p *MultiResponseRewrite) ParseConf(in []byte) (interface{}, error)

func (*MultiResponseRewrite) Priority

func (p *MultiResponseRewrite) Priority() int64

func (*MultiResponseRewrite) RequestFilter

func (p *MultiResponseRewrite) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*MultiResponseRewrite) Version

func (p *MultiResponseRewrite) Version() string

type MultiResponseRewriteConf

type MultiResponseRewriteConf struct {
	Disable  bool                                    `json:"disable"`
	Variants []PluginMultiResponseRewriteVariantType `json:"variants"`
}

type OAuth2

type OAuth2 struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*OAuth2) Name

func (p *OAuth2) Name() string

func (*OAuth2) ParseConf

func (p *OAuth2) ParseConf(in []byte) (interface{}, error)

func (*OAuth2) Priority

func (p *OAuth2) Priority() int64

func (*OAuth2) RequestFilter

func (p *OAuth2) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*OAuth2) Version

func (p *OAuth2) Version() string

type OAuth2Conf

type OAuth2Conf struct {
	Disable                         bool   `json:"disable"`
	ClientId                        string `json:"client_id,omitempty" comment:"客户端Id"`
	ClientSecret                    string `json:"client_secret,omitempty" comment:"客户端secret"`
	Discovery                       string `json:"discovery,omitempty" comment:"身份服务器的发现端点的 URL"`
	Real                            string `json:"real,omitempty" comment:"用于认证的领域; 默认为apisix"`
	BearerOnly                      bool   `` /* 127-byte string literal not displayed */
	LogoutPath                      string `json:"logout_path,omitempty" comment:"默认是/logout"`
	RedirectUri                     string `json:"redirect_uri,omitempty"`
	Timeout                         int    `json:"timeout,omitempty" comment:"默认是 3 秒"`
	SslVerify                       bool   `json:"ssl_verify,omitempty" comment:"默认是 false"`
	IntrospectionEndpoint           string `json:"introspection_endpoint,omitempty" comment:"身份服务器的令牌验证端点的 URL"` // token会直接拼接在连接的后面
	IntrospectionEndpointAuthMethod string `json:"introspection_endpoint_auth_method,omitempty" comment:"令牌自省的认证方法名称,如:client_secret_basic"`
	PublicKey                       string `json:"public_key,omitempty" comment:"验证令牌的公钥"`
	TokenSigningAlgValuesExpected   string `json:"token_signing_alg_values_expected,omitempty" comment:"用于对令牌进行签名的算法"`
}

type PluginHeadersSTSType

type PluginHeadersSTSType struct {
	MaxAge            uint64 `json:"max_age"`
	IncludeSubDomains bool   `json:"include_sub_domains"`
	Preload           bool   `json:"preload"`
}

type PluginMultiResponseRewriteVariantType

type PluginMultiResponseRewriteVariantType struct {
	StatusCode int       `json:"status_code"`
	Body       string    `json:"body"`
	BodyBase64 bool      `json:"body_base64"`
	Headers    types.Map `json:"headers"`
	Vars       string    `json:"vars"`
}

type PluginRedirectRegexVariantType

type PluginRedirectRegexVariantType struct {
	Pattern    string `json:"pattern"`
	Replace    string `json:"replace"`
	StatusCode int    `json:"status_code"`
}

type Prometheus

type Prometheus struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Prometheus) Name

func (p *Prometheus) Name() string

func (*Prometheus) ParseConf

func (p *Prometheus) ParseConf(in []byte) (interface{}, error)

func (*Prometheus) Priority

func (p *Prometheus) Priority() int64

func (*Prometheus) RequestFilter

func (p *Prometheus) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*Prometheus) Version

func (p *Prometheus) Version() string

type PrometheusConf

type PrometheusConf struct {
	Disable    bool `json:"disable"`
	PreferName bool `json:"prefer_name"` // true:打印Route/Service名称,而不是Prometheus中的ID

	Path             string    `json:"path"`
	Port             string    `json:"Port"`
	HistogramBuckets []float64 `json:"histogram_buckets"`
}

type ProxyCache

type ProxyCache struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ProxyCache) Name

func (p *ProxyCache) Name() string

func (*ProxyCache) ParseConf

func (p *ProxyCache) ParseConf(in []byte) (interface{}, error)

func (*ProxyCache) Priority

func (p *ProxyCache) Priority() int64

func (*ProxyCache) RequestFilter

func (p *ProxyCache) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*ProxyCache) Version

func (p *ProxyCache) Version() string

type ProxyCacheConf

type ProxyCacheConf struct {
	Disable          bool     `json:"disable"`
	CacheStrategy    string   `json:"cache_strategy"`
	CacheZone        string   `json:"cache_zone"`
	CacheKey         []string `json:"cache_key"`
	CacheBypass      []string `json:"cache_bypass"`
	CacheMethod      []string `json:"cache_method"`
	CacheHTTPStatus  []string `json:"cache_http_status"`
	HideCacheHeaders bool     `json:"hide_cache_headers"`
	CacheControl     bool     `json:"cache_control"`
	NoCache          []string `json:"no_cache"`
	CacheTTL         int      `json:"cache_ttl"`
}

type ProxyRewrite

type ProxyRewrite struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ProxyRewrite) Name

func (p *ProxyRewrite) Name() string

func (*ProxyRewrite) ParseConf

func (p *ProxyRewrite) ParseConf(in []byte) (interface{}, error)

func (*ProxyRewrite) Priority

func (p *ProxyRewrite) Priority() int64

func (*ProxyRewrite) RequestFilter

func (p *ProxyRewrite) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*ProxyRewrite) Version

func (p *ProxyRewrite) Version() string

type ProxyRewriteConf

type ProxyRewriteConf struct {
	Disable  bool              `json:"disable"`
	Scheme   string            `json:"scheme,omitempty"`    // 协议改写,http/https
	Method   string            `json:"method,omitempty"`    // 被改写的method
	Uri      string            `json:"uri,omitempty"`       // url改写
	Host     string            `json:"host,omitempty"`      // host进行改写
	Headers  map[string]string `json:"headers,omitempty"`   // 修改的header头,如果value为空时,代表删除该key
	RegexUri []string          `json:"regex_uri,omitempty"` // uri的正则
}

type RealIP

type RealIP struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

RealIP 插件用于动态改变传递到 客户端的 IP 地址和端口

func (*RealIP) Name

func (p *RealIP) Name() string

func (*RealIP) ParseConf

func (p *RealIP) ParseConf(in []byte) (interface{}, error)

func (*RealIP) Priority

func (p *RealIP) Priority() int64

func (*RealIP) RequestFilter

func (p *RealIP) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*RealIP) Version

func (p *RealIP) Version() string

type RealIPConf

type RealIPConf struct {
	Disable bool `json:"disable"`
	// Source 数据来源,如 arg_realip 或 http_x_forwarded_for,
	// 动态设置客户端的 IP 地址和端口。
	// 如果该值不包含端口,则不会更改客户端的端口。
	Source string `json:"source" validate:"required"`
	// TrustedAddresses IP 或 CIDR 范围列表
	// 动态设置 set_real_ip_from 字段
	TrustedAddresses []string `json:"trusted_addresses,omitempty"`
	// Recursive 如果禁用递归搜索,则与受信任地址之一匹配的原始客户端地址将替换为配置的source中发送的最后一个地址。
	// 如果启用递归搜索,则与受信任地址之一匹配的原始客户端地址将替换为配置的source中发送的最后一个非受信任地址。
	Recursive bool `json:"recursive,omitempty"`
}

RealIPConf 和nginx的配置一致

http{
   #真实服务器上一级代理的IP地址或者IP段,可以写多行
   set_real_ip_from 127.0.0.1;
    #从哪个header头检索出要的IP地址
   real_ip_header X-Forwarded-For;
   # 递归排除IP地址,ip串从右到左开始排除set_real_ip_from里面出现的IP,如果出现了未出现这些ip段的IP,那么这个IP将被认为是用户的IP
   real_ip_recursive on;
}

type Redirect

type Redirect struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Redirect) Name

func (p *Redirect) Name() string

func (*Redirect) ParseConf

func (p *Redirect) ParseConf(in []byte) (interface{}, error)

func (*Redirect) Priority

func (p *Redirect) Priority() int64

func (*Redirect) RequestFilter

func (p *Redirect) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*Redirect) Version

func (p *Redirect) Version() string

type RedirectConf

type RedirectConf struct {
	Disable           bool     `json:"disable"`
	HTTPToHTTPS       bool     `json:"http_to_https"`
	URI               string   `json:"uri"`
	RegexUri          []string `json:"regex_uri"`
	RetCode           int      `json:"ret_code"`
	EncodeURI         bool     `json:"encode_uri"`
	AppendQueryString bool     `json:"append_query_string"`
}

type RedirectRegex

type RedirectRegex struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*RedirectRegex) Name

func (p *RedirectRegex) Name() string

func (*RedirectRegex) ParseConf

func (p *RedirectRegex) ParseConf(in []byte) (interface{}, error)

func (*RedirectRegex) Priority

func (p *RedirectRegex) Priority() int64

func (*RedirectRegex) RequestFilter

func (p *RedirectRegex) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*RedirectRegex) Version

func (p *RedirectRegex) Version() string

type RedirectRegexConf

type RedirectRegexConf struct {
	Disable  bool                             `json:"disable"`
	Variants []PluginRedirectRegexVariantType `json:"variants"`
}

type RegexFilter

type RegexFilter struct {
	Regex   string `json:"regex"`
	Scope   string `json:"scope"`
	Replace string `json:"replace"`
	// contains filtered or unexported fields
}

type RequestId

type RequestId struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*RequestId) Name

func (p *RequestId) Name() string

func (*RequestId) ParseConf

func (p *RequestId) ParseConf(in []byte) (interface{}, error)

func (*RequestId) Priority

func (p *RequestId) Priority() int64

func (*RequestId) RequestFilter

func (p *RequestId) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*RequestId) Version

func (p *RequestId) Version() string

type RequestIdConf

type RequestIdConf struct {
	Disable           bool   `json:"disable"`
	HeaderName        string `json:"header_name,omitempty" default:"X-Request-Id"` // 唯一请求ID的标头名称
	IncludeInResponse bool   `json:"include_in_response,omitempty" default:"true"` // true时,在响应头中添加唯一的请求ID。
	Algorithm         string `json:"algorithm,omitempty" default:"uuid"`           // ["uuid", "snowflake", "nanoid"]
}

type ResponseRewrite

type ResponseRewrite struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ResponseRewrite) Name

func (p *ResponseRewrite) Name() string

func (*ResponseRewrite) ParseConf

func (p *ResponseRewrite) ParseConf(in []byte) (interface{}, error)

func (*ResponseRewrite) Priority

func (p *ResponseRewrite) Priority() int64

func (*ResponseRewrite) RequestFilter

func (p *ResponseRewrite) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*ResponseRewrite) Version

func (p *ResponseRewrite) Version() string

type ResponseRewrite2

type ResponseRewrite2 struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ResponseRewrite2) Name

func (p *ResponseRewrite2) Name() string

func (*ResponseRewrite2) ParseConf

func (p *ResponseRewrite2) ParseConf(in []byte) (interface{}, error)

func (*ResponseRewrite2) Priority

func (p *ResponseRewrite2) Priority() int64

func (*ResponseRewrite2) ResponseFilter

func (p *ResponseRewrite2) ResponseFilter(conf interface{}, w *fasthttp.Response) (err error)

func (*ResponseRewrite2) Version

func (p *ResponseRewrite2) Version() string

type ResponseRewrite2Conf

type ResponseRewrite2Conf struct {
	Disable bool              `json:"disable"`
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
	Body    string            `json:"body"`
	Filters []RegexFilter     `json:"filters"`
}

type ResponseRewriteConf

type ResponseRewriteConf struct {
	Disable    bool      `json:"disable"`
	StatusCode int       `json:"status_code"`
	Body       string    `json:"body"`
	BodyBase64 bool      `json:"body_base64"`
	Headers    types.Map `json:"headers"`
	Vars       string    `json:"vars"`
}

type Say

type Say struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Say) Name

func (p *Say) Name() string

func (*Say) ParseConf

func (p *Say) ParseConf(in []byte) (interface{}, error)

func (*Say) Priority

func (p *Say) Priority() int64

func (*Say) ResponseFilter

func (p *Say) ResponseFilter(conf interface{}, w *fasthttp.Response) error

func (*Say) Version

func (p *Say) Version() string

type SayConf

type SayConf struct {
	Disable bool   `json:"disable"`
	Body    string `json:"body"`
}

type ServerlessPostFunction

type ServerlessPostFunction struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ServerlessPostFunction) Name

func (p *ServerlessPostFunction) Name() string

func (*ServerlessPostFunction) ParseConf

func (p *ServerlessPostFunction) ParseConf(in []byte) (interface{}, error)

func (*ServerlessPostFunction) Priority

func (p *ServerlessPostFunction) Priority() int64

func (*ServerlessPostFunction) RequestFilter

func (p *ServerlessPostFunction) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*ServerlessPostFunction) Version

func (p *ServerlessPostFunction) Version() string

type ServerlessPostFunctionConf

type ServerlessPostFunctionConf struct {
	Disable   bool     `json:"disable"`
	Phase     string   `json:"phase"`
	Functions []string `json:"functions"`
}

type ServerlessPreFunction

type ServerlessPreFunction struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*ServerlessPreFunction) Name

func (p *ServerlessPreFunction) Name() string

func (*ServerlessPreFunction) ParseConf

func (p *ServerlessPreFunction) ParseConf(in []byte) (interface{}, error)

func (*ServerlessPreFunction) Priority

func (p *ServerlessPreFunction) Priority() int64

func (*ServerlessPreFunction) RequestFilter

func (p *ServerlessPreFunction) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*ServerlessPreFunction) Version

func (p *ServerlessPreFunction) Version() string

type ServerlessPreFunctionConf

type ServerlessPreFunctionConf struct {
	Disable   bool     `json:"disable"`
	Phase     string   `json:"phase"`
	Functions []string `json:"functions"`
}

type Syslog

type Syslog struct {
	plugins.DefaultPlugin
	// contains filtered or unexported fields
}

func (*Syslog) Name

func (p *Syslog) Name() string

func (*Syslog) ParseConf

func (p *Syslog) ParseConf(in []byte) (interface{}, error)

func (*Syslog) Priority

func (p *Syslog) Priority() int64

func (*Syslog) RequestFilter

func (p *Syslog) RequestFilter(conf interface{}, r *fasthttp.Request, w *fasthttp.Response) error

func (*Syslog) Version

func (p *Syslog) Version() string

type SyslogConf

type SyslogConf struct {
	Disable      bool   `json:"disable"`
	Host         string `tfsdk:"host"`
	Port         int    `tfsdk:"port"`
	BatchMaxSize uint64 `tfsdk:"batch_max_size"`
}

Directories

Path Synopsis
cgw
Package cgw
Package cgw
cgw_v2
Package cgw_v2
Package cgw_v2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL