Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 815 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 815 Bytes

Short but not for long

builds.sr.ht status

This is a small link shortener written in golang. It's not meant for permanently shortening link. So in case you don't want dead links after a reboot, this is not for you.

On top of forgetting everything on reboot, it can't hold many links, the upper limit is math.MaxUint16.

Usage example

func main() {
    shortener := NewShortener(1234)
    fmt.Println(shortener.Shorten("https://google.com"))

    blocker := make(chan struct{})
    go func() {
        log.Fatalln(shortener.Start())
        blocker <- struct{}{}
    }()

    <-blocker
}

Run it, open your browser and visit the link that the main-function spits out.