Compare commits

..

3 Commits

Author SHA1 Message Date
fb8825249a
up 2025-08-06 18:18:13 +02:00
961d8ecbb0
up 2025-08-06 18:18:03 +02:00
ca29d9fe53
up 2025-08-06 18:17:50 +02:00
3 changed files with 10 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
data/ data/
./shortify/ shortify/

View File

@ -1,7 +1,10 @@
package main package main
import ( import (
"fmt"
"git.tijl.dev/tijl/shortify" "git.tijl.dev/tijl/shortify"
"git.tijl.dev/tijl/shortify/pkg/generation"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@ -13,6 +16,9 @@ func main() {
panic(err) panic(err)
} }
// example decoding
fmt.Println(generation.DecodeBase62("11uPoqA1W"))
// listen the admin interface // listen the admin interface
unixListener, err := shortify.GetUnixListener("./shortify/admin.sock") unixListener, err := shortify.GetUnixListener("./shortify/admin.sock")

View File

@ -7,10 +7,10 @@ import (
) )
const ( const (
idSize = 4 // 4 bytes for random part idSize = 6 // 4 bytes for random part
prefixSize = 2 // 2 bytes for client prefix prefixSize = 2 // 2 bytes for client prefix
rawIDLength = prefixSize + idSize // total 6 bytes rawIDLength = prefixSize + idSize // total 6 bytes
base62Len = 8 // 6 bytes encoded in base62 ~ 8 chars //base62Len = 8 // 6 bytes encoded in base62 ~ 8 chars
poolSize = 10000 poolSize = 10000
) )