armor

package module
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 25 Imported by: 19

README

Build Status Forum Twitter License

What can it do today?

  • Serve HTTP/2
  • Automatically install TLS certificates from https://letsencrypt.org
  • Proxy HTTP and WebSocket requests
  • Define virtual hosts with path level routing
  • Graceful shutdown
  • Limit request body
  • Serve static files
  • Log requests
  • Gzip response
  • Cross-origin Resource Sharing (CORS)
  • Security
    • XSSProtection
    • ContentTypeNosniff
    • ContentSecurityPolicy
    • HTTP Strict Transport Security (HSTS)
  • Add / Remove trailing slash from the URL with option to redirect
  • Redirect requests
  • http to https
  • http to https www
  • http to https non www
  • non www to www
  • www to non www
  • URL path rewrite

Most of the functionality is implemented via Plugin interface which makes writing a custom plugin super easy.

Get Started

What's on the roadmap?

  • Website
  • Code coverage
  • Test cases

Documentation

Index

Constants

View Source
const (
	Version = "0.4.14"
	Website = "https://armor.labstack.com"
)
View Source
const (
	EventPluginLoad   = "1"
	EventPluginUpdate = "2"
)

Events

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin added in v0.4.12

type Admin struct {
	Address string `json:"address"`
}

type Armor

type Armor struct {
	Name          string             `json:"name"`
	Address       string             `json:"address"`
	Port          string             `json:"-"`
	TLS           *TLS               `json:"tls"`
	Admin         *Admin             `json:"admin"`
	Storm         *Storm             `json:"storm"`
	Postgres      *Postgres          `json:"postgres"`
	Cluster       *Cluster           `json:"cluster"`
	ReadTimeout   time.Duration      `json:"read_timeout"`
	WriteTimeout  time.Duration      `json:"write_timeout"`
	RawPlugins    []plugin.RawPlugin `json:"plugins"`
	Hosts         Hosts              `json:"hosts"`
	RootDir       string             `json:"-"`
	Store         store.Store        `json:"-"`
	Plugins       []plugin.Plugin    `json:"-"`
	Echo          *echo.Echo         `json:"-"`
	Logger        *log.Logger        `json:"-"`
	Colorer       *color.Color       `json:"-"`
	DefaultConfig bool               `json:"-"`
	// contains filtered or unexported fields
}

func (*Armor) AddPlugin added in v0.4.12

func (a *Armor) AddPlugin(p plugin.Plugin)

func (*Armor) FindHost added in v0.4.12

func (a *Armor) FindHost(name string, add bool) (h *Host)

func (*Armor) GetConfigForClient added in v0.4.14

func (a *Armor) GetConfigForClient(clientHelloInfo *tls.ClientHelloInfo) (*tls.Config, error)

GetConfigForClient implements the Config.GetClientCertificate callback

func (*Armor) LoadPlugin added in v0.4.12

func (a *Armor) LoadPlugin(p *store.Plugin, update bool)

func (*Armor) NewHTTP added in v0.4.12

func (a *Armor) NewHTTP() (h *HTTP)

func (*Armor) SavePlugins added in v0.4.12

func (a *Armor) SavePlugins()

func (*Armor) StartCluster added in v0.4.12

func (a *Armor) StartCluster()

func (*Armor) UpdatePlugin added in v0.4.12

func (a *Armor) UpdatePlugin(plugin plugin.Plugin)

type Cluster added in v0.4.12

type Cluster struct {
	*serf.Serf
	Address string   `json:"address"`
	Peers   []string `json:"peers"`
}

type HTTP added in v0.4.12

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

func (*HTTP) CreateTunnel added in v0.4.12

func (h *HTTP) CreateTunnel()

func (*HTTP) Start added in v0.4.12

func (h *HTTP) Start() error

func (*HTTP) StartTLS added in v0.4.12

func (h *HTTP) StartTLS() error

type Host

type Host struct {
	Name       string             `json:"-"`
	CertFile   string             `json:"cert_file"`
	KeyFile    string             `json:"key_file"`
	RawPlugins []plugin.RawPlugin `json:"plugins"`
	Paths      Paths              `json:"paths"`
	Plugins    []plugin.Plugin    `json:"-"`
	Group      *echo.Group        `json:"-"`
	ClientCAs  []string           `json:"client_ca"`
	TLSConfig  *tls.Config        `json:"-"`
	// contains filtered or unexported fields
}

func (*Host) AddPlugin added in v0.4.12

func (h *Host) AddPlugin(p plugin.Plugin)

func (*Host) FindPath added in v0.4.12

func (h *Host) FindPath(name string) (p *Path)

func (*Host) UpdatePlugin added in v0.4.12

func (h *Host) UpdatePlugin(plugin plugin.Plugin)

type Hosts added in v0.4.12

type Hosts map[string]*Host

type Path

type Path struct {
	Name       string             `json:"-"`
	RawPlugins []plugin.RawPlugin `json:"plugins"`
	Plugins    []plugin.Plugin    `json:"-"`
	Group      *echo.Group        `json:"-"`
	// contains filtered or unexported fields
}

func (*Path) AddPlugin added in v0.4.12

func (p *Path) AddPlugin(plugin plugin.Plugin)

func (*Path) UpdatePlugin added in v0.4.12

func (p *Path) UpdatePlugin(plugin plugin.Plugin)

type Paths added in v0.4.12

type Paths map[string]*Path

type Postgres added in v0.4.12

type Postgres struct {
	URI string `json:"uri"`
}

type Storm added in v0.4.12

type Storm struct {
	URI string `json:"uri"`
}

type TLS

type TLS struct {
	Address      string `json:"address"`
	Port         string `json:"-"`
	CertFile     string `json:"cert_file"`
	KeyFile      string `json:"key_file"`
	Auto         bool   `json:"auto"`
	CacheDir     string `json:"cache_dir"`
	Email        string `json:"email"`
	DirectoryURL string `json:"directory_url"`
	Secured      bool   `json:"secured"`
}

Directories

Path Synopsis
api
cmd

Jump to

Keyboard shortcuts

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