set mochi-2e2 as submodule

* update go version to 1.23
* remove sha256-simd dependency
* fix logger file path
This commit is contained in:
Lawrence, Rendall
2024-10-01 16:17:42 +03:00
parent b211866cf3
commit 9fc94617ce
10 changed files with 373 additions and 327 deletions
+13 -11
View File
@@ -4,6 +4,7 @@ import (
"context"
"crypto/ecdsa"
cr "crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"math/rand"
@@ -14,7 +15,6 @@ import (
"time"
"github.com/golang-jwt/jwt/v5"
"github.com/minio/sha256-simd"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
@@ -76,17 +76,19 @@ func init() {
}
s2.Write(ecdhPubKey.Bytes())
// s2.Write(elliptic.Marshal(privKey.PublicKey.Curve, privKey.PublicKey.X, privKey.PublicKey.Y))
jwksData = JWKSKeys{Keys: []JWKSKey{
{
KeyType: "EC",
Usage: "sig",
KeyID: base64.RawURLEncoding.EncodeToString(s2.Sum(nil)),
Algorithm: jwt.SigningMethodES256.Name,
Curve: privKey.Curve.Params().Name,
X: base64.RawURLEncoding.EncodeToString(privKey.PublicKey.X.Bytes()),
Y: base64.RawURLEncoding.EncodeToString(privKey.PublicKey.Y.Bytes()),
jwksData = JWKSKeys{
Keys: []JWKSKey{
{
KeyType: "EC",
Usage: "sig",
KeyID: base64.RawURLEncoding.EncodeToString(s2.Sum(nil)),
Algorithm: jwt.SigningMethodES256.Name,
Curve: privKey.Curve.Params().Name,
X: base64.RawURLEncoding.EncodeToString(privKey.PublicKey.X.Bytes()),
Y: base64.RawURLEncoding.EncodeToString(privKey.PublicKey.Y.Bytes()),
},
},
}}
}
}
func TestHook_HandleAnnounceValid(t *testing.T) {
@@ -7,6 +7,7 @@ package directory
import (
"context"
"crypto/sha1"
"crypto/sha256"
"fmt"
"io"
"os"
@@ -14,8 +15,6 @@ import (
"strings"
"time"
"github.com/minio/sha256-simd"
"github.com/zeebo/bencode"
"github.com/sot-tech/mochi/bittorrent"