Skip to content

Bios-Marcel/shortnotforlong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A golang link shortener that allows shortening a rather small amount of links and throws them away on shutdown.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages