mirror of
https://github.com/jsiebens/ionscale.git
synced 2026-03-31 15:07:49 +01:00
feat: set derp map for a tailnet
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
@@ -46,3 +49,12 @@ func NewPrivateKey() (*rsa.PrivateKey, string, error) {
|
||||
|
||||
return privateKey, id, nil
|
||||
}
|
||||
|
||||
func Checksum(v interface{}) string {
|
||||
marshal, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sum := md5.Sum(marshal)
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user