etch

package module
v0.0.0-...-7f3cd5c Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2014 License: MIT Imports: 16 Imported by: 0

README

etch

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLoggers

func ConfigureLoggers()

Types

type Cache

type Cache struct {
	Root string
}

func (*Cache) GetEntry

func (cache *Cache) GetEntry(url *url.URL) *CacheEntry

func (*Cache) Keys

func (cache *Cache) Keys() []*url.URL

func (*Cache) UrlToFilePath

func (cache *Cache) UrlToFilePath(url *url.URL) string

type CacheDeleteEvent

type CacheDeleteEvent struct {
	URL *url.URL
}

func (CacheDeleteEvent) Json

func (e CacheDeleteEvent) Json() ([]byte, error)

type CacheEntry

type CacheEntry struct {
	URL      *url.URL
	FilePath string
	sync.RWMutex
}

func (*CacheEntry) Delete

func (cacheEntry *CacheEntry) Delete() error

func (*CacheEntry) FreshenContent

func (cacheEntry *CacheEntry) FreshenContent(content []byte, mtime time.Time) (bool, error)

func (*CacheEntry) GetContent

func (cacheEntry *CacheEntry) GetContent() ([]byte, time.Time, error)

type CacheUpdateEvent

type CacheUpdateEvent struct {
	URL   *url.URL
	Since int
}

func (CacheUpdateEvent) Json

func (e CacheUpdateEvent) Json() ([]byte, error)

type ControlServer

type ControlServer struct {
	*http.ServeMux
	Proxy *ProxyServer
}

func NewControlServer

func NewControlServer(proxy *ProxyServer) *ControlServer

func (*ControlServer) Setup

func (control *ControlServer) Setup()

type EtchContextData

type EtchContextData struct {
	CachedContent *bytes.Buffer
}

type Event

type Event interface {
	Json() ([]byte, error)
}

type Listeners

type Listeners struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Listeners) Broadcast

func (l *Listeners) Broadcast(e Event)

func (*Listeners) Create

func (l *Listeners) Create() chan Event

func (*Listeners) Remove

func (l *Listeners) Remove(ch <-chan Event)

type LogFormatter

type LogFormatter struct{}

func (*LogFormatter) Format

func (*LogFormatter) Format(level loggo.Level, module, filename string, line int, timestamp time.Time, message string) string

type ProxyServer

type ProxyServer struct {
	goproxy.ProxyHttpServer
	Cache        *Cache
	RequestMutex *RequestMutex
	*Listeners
}

func NewProxyServer

func NewProxyServer(cacheDir string) *ProxyServer

func (*ProxyServer) FixStatusCode

func (proxy *ProxyServer) FixStatusCode(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response

func (*ProxyServer) GuardRequest

func (proxy *ProxyServer) GuardRequest(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response)

func (*ProxyServer) PrepareRangedRequest

func (proxy *ProxyServer) PrepareRangedRequest(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response)

func (*ProxyServer) RestoreCache

func (proxy *ProxyServer) RestoreCache(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response

func (*ProxyServer) Setup

func (proxy *ProxyServer) Setup()

func (*ProxyServer) StoreCache

func (proxy *ProxyServer) StoreCache(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response

func (*ProxyServer) UnguardRequest

func (proxy *ProxyServer) UnguardRequest(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response

type RequestMutex

type RequestMutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type Server

type Server struct {
	*ProxyServer
	*ControlServer
	*http.ServeMux
}

func NewServer

func NewServer(cacheDir string, hosts []string) *Server

func (*Server) ListenAndServe

func (server *Server) ListenAndServe(port int) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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