plugins

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FaultInjection added in v0.3.0

type FaultInjection struct {
	// Embed the default plugin here,
	// so that we don't need to reimplement all the methods.
	plugin.DefaultPlugin
}

FaultInjection is used in the benchmark

func (*FaultInjection) Name added in v0.3.0

func (p *FaultInjection) Name() string

func (*FaultInjection) ParseConf added in v0.3.0

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

func (*FaultInjection) RequestFilter added in v0.4.0

func (p *FaultInjection) RequestFilter(conf interface{}, w http.ResponseWriter, r pkgHTTP.Request)

type FaultInjectionConf added in v0.3.0

type FaultInjectionConf struct {
	Body       string `json:"body"`
	HttpStatus int    `json:"http_status"`
	Percentage int    `json:"percentage"`
}

type LimitReq added in v0.2.0

type LimitReq struct {
	// Embed the default plugin here,
	// so that we don't need to reimplement all the methods.
	plugin.DefaultPlugin
}

LimitReq is a demo for a real world plugin

func (*LimitReq) Name added in v0.2.0

func (p *LimitReq) Name() string

func (*LimitReq) ParseConf added in v0.2.0

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) RequestFilter added in v0.4.0

func (p *LimitReq) RequestFilter(conf interface{}, w http.ResponseWriter, r pkgHTTP.Request)

RequestFilter is called when a request hits the route

type LimitReqConf added in v0.2.0

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

type ResponseRewrite added in v0.4.0

type ResponseRewrite struct {
	// Embed the default plugin here,
	// so that we don't need to reimplement all the methods.
	plugin.DefaultPlugin
}

ResponseRewrite is a demo to show how to rewrite response data.

func (*ResponseRewrite) Name added in v0.4.0

func (p *ResponseRewrite) Name() string

func (*ResponseRewrite) ParseConf added in v0.4.0

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

func (*ResponseRewrite) ResponseFilter added in v0.4.0

func (p *ResponseRewrite) ResponseFilter(conf interface{}, w pkgHTTP.Response)

type ResponseRewriteConf added in v0.4.0

type ResponseRewriteConf struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
	Body    string            `json:"body"`
}

type Say

type Say struct {
	// Embed the default plugin here,
	// so that we don't need to reimplement all the methods.
	plugin.DefaultPlugin
}

Say is a demo to show how to return data directly instead of proxying it to the upstream.

func (*Say) Name

func (p *Say) Name() string

func (*Say) ParseConf

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

func (*Say) RequestFilter added in v0.4.0

func (p *Say) RequestFilter(conf interface{}, w http.ResponseWriter, r pkgHTTP.Request)

type SayConf

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

Jump to

Keyboard shortcuts

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