apiproxy

package module
v0.0.0-...-8a8d9b9 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2018 License: Apache-2.0 Imports: 14 Imported by: 1

README

apiproxy GoDoc

An APIBox middleware to proxy API request to backend API servers.

See full document at: https://go-apibox.github.io/docs/#!middlewares/apiproxy.md (Chinese)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorDefines = map[api.ErrorType]*api.ErrorDefine{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Backend

type Backend struct {
	GWURL            string
	GWADDR           string
	Method           string
	AppId            string
	SignKey          string
	NonceLength      int
	DefaultParams    map[string]string
	OverrideParams   map[string]string
	DeleteParams     []string
	MatchParams      map[string][]string
	SSHTunnelEnabled bool
	SSHClient        *apiclient.SSHClient
}

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(app *api.App) *Proxy

func (*Proxy) AddBackend

func (p *Proxy) AddBackend(alias string, backend *Backend)

AddBackend add a new backend to proxy.

func (*Proxy) DeleteBackend

func (p *Proxy) DeleteBackend(alias string)

DeleteBackend delete a backend from proxy.

func (*Proxy) Disable

func (p *Proxy) Disable()

Disable disable the middle ware.

func (*Proxy) Enable

func (p *Proxy) Enable()

Enable enable the middle ware.

func (*Proxy) GetClient

func (p *Proxy) GetClient(alias string) *apiclient.Client

GetClient return the backend client object.

func (*Proxy) ProxyCall

func (p *Proxy) ProxyCall(c *api.Context, backendAlias string, action string, params url.Values) (*apiclient.Response, *api.Error)

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*Proxy) SetClient

func (p *Proxy) SetClient(alias string, client *apiclient.Client)

SetClient set the backend client object.

Jump to

Keyboard shortcuts

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