implement ip cloaking

This commit is contained in:
Shivaram Lingamneni 2019-05-12 02:17:57 -04:00
parent 585a6557a4
commit c28e6d13f9
7 changed files with 216 additions and 3 deletions

View file

@ -11,7 +11,7 @@ import (
var (
// slingamn's own private b32 alphabet, removing 1, l, o, and 0
b32encoder = base32.NewEncoding("abcdefghijkmnpqrstuvwxyz23456789").WithPadding(base32.NoPadding)
B32Encoder = base32.NewEncoding("abcdefghijkmnpqrstuvwxyz23456789").WithPadding(base32.NoPadding)
)
const (
@ -24,7 +24,7 @@ func GenerateSecretToken() string {
var buf [16]byte
rand.Read(buf[:])
// 26 ASCII characters, should be fine for most purposes
return b32encoder.EncodeToString(buf[:])
return B32Encoder.EncodeToString(buf[:])
}
// securely check if a supplied token matches a stored token