package main import ( "flag" "fmt" "log" "os" "github.com/ap-pauloafonso/ratio-spoof/internal/input" "github.com/ap-pauloafonso/ratio-spoof/internal/printer" "github.com/ap-pauloafonso/ratio-spoof/internal/ratiospoof" ) func main() { //required torrentPath := flag.String("t", "", "torrent path") initialDownload := flag.String("d", "", "a INITIAL_DOWNLOADED") downloadSpeed := flag.String("ds", "", "a DOWNLOAD_SPEED") initialUpload := flag.String("u", "", "a INITIAL_UPLOADED") uploadSpeed := flag.String("us", "", "a UPLOAD_SPEED") //optional port := flag.Int("p", 8999, "a PORT") debug := flag.Bool("debug", false, "") client := flag.String("c", "qbit-4.0.3", "emulated client") flag.Usage = func() { fmt.Printf("usage: %s -t -d -ds -u -us \n", os.Args[0]) fmt.Print(` optional arguments: -h show this help message and exit -p [PORT] change the port number, default: 8999 -c [CLIENT_CODE] change the client emulation, default: qbit-4.0.3 required arguments: -t -d -ds -u -us and must be in %, b, kb, mb, gb, tb and must be in kbps, mbps [CLIENT_CODE] options: qbit-4.0.3, qbit-4.3.3 `) } flag.Parse() if *torrentPath == "" || *initialDownload == "" || *downloadSpeed == "" || *initialUpload == "" || *uploadSpeed == "" { flag.Usage() return } r, err := ratiospoof.NewRatioSpoofState( input.InputArgs{ TorrentPath: *torrentPath, InitialDownloaded: *initialDownload, DownloadSpeed: *downloadSpeed, InitialUploaded: *initialUpload, UploadSpeed: *uploadSpeed, Port: *port, Debug: *debug, Client: *client, }) if err != nil { log.Fatalln(err) } go printer.PrintState(r) r.Run() }