Documentation ¶
Overview ¶
Package core contains main internal methods.
Index ¶
- func CleanWorker(c *conf.Config)
- func HandlerRedirect(ctx context.Context, short string, r *http.Request) (string, error)
- func RunWorkers(ctx context.Context) (context.Context, error)
- func TrackerChan(ctx context.Context) (chan *CuInfo, error)
- func TrimAddress(uri string) (string, error)
- type CuInfo
- type ErrHandler
- func HandlerError(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler
- func HandlerIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler
- func HandlerNoWebIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler
- func HandlerNotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler
- func HandlerTest(ctx context.Context, w http.ResponseWriter, r *http.Request) ErrHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanWorker ¶
CleanWorker deactivates expired short URLs periodically every 5 minutes.
func HandlerRedirect ¶
HandlerRedirect searches saved original URL by a short one.
func RunWorkers ¶
RunWorkers runs tracker workers.
func TrackerChan ¶
TrackerChan extracts tracker channel.
Types ¶
type CuInfo ¶
type CuInfo struct {
// contains filtered or unexported fields
}
CuInfo is trim.CustomURL info with context.
type ErrHandler ¶
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.