feat: set derp map for a tailnet

This commit is contained in:
Johan Siebens
2022-10-04 16:06:15 +02:00
parent 58de86a978
commit 70b9373df3
20 changed files with 857 additions and 816 deletions
+12
View File
@@ -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[:])
}