Compare commits
	
		
			3 Commits
		
	
	
		
			7394c1b49e
			...
			fb8825249a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fb8825249a | |||
| 961d8ecbb0 | |||
| ca29d9fe53 | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,2 @@
 | 
			
		||||
data/
 | 
			
		||||
./shortify/
 | 
			
		||||
shortify/
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,10 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"git.tijl.dev/tijl/shortify"
 | 
			
		||||
	"git.tijl.dev/tijl/shortify/pkg/generation"
 | 
			
		||||
	"github.com/gofiber/fiber/v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -13,6 +16,9 @@ func main() {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// example decoding
 | 
			
		||||
	fmt.Println(generation.DecodeBase62("11uPoqA1W"))
 | 
			
		||||
 | 
			
		||||
	// listen the admin interface
 | 
			
		||||
 | 
			
		||||
	unixListener, err := shortify.GetUnixListener("./shortify/admin.sock")
 | 
			
		||||
 | 
			
		||||
@ -7,11 +7,11 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	idSize      = 4                   // 4 bytes for random part
 | 
			
		||||
	idSize      = 6                   // 4 bytes for random part
 | 
			
		||||
	prefixSize  = 2                   // 2 bytes for client prefix
 | 
			
		||||
	rawIDLength = prefixSize + idSize // total 6 bytes
 | 
			
		||||
	base62Len   = 8                   // 6 bytes encoded in base62 ~ 8 chars
 | 
			
		||||
	poolSize    = 10000
 | 
			
		||||
	//base62Len   = 8                   // 6 bytes encoded in base62 ~ 8 chars
 | 
			
		||||
	poolSize = 10000
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Generator struct {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user