mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-12 07:43:32 -07:00
Reformat comments
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
go-version: "^1.18"
|
||||
- uses: "golangci/golangci-lint-action@v3"
|
||||
with:
|
||||
version: "v1.43"
|
||||
version: "v1.45.2"
|
||||
skip-pkg-cache: true
|
||||
skip-build-cache: false
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ var ErrKeyNotFound = errors.New("query: value for the provided key does not exis
|
||||
|
||||
// ErrInvalidInfohash is returned when parsing a query encounters an infohash
|
||||
// with invalid length.
|
||||
//var ErrInvalidInfohash = ClientError("provided invalid infohash")
|
||||
// var ErrInvalidInfohash = ClientError("provided invalid infohash")
|
||||
|
||||
// ErrInvalidQueryEscape is returned when a query string contains invalid
|
||||
// escapes.
|
||||
|
||||
+2
-2
@@ -77,14 +77,14 @@ type skipResponseHook struct{}
|
||||
// skip.
|
||||
var SkipResponseHookKey = skipResponseHook{}
|
||||
|
||||
//type scrapeAddressType struct{}
|
||||
// type scrapeAddressType struct{}
|
||||
|
||||
// ScrapeIsIPv6Key is the key under which to store whether or not the
|
||||
// address used to request a scrape was an IPv6 address.
|
||||
// The value is expected to be of type bool.
|
||||
// A missing value or a value that is not a bool for this key is equivalent to
|
||||
// it being set to false.
|
||||
//var ScrapeIsIPv6Key = scrapeAddressType{}
|
||||
// var ScrapeIsIPv6Key = scrapeAddressType{}
|
||||
|
||||
type responseHook struct {
|
||||
store storage.Storage
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
//Seeding global math random
|
||||
// Seeding global math random
|
||||
rand.Seed(GenSeed())
|
||||
}
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ func asKey(in any) any {
|
||||
if reflect.TypeOf(in).Comparable() {
|
||||
return in
|
||||
}
|
||||
//FIXME: dirty hack
|
||||
// FIXME: dirty hack
|
||||
return fmt.Sprint(in)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -34,7 +34,8 @@ func (pk SerializedPeer) ToPeer() bittorrent.Peer {
|
||||
peer := bittorrent.Peer{
|
||||
ID: peerID,
|
||||
Port: binary.BigEndian.Uint16([]byte(pk[bittorrent.PeerIDLen : bittorrent.PeerIDLen+2])),
|
||||
IP: bittorrent.IP{IP: net.IP(pk[bittorrent.PeerIDLen+2:])}}
|
||||
IP: bittorrent.IP{IP: net.IP(pk[bittorrent.PeerIDLen+2:])},
|
||||
}
|
||||
|
||||
if ip := peer.IP.To4(); ip != nil {
|
||||
peer.IP.IP = ip
|
||||
|
||||
@@ -573,7 +573,6 @@ func (ps *store) AnnouncePeers(ih bittorrent.InfoHash, seeder bool, numWant int,
|
||||
}
|
||||
|
||||
func (ps *store) ScrapeSwarm(ih bittorrent.InfoHash, af bittorrent.AddressFamily) (resp bittorrent.Scrape) {
|
||||
|
||||
resp.InfoHash = ih
|
||||
addressFamily := af.String()
|
||||
encodedInfoHash := ih.String()
|
||||
@@ -816,7 +815,7 @@ func (ps *store) collectGarbage(cutoff time.Time) error {
|
||||
if ihLen == 0 {
|
||||
// Empty hashes are not shown among existing keys,
|
||||
// in other words, it's removed automatically after `HDEL` the last field.
|
||||
//_, err := conn.Do("DEL", ihStr)
|
||||
// _, err := conn.Do("DEL", ihStr)
|
||||
|
||||
_ = conn.Send("MULTI")
|
||||
_ = conn.Send("HDEL", group, ihStr)
|
||||
|
||||
@@ -23,7 +23,8 @@ func createNew() s.Storage {
|
||||
RedisBroker: redisURL,
|
||||
RedisReadTimeout: 10 * time.Second,
|
||||
RedisWriteTimeout: 10 * time.Second,
|
||||
RedisConnectTimeout: 10 * time.Second})
|
||||
RedisConnectTimeout: 10 * time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user