muxy

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.0.3

type Config struct {
	RawConfig  *plugo.RawConfig
	ConfigFile string // Path to YAML Configuration File
}

Config is the top-level configuration struct

type Context

type Context struct {
	Request        *http.Request
	Response       *http.Response
	ResponseWriter http.ResponseWriter
	Bytes          []byte
}

Context is the request context given to Middlewares and Symptoms.

type Middleware

type Middleware interface {
	Setup()
	HandleEvent(event ProxyEvent, ctx *Context)
	Teardown()
}

Middleware is a plugin that intercepts requests and injects chaos Middleware's are executed in stacked order before or after a Middleware, and are perfect for jobs like instrumentation. They are given a read/write copy of the runtime context and are executed synchronously.

type Muxy

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

Muxy is the main orchestration component

func New

func New(config *Config) *Muxy

New creates a new Muxy instance

func NewWithDefaultConfig added in v0.0.3

func NewWithDefaultConfig() *Muxy

NewWithDefaultConfig creates a new Muxy instance with defaults

func (*Muxy) LoadPlugins

func (m *Muxy) LoadPlugins()

LoadPlugins loads all plugins dynamically and configures them

func (*Muxy) Run

func (m *Muxy) Run()

Run the mucking proxy!

type PluginConfig

type PluginConfig struct {
	Name        string
	Description string
	LogLevel    int `default:"2" required:"true" mapstructure:"loglevel"`
	Proxy       []plugo.PluginConfig
	Middleware  []plugo.PluginConfig
}

PluginConfig contains configuration for all plugins to Muxy

type Proxy

type Proxy interface {
	Setup([]Middleware)
	Proxy()
	Teardown()
}

Proxy is the interface for a Proxy plugin

type ProxyEvent

type ProxyEvent int

ProxyEvent is the event set to a proxy

const (
	// EventPreDispatch is the event sent prior to dispatching a request
	EventPreDispatch ProxyEvent = iota

	// EventPostDispatch is the event sent directly after dispatching a request
	EventPostDispatch
)

Jump to

Keyboard shortcuts

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