Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedirectHandler ¶
type RedirectHandler struct {
Shortener *Shortener
}
RedirectHandler handles all the redirects for the Server.
func (RedirectHandler) ServeHTTP ¶
func (h RedirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Shortener ¶
type Shortener struct {
// contains filtered or unexported fields
}
Shortener offers a function to shorten a URL and redirect to the shortened URL as soon as a request comes in.
func NewShortener ¶
NewShortener creates a new server that uses the given port.
func (*Shortener) CalculateShortenedLength ¶ added in v1.1.1
CalculateShortenedLength returns the length of the shortened URL without a suffix and the length of the suffix, which is 0 if the suffix isn't available.
func (*Shortener) Close ¶
func (shortener *Shortener) Close()
Close closes the internal http server.
Click to show internal directories.
Click to hide internal directories.