micro/

directory
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0

README

Micro Plugins

This directory containers plugins for the micro toolkit itself. These plugins differ from go-micro plugins in that they allow adding functionality to the API, CLI, Sidecar, etc.

Learn more about micro plugins at github.com/micro/micro/plugin.

The Plugin Interface

// Plugin is the interface for plugins to micro. It differs from go-micro in that it's for
// the micro API, Web, Sidecar, CLI. It's a method of building middleware for the HTTP side.
type Plugin interface {
    // Global Flags
    Flags() []cli.Flag
    // Sub-commands
    Commands() []cli.Command
    // Handle is the middleware handler for HTTP requests. We pass in
    // the existing handler so it can be wrapped to create a call chain.
    Handler() Handler
    // Init called when command line args are parsed.
    // The initialised cli.Context is passed in.
    Init(*cli.Context) error
    // Name of the plugin
    String() string
}

// Manager is the plugin manager which stores plugins and allows them to be retrieved.
// This is used by all the components of micro.
type Manager interface {
        Plugins() map[string]Plugin
        Register(name string, plugin Plugin) error
}

// Handler is the plugin middleware handler which wraps an existing http.Handler passed in.
// Its the responsibility of the Handler to call the next http.Handler in the chain.
type Handler func(http.Handler) http.Handler

Directories

Path Synopsis
bot
Package disable_rpc disables the /rpc endpoint
Package disable_rpc disables the /rpc endpoint
Package gzip is a micro plugin for gzipping http response
Package gzip is a micro plugin for gzipping http response
Package index is a micro plugin for stripping a path index
Package index is a micro plugin for stripping a path index
Package ip_whitelist is a micro plugin for whitelisting ip addresses
Package ip_whitelist is a micro plugin for whitelisting ip addresses
Package router is a micro plugin for defining HTTP routes
Package router is a micro plugin for defining HTTP routes
stats_auth enables basic auth on the /stats endpoint
stats_auth enables basic auth on the /stats endpoint
trace
awsxray
Package awsxray is a micro plugin for whitelisting service requests
Package awsxray is a micro plugin for whitelisting service requests
uuid
Package uuid is a micro plugin for adding a trace header
Package uuid is a micro plugin for adding a trace header
Package whitelist is a micro plugin for whitelisting service requests
Package whitelist is a micro plugin for whitelisting service requests

Jump to

Keyboard shortcuts

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