add base files
This commit is contained in:
11
lib/common/base32/base32.go
Normal file
11
lib/common/base32/base32.go
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// base32 encoding using i2p's alphabet
|
||||
//
|
||||
package base32
|
||||
|
||||
import (
|
||||
b32 "encoding/base32"
|
||||
)
|
||||
|
||||
// i2p base32 encoding
|
||||
var I2PEncoding *b32.Encoding = b32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567")
|
11
lib/common/base64/base64.go
Normal file
11
lib/common/base64/base64.go
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// base64 encoding with i2p's alphabet
|
||||
//
|
||||
package base64
|
||||
|
||||
import (
|
||||
b64 "encoding/base64"
|
||||
)
|
||||
|
||||
// i2p base64 encoding
|
||||
var I2PEncoding *b64.Encoding = b64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~")
|
5
lib/common/data.go
Normal file
5
lib/common/data.go
Normal file
@ -0,0 +1,5 @@
|
||||
package common
|
||||
|
||||
|
||||
// the sha256 of some datastructure
|
||||
type IdentHash [32]byte
|
14
lib/common/utils.go
Normal file
14
lib/common/utils.go
Normal file
@ -0,0 +1,14 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// check if a file is there and writeable
|
||||
func FileExists(fname string) (exists bool) {
|
||||
_, err := os.Stat(fname)
|
||||
if err == nil {
|
||||
exists = true
|
||||
}
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user