https://github.com/bios-marcel/shortnotforlong
A golang link shortener that allows shortening a rather small amount of links and throws them away on shutdown.
https://github.com/bios-marcel/shortnotforlong
go golang linkshortener short shortener shortening urls
Last synced: 3 months ago
JSON representation
A golang link shortener that allows shortening a rather small amount of links and throws them away on shutdown.
- Host: GitHub
- URL: https://github.com/bios-marcel/shortnotforlong
- Owner: Bios-Marcel
- License: bsd-3-clause
- Created: 2019-02-04T15:28:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-25T21:30:28.000Z (over 5 years ago)
- Last Synced: 2025-07-01T18:55:31.309Z (4 months ago)
- Topics: go, golang, linkshortener, short, shortener, shortening, urls
- Language: Go
- Size: 15.6 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Short but not for long
[](https://builds.sr.ht/~biosmarcel/shortnotforlong/arch.yml?)
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
```go
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.