mid

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 26 Imported by: 1

Documentation

Overview

Package cache - in memory and on disk cache - disk for proxies

Copyright (C) Philip Schlump, 2016

Index

Constants

This section is empty.

Variables

View Source
var ErrInternalError = errors.New("Internal Error")
View Source
var ErrInvalidConfiguration = errors.New("Invalid Configuration")
View Source
var ErrMuxError = errors.New("Mux reported an error")
View Source
var ErrNonMidBufferWriter = errors.New("Invalid type - needs to be a goftlmux.MidBuffer")
View Source
var FtlConfigError = errors.New("Invalid type supplied to configuration function")
View Source
var NewInit3 []GoFtlHttpServer
View Source
var NormalUnused []goftlmux.UnusedParam

Functions

func GetTrx

func GetTrx(www http.ResponseWriter) (ptr *tr.Trx)

func GetTrx1

func GetTrx1(rw *goftlmux.MidBuffer) (ptr *tr.Trx)

func LookupInLRU

func LookupInLRU(fn string, www http.ResponseWriter, req *http.Request) bool

func LookupInitByName3

func LookupInitByName3(name string) (p int)

func LookupPluginList

func LookupPluginList() (rv string)

pluginList := mid.LookupPluginList()

func NewConstHandler

func NewConstHandler(body, n, v string) http.Handler

func NewConstHandler() *ConstHandler {

func ReadConfigFile2

func ReadConfigFile2(fn string)

func RegInitItem3

func RegInitItem3(name string, fx CreateEmptyFx3, valid string)

/Users/corwin/go/src/github.com/pschlump/Go-FTL/server/cfg/cfg.go

Types

type BotHandler

type BotHandler struct {
}

func (*BotHandler) InitializeWithConfigData

func (hdlr *BotHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*BotHandler) PreValidate

func (hdlr *BotHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*BotHandler) ServeHTTP

func (hdlr *BotHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)

type CacheHandlerType

type CacheHandlerType struct {
	Next        http.Handler
	Paths       []string
	CacheDir    string
	CacheSize   int64
	LimitTooBig int64
}

func NewCacheServer

func NewCacheServer(n http.Handler, p []string, d string, siz int64, lim int64) *CacheHandlerType

func (*CacheHandlerType) InitializeWithConfigData

func (hdlr *CacheHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*CacheHandlerType) PreValidate

func (hdlr *CacheHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*CacheHandlerType) ServeHTTP

func (hdlr *CacheHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)

ServeHTTP(www http.ResponseWriter, req *http.Request)

type ConstHandler

type ConstHandler struct {
	TheBody      string
	AHeader      string
	AHeaderValue string
}

---------------------------------------------------------------------------------------------------------------------------------------------------- Return a constant string value. ---------------------------------------------------------------------------------------------------------------------------------------------------- ct := h.Get("Content-Type") if rw.StatusCode == http.StatusOK && strings.HasPrefix(ct, "application/json") {

func (ConstHandler) ServeHTTP

func (hdlr ConstHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)

type CreateEmptyFx3

type CreateEmptyFx3 func(name string) GoFTLMiddleWare

------------------------------------------------------------------------------------------------------------------------------------------------- new interface based -------------------------------------------------------------------------------------------------------------------------------------------------

type GoFTLMiddleWare

type GoFTLMiddleWare interface {
	// InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (rv GoFTLMiddleWare, err error)
	InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
	PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
	ServeHTTP(www http.ResponseWriter, req *http.Request)
}

func NewBotHandler

func NewBotHandler() GoFTLMiddleWare

func NewBotHandler() http.Handler {

func NewTopHandler

func NewTopHandler(next http.Handler, gCfg *cfg.ServerGlobalConfigType, ppCfg interface{}, serverName string, pNo int) GoFTLMiddleWare

type GoFtlHttpServer

type GoFtlHttpServer struct {
	Name        string         // Name of this (the directive this is called by
	ValidJSON   string         // JSONP/JsonX validaiton string for config for this item
	CreateEmpty CreateEmptyFx3 //
	CallNo      int            //
}

type GoTemplateServer

type GoTemplateServer struct {
	Next          http.Handler // No Next, this is the bottom of the stack.
	Paths         []string
	Root          []string
	IndexFileList []string
	LineNo        int
}

func NewGoTemplateServer

func NewGoTemplateServer(n http.Handler, p []string, r []string, m []string) *GoTemplateServer

func (*GoTemplateServer) InitializeWithConfigData

func (hdlr *GoTemplateServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*GoTemplateServer) PreValidate

func (hdlr *GoTemplateServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (GoTemplateServer) ServeHTTP

func (hdlr GoTemplateServer) ServeHTTP(www http.ResponseWriter, req *http.Request)

This is the bottom of the stack - at this point we check

  1. If the file is in the in-memory cache
  2. If the file is on disk

Also this is the simple server - only one location to check.

type LRUItemType

type LRUItemType struct {
	Length         int64
	ModDateTime    time.Time
	SHA1Hash       string
	URLPath        string
	FileSystemPath string
	LineNo         int
	Data           []byte // Optional Data - if using Redis - then this may be empty - and read off of disk.
	SavedInFile    string // if not "", then it was written out to file system.
}

type MidServer

type MidServer struct {
	Info string
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *MidServer

func (*MidServer) InitializeWithConfigData

func (hdlr *MidServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*MidServer) PreValidate

func (hdlr *MidServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*MidServer) ServeHTTP

func (ms *MidServer) ServeHTTP(wr http.ResponseWriter, req *http.Request)

func (*MidServer) SetInfo

func (ms *MidServer) SetInfo(s string)

type SimpleFileServer

type SimpleFileServer struct {
	Next          http.Handler // No Next, this is the bottom of the stack.
	Paths         []string
	Root          []string
	IndexFileList []string
	LineNo        int
}

func NewSimpleFileServer

func NewSimpleFileServer(n http.Handler, p []string, r []string, m []string) *SimpleFileServer

func (*SimpleFileServer) InitializeWithConfigData

func (hdlr *SimpleFileServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*SimpleFileServer) PreValidate

func (hdlr *SimpleFileServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*SimpleFileServer) ServeHTTP

func (hdlr *SimpleFileServer) ServeHTTP(www http.ResponseWriter, req *http.Request)

type SimpleProxyHandlerType

type SimpleProxyHandlerType struct {
	Next   http.Handler
	Paths  []string
	Dest   string
	LineNo int
	// contains filtered or unexported fields
}

func NewSimpleProxyServer

func NewSimpleProxyServer(n http.Handler, p []string, d string) *SimpleProxyHandlerType

func (*SimpleProxyHandlerType) InitializeWithConfigData

func (hdlr *SimpleProxyHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*SimpleProxyHandlerType) PreValidate

func (hdlr *SimpleProxyHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (SimpleProxyHandlerType) ServeHTTP

func (hdlr SimpleProxyHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)

type StripPrefixType

type StripPrefixType struct {
	Next   http.Handler //
	Paths  []string     //
	Prefix string       // regular expression
	// contains filtered or unexported fields
}

func NewStripPrefixServer

func NewStripPrefixServer(n http.Handler, p []string, h, v string) *StripPrefixType

func (*StripPrefixType) InitializeWithConfigData

func (hdlr *StripPrefixType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*StripPrefixType) PreValidate

func (hdlr *StripPrefixType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (StripPrefixType) ServeHTTP

func (hdlr StripPrefixType) ServeHTTP(www http.ResponseWriter, req *http.Request)

type TopHandler

type TopHandler struct {
	Format string
	Root   []string
	Next   http.Handler // Required field for all chaining of middleware.
}

func (*TopHandler) InitializeWithConfigData

func (hdlr *TopHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*TopHandler) PreValidate

func (hdlr *TopHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*TopHandler) ServeHTTP

func (hdlr *TopHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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