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.
Click to show internal directories.
Click to hide internal directories.