More torrent subsystem upgrades

This commit is contained in:
idk
2022-03-23 00:57:20 -04:00
parent 589f8258b6
commit e6a46e80db
3 changed files with 17 additions and 7 deletions

View File

@ -585,6 +585,7 @@ func (t *TBDownloader) BotherToDownload(dl, name string) bool {
//if lenString != lenSize {
// return true
//} else {
fmt.Printf("BotherToDownload(): %s is fully downloaded\n", name)
return false
//}
}

View File

@ -133,7 +133,7 @@ func FindSnarkDirectory() (string, error) {
if SNARK_CONFIG != "" {
checkfori2pcustom := filepath.Join(SNARK_CONFIG)
if FileExists(checkfori2pcustom) {
log.Println("Found snark directory at $SNARK_CONFIG", checkfori2pcustom)
//log.Println("Found snark directory at $SNARK_CONFIG", checkfori2pcustom)
return checkfori2pcustom, nil
}
}
@ -142,7 +142,7 @@ func FindSnarkDirectory() (string, error) {
if I2P_CONFIG != "" {
checkfori2pcustom := filepath.Join(I2P_CONFIG, "i2psnark")
if FileExists(checkfori2pcustom) {
log.Println("Found snark directory at $I2P_CONFIG", checkfori2pcustom)
//log.Println("Found snark directory at $I2P_CONFIG", checkfori2pcustom)
return checkfori2pcustom, nil
}
}
@ -151,7 +151,7 @@ func FindSnarkDirectory() (string, error) {
if I2P != "" {
checkfori2p := filepath.Join(I2P, "i2psnark")
if FileExists(checkfori2p) {
log.Println("Found snark directory at $I2P", checkfori2p)
//log.Println("Found snark directory at $I2P", checkfori2p)
return checkfori2p, nil
}
}
@ -164,23 +164,23 @@ func FindSnarkDirectory() (string, error) {
case "windows":
checkfori2plocal := filepath.Join(home, "AppData", "Local", "i2p", "i2psnark")
if FileExists(checkfori2plocal) {
log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark")
//log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark")
return checkfori2plocal, nil
}
checkfori2proaming := filepath.Join(home, "AppData", "Roaming", "i2p", "i2psnark")
if FileExists(checkfori2proaming) {
log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark")
//log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark")
return checkfori2proaming, nil
}
case "linux":
checkfori2phome := filepath.Join(home, ".i2p", "i2psnark")
if FileExists(checkfori2phome) {
log.Println("Found snark directory at $HOME/.i2p/i2psnark", "$HOME/.i2p/i2psnark")
//log.Println("Found snark directory at $HOME/.i2p/i2psnark", "$HOME/.i2p/i2psnark")
return checkfori2phome, nil
}
checkfori2pservice := filepath.Join("/var/lib/i2p/i2p-config", "i2psnark")
if FileExists(checkfori2pservice) {
log.Println("Found snark directory at /var/lib/i2p/i2p-config/i2psnark", checkfori2pservice)
//log.Println("Found snark directory at /var/lib/i2p/i2p-config/i2psnark", checkfori2pservice)
return checkfori2pservice, nil
}
case "darwin":

View File

@ -98,6 +98,7 @@ var (
notor = flag.Bool("notor", false, "Do not automatically start Tor")
nounpack = flag.Bool("nounpack", false, "Do not unpack the Tor Browser")
ptop = flag.Bool("p2p", tbget.TorrentDownloaded(theLang, OS()+ARCH()), "Use bittorrent over I2P to download the initial copy of Tor Browser")
torversion = flag.Bool("torversion", false, "Print the version of Tor Browser that will be downloaded and exit")
)
func Clearnet() bool {
@ -195,6 +196,14 @@ func main() {
fmt.Printf("\n")
}
flag.Parse()
if *torversion {
torbrowserversion, err := tbget.GetTorBrowserVersionFromUpdateURL()
if err != nil {
log.Panicln(err)
}
fmt.Println(torbrowserversion)
os.Exit(0)
}
if *ptop {
log.Println("Using p2p")
*mirror = "http://localhost:7657/i2psnark/"