plugins

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 7 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 LimitReq added in v0.2.0

type LimitReq struct {
}

LimitReq is a demo for a real world plugin

func (*LimitReq) Filter added in v0.2.0

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

Filter is called when a request hits the route

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.

type LimitReqConf added in v0.2.0

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

type Say

type Say struct {
}

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

func (*Say) Filter

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

func (*Say) Name

func (p *Say) Name() string

func (*Say) ParseConf

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

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