mirror of
https://github.com/ap-pauloafonso/ratio-spoof.git
synced 2026-01-11 20:10:22 +00:00
Merge pull request #9 from ap-pauloafonso/qbit-refactor
qbit emulation refactor
This commit is contained in:
commit
fe5c6bde7a
2 changed files with 5 additions and 5 deletions
|
|
@ -13,7 +13,8 @@ const (
|
|||
query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&corrupt=0&key={key}&event={event}&numwant={numwant}&compact=1&no_peer_id=1&supportcrypto=1&redundant=0"
|
||||
)
|
||||
|
||||
type TypeTest struct {
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
type qbitTorrent struct {
|
||||
|
|
@ -68,7 +69,6 @@ func generatePeerID() string {
|
|||
}
|
||||
|
||||
func randStringBytes(n int) string {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type ratioSpoofState struct {
|
|||
httpClient HttpClient
|
||||
torrentInfo *torrentInfo
|
||||
input *inputParsed
|
||||
bitTorrentClient TorrentClient
|
||||
bitTorrentClient TorrentClientEmulation
|
||||
currentAnnounceTimer int
|
||||
announceInterval int
|
||||
numWant int
|
||||
|
|
@ -121,7 +121,7 @@ func (I *InputArgs) parseInput(torrentInfo *torrentInfo) (*inputParsed, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func NewRatioSPoofState(input InputArgs, torrentClient TorrentClient, httpclient HttpClient) (*ratioSpoofState, error) {
|
||||
func NewRatioSPoofState(input InputArgs, torrentClient TorrentClientEmulation, httpclient HttpClient) (*ratioSpoofState, error) {
|
||||
|
||||
torrentInfo, err := extractTorrentInfo(input.TorrentPath)
|
||||
if err != nil {
|
||||
|
|
@ -201,7 +201,7 @@ type trackerResponse struct {
|
|||
leechers int
|
||||
}
|
||||
|
||||
type TorrentClient interface {
|
||||
type TorrentClientEmulation interface {
|
||||
PeerID() string
|
||||
Key() string
|
||||
Query() string
|
||||
|
|
|
|||
Loading…
Reference in a new issue