mirror of
https://github.com/ap-pauloafonso/ratio-spoof.git
synced 2026-04-21 08:31:56 +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"
|
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 {
|
type qbitTorrent struct {
|
||||||
|
|
@ -68,7 +69,6 @@ func generatePeerID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func randStringBytes(n int) string {
|
func randStringBytes(n int) string {
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
b := make([]byte, n)
|
b := make([]byte, n)
|
||||||
for i := range b {
|
for i := range b {
|
||||||
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ type ratioSpoofState struct {
|
||||||
httpClient HttpClient
|
httpClient HttpClient
|
||||||
torrentInfo *torrentInfo
|
torrentInfo *torrentInfo
|
||||||
input *inputParsed
|
input *inputParsed
|
||||||
bitTorrentClient TorrentClient
|
bitTorrentClient TorrentClientEmulation
|
||||||
currentAnnounceTimer int
|
currentAnnounceTimer int
|
||||||
announceInterval int
|
announceInterval int
|
||||||
numWant int
|
numWant int
|
||||||
|
|
@ -121,7 +121,7 @@ func (I *InputArgs) parseInput(torrentInfo *torrentInfo) (*inputParsed, error) {
|
||||||
}, nil
|
}, 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)
|
torrentInfo, err := extractTorrentInfo(input.TorrentPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -201,7 +201,7 @@ type trackerResponse struct {
|
||||||
leechers int
|
leechers int
|
||||||
}
|
}
|
||||||
|
|
||||||
type TorrentClient interface {
|
type TorrentClientEmulation interface {
|
||||||
PeerID() string
|
PeerID() string
|
||||||
Key() string
|
Key() string
|
||||||
Query() string
|
Query() string
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue