mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-26 07:30:00 -07:00
fix lint warnings, update wf go version
This commit is contained in:
@@ -3,12 +3,10 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"crypto/rand"
|
||||
"net/netip"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
// used for seeding global math.Rand
|
||||
_ "github.com/sot-tech/mochi/pkg/randseed"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -25,14 +23,18 @@ func randIH(v2 bool) (ih bittorrent.InfoHash) {
|
||||
} else {
|
||||
b = make([]byte, bittorrent.InfoHashV1Len)
|
||||
}
|
||||
rand.Read(b)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ih, _ = bittorrent.NewInfoHash(b)
|
||||
return
|
||||
}
|
||||
|
||||
func randPeerID() (ih bittorrent.PeerID) {
|
||||
b := make([]byte, bittorrent.PeerIDLen)
|
||||
rand.Read(b)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ih, _ = bittorrent.NewPeerID(b)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user