monkey

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfFiles

func ConfFiles(dir string, extensions []string) ([]string, error)

ConfFiles returns config file list in the dir which has specail extensions

Types

type AllocateHandler

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

AllocateHandler handles the request for allocate information

func NewAllocateHandler

func NewAllocateHandler(etcd *etcd.Etcd) *AllocateHandler

NewAllocateHandler news a Allocator handler

func (*AllocateHandler) ServeHTTP

func (h *AllocateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http

type CaptainConf

type CaptainConf struct {
	// etcd client
	Endpoints string `json:"etcd_endpoints"`
	// etcd perm files
	CertFile      string `json:"etcd_cert_file"`
	KeyFile       string `json:"etcd_key_file"`
	TrustedCAFile string `json:"etcd_ca_cert_file"`
}

CaptainConf is the config for Caption, Maybe we should rename it to MonkeyConf.

func ConfFromBytes

func ConfFromBytes(bytes []byte) (*CaptainConf, error)

ConfFromBytes reads config from byte array

func ConfFromFile

func ConfFromFile(filename string) (*CaptainConf, error)

ConfFromFile reads config from file

func LoadConf

func LoadConf(dir, name string) (*CaptainConf, error)

LoadConf loads config for Monkey

type GatewayHandler

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

GatewayHandler handles the request for gateway information

func NewGatewayHandler

func NewGatewayHandler(etcd *etcd.Etcd) *GatewayHandler

NewGatewayHandler news a GatewayHandler

func (*GatewayHandler) ServeHTTP

func (h *GatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http

type InUseHandler

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

InUseHandler handlers the get request from front end and returns IPs in use. TODO: It should has a member named user_namespace which can filter the result.

func NewInUseHandler

func NewInUseHandler(etcd *etcd.Etcd) *InUseHandler

NewInUseHandler news an InUsedHandler

func (*InUseHandler) ServeHTTP

func (h *InUseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http

type NoConfigsFoundError

type NoConfigsFoundError struct {
	Dir string
}

NoConfigsFoundError when no config files found in dir

func (NoConfigsFoundError) Error

func (e NoConfigsFoundError) Error() string

Error print out the error message for NoConfigFoundError

type NotFoundError

type NotFoundError struct {
	Dir  string
	Name string
}

NotFoundError when the directory and file not found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

Error prints out the error message for NotFoundError

Jump to

Keyboard shortcuts

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