http

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SpecificThrotling is semaphore per domain
	SpecificThrotling map[string]chan struct{}
	// GlobalThrotling is global semaphore
	GlobalThrotling chan struct{}
)

Functions

func Fetch

func Fetch(opts *ServerOpts) func(http.ResponseWriter, *http.Request)

Fetch takes url + params in url to download image from url and apply filters

func Middleware

func Middleware(handler func(w http.ResponseWriter, r *http.Request), opts *ServerOpts) http.HandlerFunc

Middleware composes all middlewares

func RobotsTXT

func RobotsTXT(w http.ResponseWriter, r *http.Request)

RobotsTXT return robots.txt valid for complete disallow

func Serve

func Serve(opts *ServerOpts)

Serve is the main func for start http server

func Up

func Up(w http.ResponseWriter, r *http.Request)

Up is the health check for application

Types

type Mux

type Mux struct {
	Routes map[string]func(http.ResponseWriter, *http.Request)
}

Mux is the custom Router needed in order to avoid URL cleaning

func (*Mux) Handle

func (mux *Mux) Handle(route string, handler func(w http.ResponseWriter, r *http.Request))

Handle adds new route with their handler

func (*Mux) ServeHTTP

func (mux *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP manage custom url multiplexing avoiding path.clean in default go http mux.

type ServerOpts

type ServerOpts struct {
	MaxRequest          int
	MaxRequestPerDomain int
	Port                string
	Domain              string
	SSLDir              string
	CDNTTL              string
	AllowedReferers     []string
	StorageDriver       storage.Driver
	FSBase              string
	GCEProject          string
	GSBucket            string
	GSCredencials       string
}

ServerOpts contains confif for Application

Jump to

Keyboard shortcuts

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