Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkMapper ¶
LinkMapper generates IDs from URLs
type LinkRepository ¶
type LinkRepository interface { Get(id string) (*url.URL, error) Set(id string, url *url.URL) error }
A LinkRepository persists ID <=> URL pairs
type LinkShortener ¶
type LinkShortener struct {
// contains filtered or unexported fields
}
A LinkShortener turns fully-qualified URLS into shorter IDs, and back again
func Make ¶
func Make(guard LinkGuard, mapper LinkMapper, repo LinkRepository) *LinkShortener
Make a default shortener with passed implementations
func (*LinkShortener) Allowed ¶
func (repo *LinkShortener) Allowed(link *url.URL) bool
Allowed returns true if the link is allowed to be shortened
Click to show internal directories.
Click to hide internal directories.