server

package
v0.0.0-...-abdd10e Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c *config.Config) (api.Server, error)

New builds a Server from the given Config struct.

func NewFromBytes

func NewFromBytes(bs []byte) (api.Server, error)

NewFromBytes builds a Server from the given byte slice. Contents should be YAML.

func NewFromFile

func NewFromFile(fn string) (api.Server, error)

NewFromFile builds a Server from the given config file. File should be YAML data.

Types

type Endpoint

type Endpoint struct {
	Addr     string
	CertFile string
	KeyFile  string
	TLS      bool
}

type Server

type Server struct {
	Config *config.Config
	Router *mux.Router

	Endpoints   []Endpoint
	HttpServers map[string]*http.Server
	InitFuncs   []func(L *lua.LState) error
	RootState   *lua.LState
}

Root handler, delegates to an internal mux.

func (*Server) Endpoint

func (s *Server) Endpoint(host, certfile, keyfile string, tls bool)

func (*Server) HttpServer

func (s *Server) HttpServer(host string) *http.Server

func (*Server) NewLuaState

func (s *Server) NewLuaState(w http.ResponseWriter, r *http.Request) *lua.LState

func (*Server) OnInit

func (s *Server) OnInit(f func(L *lua.LState) error)

implement the Server interface:

func (*Server) Route

func (s *Server) Route(path string) *mux.Route

func (*Server) Run

func (s *Server) Run() (err error)

Jump to

Keyboard shortcuts

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