lib

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Name    string   `json:"name"`
	Address string   `json:"address"`
	Methods []string `json:"methods"`
}

Plugin provides cancelable rpc server used to run custom plugins

func (*Plugin) Do

func (p *Plugin) Do(ctx context.Context, conductor string, rcvr interface{}) (err error)

Do register the plugin, send info to reproxy conductor and activate RPC listener. On completion unregister from reproxy. Blocking call, should run in goroutine on the caller side rvcr is provided struct implemented at least one RPC methods with the signature like this: func(req lib.Request, res *lib.Response) (err error) see examples/plugin() for more info

type Request

type Request struct {
	URL        string
	RemoteAddr string
	Host       string
	Header     http.Header
	Route      string // final destination
	Match      struct {
		Server         string
		Src            string
		Dst            string
		ProviderID     string
		PingURL        string
		MatchType      string
		AssetsLocation string
		AssetsWebRoot  string
	}
}

Request sent to plugins

type Response

type Response struct {
	StatusCode         int
	HeadersIn          http.Header
	HeadersOut         http.Header
	OverrideHeadersIn  bool // indicates plugin removing all the original incoming headers
	OverrideHeadersOut bool // indicates plugin removing all the original outgoing headers
}

Response from plugin's handler call

Jump to

Keyboard shortcuts

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