switcher

package module
v0.0.0-...-44ad1a6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

README

switcher

GitHub Workflow Status codecov GoDoc Sourcegraph

Module switcher provides host switch functionality for Macaron.

Installation
go get github.com/go-macaron/switcher

Getting Help

License

This project is under the Apache License, Version 2.0. See the LICENSE file for the full license text.

Documentation

Overview

Package switcher is a helper module that provides host switch functionality for Macaron.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultListenAddr

func GetDefaultListenAddr() string

GetDefaultListenAddr returns default server listen address of Macaron.

Types

type HostSwitcher

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

HostSwitcher represents a global multi-site support layer.

func NewHostSwitcher

func NewHostSwitcher() *HostSwitcher

NewHostSwitcher initalizes and returns a new host switcher. You have to use this function to get a new host switcher.

func (*HostSwitcher) Remove

func (hs *HostSwitcher) Remove(name string)

Remove removes a switch from host switcher.

func (*HostSwitcher) Run

func (hs *HostSwitcher) Run()

Run the http server. Listening on os.GetEnv("PORT") or 4000 by default.

func (*HostSwitcher) RunOnAddr

func (hs *HostSwitcher) RunOnAddr(addr string)

RunOnAddr runs server in given address and port.

func (*HostSwitcher) ServeHTTP

func (hs *HostSwitcher) ServeHTTP(resp http.ResponseWriter, req *http.Request)

ServeHTTP is the HTTP Entry point for a Host Switcher instance.

func (*HostSwitcher) Set

func (hs *HostSwitcher) Set(name string, m *macaron.Macaron)

Set adds a new switch to host switcher.

Jump to

Keyboard shortcuts

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