mirror of
https://github.com/ap-pauloafonso/ratio-spoof.git
synced 2026-01-11 20:10:22 +00:00
fix typo
This commit is contained in:
parent
2ad448ccc8
commit
2a6293e699
7 changed files with 13 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
|||
package beencode
|
||||
package bencode
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -25,7 +25,7 @@ const (
|
|||
torrentDictOffsetsKey = "byte_offsets"
|
||||
)
|
||||
|
||||
// TorrentInfo contains all relevant information extracted from a beencode file
|
||||
// TorrentInfo contains all relevant information extracted from a bencode file
|
||||
type TorrentInfo struct {
|
||||
Name string
|
||||
PieceSize int
|
||||
|
|
@ -44,7 +44,7 @@ type torrentDict struct {
|
|||
resultMap map[string]interface{}
|
||||
}
|
||||
|
||||
//TorrentDictParse decodes the beencoded bytes and builds the torrentInfo file
|
||||
//TorrentDictParse decodes the bencoded bytes and builds the torrentInfo file
|
||||
func TorrentDictParse(dat []byte) (*TorrentInfo, error) {
|
||||
dict, _ := mapParse(0, &dat)
|
||||
torrentMap := torrentDict{resultMap: dict}
|
||||
|
|
@ -133,7 +133,7 @@ func findParse(currentIdx int, data *[]byte) (result interface{}, nextIdx int) {
|
|||
case token >= byte('0') || token <= byte('9'):
|
||||
return stringParse(currentIdx, data)
|
||||
default:
|
||||
panic("Error decoding beencode")
|
||||
panic("Error decoding bencode")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package beencode
|
||||
package bencode
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
|
@ -17,7 +17,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/ap-pauloafonso/ratio-spoof/beencode"
|
||||
"github.com/ap-pauloafonso/ratio-spoof/bencode"
|
||||
"github.com/gammazero/deque"
|
||||
)
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ var validSpeedSufixes = [...]string{"kbps", "mbps"}
|
|||
type ratioSpoofState struct {
|
||||
mutex *sync.Mutex
|
||||
httpClient HttpClient
|
||||
torrentInfo *beencode.TorrentInfo
|
||||
torrentInfo *bencode.TorrentInfo
|
||||
input *inputParsed
|
||||
trackerState *httpTracker
|
||||
bitTorrentClient TorrentClientEmulation
|
||||
|
|
@ -51,7 +51,7 @@ type httpTracker struct {
|
|||
urls []string
|
||||
}
|
||||
|
||||
func newHttpTracker(torrentInfo *beencode.TorrentInfo) (*httpTracker, error) {
|
||||
func newHttpTracker(torrentInfo *bencode.TorrentInfo) (*httpTracker, error) {
|
||||
|
||||
var result []string
|
||||
for _, url := range torrentInfo.TrackerInfo.Urls {
|
||||
|
|
@ -91,7 +91,7 @@ type inputParsed struct {
|
|||
debug bool
|
||||
}
|
||||
|
||||
func (I *InputArgs) parseInput(torrentInfo *beencode.TorrentInfo) (*inputParsed, error) {
|
||||
func (I *InputArgs) parseInput(torrentInfo *bencode.TorrentInfo) (*inputParsed, error) {
|
||||
downloaded, err := extractInputInitialByteCount(I.InitialDownloaded, torrentInfo.TotalSize, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -129,7 +129,7 @@ func NewRatioSPoofState(input InputArgs, torrentClient TorrentClientEmulation, h
|
|||
return nil, err
|
||||
}
|
||||
|
||||
torrentInfo, err := beencode.TorrentDictParse(dat)
|
||||
torrentInfo, err := bencode.TorrentDictParse(dat)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -389,7 +389,7 @@ func (R *ratioSpoofState) tryMakeRequest(query string) *trackerResponse {
|
|||
gzipReader.Close()
|
||||
}
|
||||
R.lastTackerResponse = string(bytesR)
|
||||
decodedResp := beencode.Decode(bytesR)
|
||||
decodedResp := bencode.Decode(bytesR)
|
||||
if idx != 0 {
|
||||
R.trackerState.SwapFirst(idx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func TestClculateNextTotalSizeByte(T *testing.T) {
|
|||
// func TestUrlEncodeInfoHash(T *testing.T) {
|
||||
|
||||
// b, _ := ioutil.ReadFile("")
|
||||
// got := extractInfoHashURLEncoded(b, beencode.Decode(b))
|
||||
// got := extractInfoHashURLEncoded(b, bencode.Decode(b))
|
||||
// want := "%60N%7d%1f%8b%3a%9bT%d5%fc%ad%d1%27%ab5%02%1c%fb%03%b0"
|
||||
// assertAreEqual(T, got, want)
|
||||
// }
|
||||
|
|
@ -59,7 +59,7 @@ func TestClculateNextTotalSizeByte(T *testing.T) {
|
|||
// func TestUrlEncodeInfoHash2(T *testing.T) {
|
||||
|
||||
// b, _ := ioutil.ReadFile("")
|
||||
// got := extractInfoHashURLEncoded(b, beencode.Decode(b))
|
||||
// got := extractInfoHashURLEncoded(b, bencode.Decode(b))
|
||||
// want := "%02r%fd%fe%bf%fbt%d0%0f%cf%d9%8c%e0%a9%97%f8%08%9b%00%b2"
|
||||
// assertAreEqual(T, got, want)
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in a new issue