Documentation ¶
Index ¶
- Variables
- func Dump(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func FromFile(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func FromPost(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func IndexHandler(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func Redir(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func Short(t *template.Template) func(ctx *fasthttp.RequestCtx)
- func ToFile(t *template.Template) func(ctx *fasthttp.RequestCtx)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Src tiny entropy Pool Src = rand.NewSource(time.Now().UnixNano()) // Pool KV memory DB Pool *cache.Cache // URLSize is the default size of the shortened URL URLSize int = 10 // Port is the listening port address Port int = 8080 // Exp is the expiration time of the shortened URL Exp time.Duration = 240 * time.Hour // Cleanup is the clean up time interval Cleanup time.Duration = 1 * time.Hour // Proto is the shortened URL protocol Proto string = "https" // Domain is the shortened URL domain Domain string = "localhost" // Path is the shortened URL prefix path Path string = "" // DumpFile is the file to dump URL data DumpFile string = "urls.json" )
Functions ¶
func Dump ¶
func Dump(t *template.Template) func(ctx *fasthttp.RequestCtx)
Dump return a fasthttp.RequestHandler function that dumps the contents of the KV db to the ctx handler
func FromFile ¶
func FromFile(t *template.Template) func(ctx *fasthttp.RequestCtx)
FromFile return a fasthttp.RequestHandler function that loads the content of the DumpFile into the KV db
func FromPost ¶
func FromPost(t *template.Template) func(ctx *fasthttp.RequestCtx)
FromPost return a fasthttp.RequestHandler function that loads the content of the JSON POST into the KV db
func IndexHandler ¶
func IndexHandler(t *template.Template) func(ctx *fasthttp.RequestCtx)
IndexHandler return a fasthttp.RequestHandler function that genetares the index page
func Redir ¶
func Redir(t *template.Template) func(ctx *fasthttp.RequestCtx)
Redir return a fasthttp.RequestHandler function that genetares the shortener redirect page
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.