core

package
v0.0.0-...-b5a4b96 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2016 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package core contains main internal methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanWorker

func CleanWorker(c *conf.Config)

CleanWorker deactivates expired short URLs periodically every 5 minutes.

func HandlerRedirect

func HandlerRedirect(ctx context.Context, short string, r *http.Request) (string, error)

HandlerRedirect searches saved original URL by a short one.

func RunWorkers

func RunWorkers(ctx context.Context) (context.Context, error)

RunWorkers runs tracker workers.

func TrackerChan

func TrackerChan(ctx context.Context) (chan *CuInfo, error)

TrackerChan extracts tracker channel.

func TrimAddress

func TrimAddress(uri string) (string, error)

TrimAddress returns URL path.

Types

type CuInfo

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

CuInfo is trim.CustomURL info with context.

type ErrHandler

type ErrHandler struct {
	Err    error
	Status int
}

ErrHandler is a struct that contains handler error and returned HTTP status code.

func HandlerError

func HandlerError(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler

HandlerError returns "error" web page.

func HandlerIndex

func HandlerIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler

HandlerIndex returns index web page.

func HandlerNoWebIndex

func HandlerNoWebIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler

HandlerNoWebIndex works like version but return only short link text.

func HandlerNotFound

func HandlerNotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler

HandlerNotFound returns "not found" web page.

func HandlerTest

func HandlerTest(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler

HandlerTest handles test GET request.

func (ErrHandler) String

func (eh ErrHandler) String() string

String return main string info about error handler.

Jump to

Keyboard shortcuts

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