fix flag parsing, usage generation
This commit is contained in:
16
Makefile
16
Makefile
@ -311,18 +311,6 @@ tor-browser/unpack/i2p.firefox:
|
|||||||
tor-browser/unpack/i2p.firefox.config:
|
tor-browser/unpack/i2p.firefox.config:
|
||||||
@echo "TODO"
|
@echo "TODO"
|
||||||
|
|
||||||
#refresh-tor-keys: clean-tor-keys tor-browser/TPO-signing-key.pub
|
|
||||||
|
|
||||||
#tor-keys: tor-browser/TPO-signing-key.pub
|
|
||||||
|
|
||||||
#clean-tor-keys:
|
|
||||||
# rm -f tor-browser/TPO-signing-key.pub
|
|
||||||
|
|
||||||
#tor-browser/TPO-signing-key.pub:
|
|
||||||
# gpg --armor --output ./tor-browser/TPO-signing-key.pub --export
|
|
||||||
# 0xEF6E286DDA85EA2A4BA7DE684E2C6E8793298290
|
|
||||||
# gpg --show-key ./tor-browser/TPO-signing-key.pub
|
|
||||||
|
|
||||||
deb: clean
|
deb: clean
|
||||||
./changelog.sh
|
./changelog.sh
|
||||||
rm ../i2p.plugins.tor-manager_$(VERSION).orig.tar.gz -f
|
rm ../i2p.plugins.tor-manager_$(VERSION).orig.tar.gz -f
|
||||||
@ -353,7 +341,7 @@ debsrc: clean
|
|||||||
DATE=`date +%Y/%m/%d`
|
DATE=`date +%Y/%m/%d`
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
TOR_MANAGER_CLEARNET_MIRROR=true TOR_MANAGER_REQUIRE_PASSWORD=false ./i2p.plugins.tor-manager --ptop=false --help
|
TOR_MANAGER_CLEARNET_MIRROR=true TOR_MANAGER_REQUIRE_PASSWORD=false ./i2p.plugins.tor-manager --p2p=false --help=true
|
||||||
|
|
||||||
usagemd:
|
usagemd:
|
||||||
@echo "Tor(And sometimes Firefox) Manager for I2P" | tee USAGE.md
|
@echo "Tor(And sometimes Firefox) Manager for I2P" | tee USAGE.md
|
||||||
@ -364,7 +352,7 @@ usagemd:
|
|||||||
@echo "### Options:" | tee -a USAGE.md
|
@echo "### Options:" | tee -a USAGE.md
|
||||||
@echo "" | tee -a USAGE.md
|
@echo "" | tee -a USAGE.md
|
||||||
@echo '```sh' | tee -a USAGE.md
|
@echo '```sh' | tee -a USAGE.md
|
||||||
TOR_MANAGER_CLEARNET_MIRROR=true TOR_MANAGER_REQUIRE_PASSWORD=false ./i2p.plugins.tor-manager --help 2>&1 | grep -v $(DATE) | grep -v $(HOME) | tee -a USAGE.md
|
TOR_MANAGER_CLEARNET_MIRROR=true TOR_MANAGER_REQUIRE_PASSWORD=false ./i2p.plugins.tor-manager --p2p=false --help=true 2>&1 | grep -v $(DATE) | grep -v $(HOME) | tee -a USAGE.md
|
||||||
@echo '```' | tee -a USAGE.md
|
@echo '```' | tee -a USAGE.md
|
||||||
@echo "" | tee -a USAGE.md
|
@echo "" | tee -a USAGE.md
|
||||||
|
|
||||||
|
185
USAGE.md
185
USAGE.md
@ -1,12 +1,6 @@
|
|||||||
Tor(And sometimes Firefox) Manager for I2P
|
TorrentDownloaded: Torrent Download complete: tor-browser-linux64-11.5_en-US.tar.xz 110909932 110909932 9 9
|
||||||
===========================================
|
UnpackSite: /home/idk/go/src/i2pgit.org/idk/i2p.plugins.tor-manager/tmp-i2pbrowser/tor-browser/www
|
||||||
|
comparing sizes: 1109 1109
|
||||||
## Usage: i2p.plugins.tor-manager [options]
|
|
||||||
|
|
||||||
### Options:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
Using clearnet mirror
|
|
||||||
Usage: i2p.plugins.tor-manager [options]
|
Usage: i2p.plugins.tor-manager [options]
|
||||||
|
|
||||||
Downloads, verifies and unpacks Tor Browser. Manages the Tor Browser
|
Downloads, verifies and unpacks Tor Browser. Manages the Tor Browser
|
||||||
@ -15,120 +9,88 @@ Tor process and downloads updates when Tor is not available.
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
Usage of ./i2p.plugins.tor-manager:
|
--apparmor Generate apparmor rules
|
||||||
-apparmor
|
--arch string OS/arch to download (default "64")
|
||||||
Generate apparmor rules
|
--bemirror Act as an in-I2P mirror when you're done downloading
|
||||||
-arch string
|
--chat Open a WebChat client
|
||||||
OS/arch to download (default "64")
|
--clearnet Use clearnet (no Tor or I2P) in Tor Browser
|
||||||
-bemirror
|
--destruct Destructively delete the working directory when finished
|
||||||
Act as an in-I2P mirror when you're done downloading
|
--directory string Directory operate in (default "tmp-i2pbrowser")
|
||||||
-chat
|
--help Print help and quit
|
||||||
Open a WebChat client
|
--host string Host to serve on (default "127.0.0.1")
|
||||||
-clearnet
|
--i2pbrowser Open I2P in Tor Browser
|
||||||
Use clearnet (no Tor or I2P) in Tor Browser
|
--i2pconfig Open I2P routerconsole in Tor Browser with javscript enabled and non-routerconsole sites disabled
|
||||||
-destruct
|
--i2peditor Open I2P Site Editor in Tor Browser
|
||||||
Destructively delete the working directory when finished
|
--lang string Language to download (default "en-US")
|
||||||
-directory string
|
--license Print the license and exit
|
||||||
Directory operate in (default "tmp-i2pbrowser")
|
--mirror string Mirror to use. I2P will be used if an I2P proxy is present, if system Tor is available, it will be downloaded over the Tor proxy. (default "https://dist.torproject.org/torbrowser/")
|
||||||
-help
|
--mirrorall Download and mirror every language and OS/arch combination
|
||||||
Print help and quit
|
--nevertor Never use Tor for downloading Tor Browser
|
||||||
-host string
|
--notor Do not automatically start Tor
|
||||||
Host to serve on (default "127.0.0.1")
|
--nounpack Do not unpack the Tor Browser
|
||||||
-i2pbrowser
|
--offline Work offline. Differs from Firefox's offline mode in that cannot be disabled until the browser is closed.
|
||||||
Open I2P in Tor Browser
|
--onion Serve an onion site which shows some I2P propaganda (default true)
|
||||||
-i2pconfig
|
--os string OS/arch to download (default "linux")
|
||||||
Open I2P routerconsole in Tor Browser with javscript enabled and non-routerconsole sites disabled
|
--p2p Use bittorrent over I2P to download the initial copy of Tor Browser (default true)
|
||||||
-lang string
|
--password string Password to encrypt the working directory with. Implies -destruct, only the encrypted container will be saved.
|
||||||
Language to download
|
--port int Port to serve on (default 7695)
|
||||||
-mirror string
|
--profile string use a custom profile path, normally blank
|
||||||
Mirror to use. I2P will be used if an I2P proxy is present, if system Tor is available, it will be downloaded over the Tor proxy. (default "https://dist.torproject.org/torbrowser/")
|
--shortcuts Create desktop shortcuts
|
||||||
-notor
|
--snowflake Offer a Snowflake to other Tor Browser users
|
||||||
Do not automatically start Tor
|
--snowflake-broker string broker URL (default "https://snowflake-broker.torproject.net/")
|
||||||
-nounpack
|
--snowflake-capacity uint maximum concurrent clients
|
||||||
Do not unpack the Tor Browser
|
--snowflake-directory string directory with a page to serve locally for your snowflake. If empty, no local page is served.
|
||||||
-offline
|
--snowflake-keep-local-addresses keep local LAN address ICE candidates
|
||||||
Work offline. Differs from Firefox's offline mode in that cannot be disabled until the browser is closed.
|
--snowflake-log string log filename
|
||||||
-onion
|
--snowflake-port string port to serve info page(directory) on (default "7676")
|
||||||
Serve an onion site which shows some I2P propaganda
|
--snowflake-relay string websocket relay URL (default "wss://snowflake.bamsoftware.com/")
|
||||||
-os string
|
--snowflake-stun string broker URL (default "stun:stun.stunprotocol.org:3478")
|
||||||
OS/arch to download (default "linux")
|
--snowflake-unsafe-logging prevent logs from being scrubbed
|
||||||
-p2p
|
--systray Create a systray icon
|
||||||
Use bittorrent over I2P to download the initial copy of Tor Browser (default true)
|
--torbrowser Open Tor Browser
|
||||||
-password string
|
--torrent Create a torrent of the downloaded files and seed it over I2P using an Open Tracker (default true)
|
||||||
Password to encrypt the working directory with. Implies -destruct, only the encrypted container will be saved.
|
--torversion Print the version of Tor Browser that will be downloaded and exit
|
||||||
-port int
|
--verbose Verbose output
|
||||||
Port to serve on (default 7695)
|
--watch-profiles string Monitor and control these Firefox profiles. Temporarily Unused.
|
||||||
-profile string
|
|
||||||
use a custom profile path, normally blank
|
|
||||||
-shortcuts
|
|
||||||
Create desktop shortcuts
|
|
||||||
-snowflake
|
|
||||||
Offer a Snowflake to other Tor Browser users
|
|
||||||
-snowflake-broker string
|
|
||||||
broker URL (default "https://snowflake-broker.torproject.net/")
|
|
||||||
-snowflake-capacity uint
|
|
||||||
maximum concurrent clients
|
|
||||||
-snowflake-directory string
|
|
||||||
directory with a page to serve locally for your snowflake. If empty, no local page is served.
|
|
||||||
-snowflake-keep-local-addresses
|
|
||||||
keep local LAN address ICE candidates
|
|
||||||
-snowflake-log string
|
|
||||||
log filename
|
|
||||||
-snowflake-port string
|
|
||||||
port to serve info page(directory) on (default "7676")
|
|
||||||
-snowflake-relay string
|
|
||||||
websocket relay URL (default "wss://snowflake.bamsoftware.com/")
|
|
||||||
-snowflake-stun string
|
|
||||||
broker URL (default "stun:stun.stunprotocol.org:3478")
|
|
||||||
-snowflake-unsafe-logging
|
|
||||||
prevent logs from being scrubbed
|
|
||||||
-torbrowser
|
|
||||||
Open Tor Browser
|
|
||||||
-torrent
|
|
||||||
Create a torrent of the downloaded files and seed it over I2P using an Open Tracker (default true)
|
|
||||||
-verbose
|
|
||||||
Verbose output
|
|
||||||
-watch-profiles string
|
|
||||||
Monitor and control these Firefox profiles. Temporarily Unused.
|
|
||||||
|
|
||||||
Available Languages:
|
Available Languages:
|
||||||
|
|
||||||
- ar
|
- cs
|
||||||
- my
|
- en-US
|
||||||
|
- id
|
||||||
- nl
|
- nl
|
||||||
- ro
|
- ro
|
||||||
- tr
|
- zh-TW
|
||||||
|
- ar
|
||||||
|
- de
|
||||||
|
- es-AR
|
||||||
- it
|
- it
|
||||||
- ms
|
- ka
|
||||||
- pt-BR
|
- nb-NO
|
||||||
- da
|
- zh-CN
|
||||||
- es-ES
|
|
||||||
- fa
|
- fa
|
||||||
- is
|
- is
|
||||||
- ja
|
|
||||||
- nb-NO
|
|
||||||
- lt
|
- lt
|
||||||
- ka
|
|
||||||
- ko
|
|
||||||
- pl
|
|
||||||
- vi
|
|
||||||
- zh-TW
|
|
||||||
- ca
|
|
||||||
- fr
|
- fr
|
||||||
- id
|
|
||||||
- mk
|
|
||||||
- zh-CN
|
|
||||||
- cs
|
|
||||||
- de
|
|
||||||
- el
|
|
||||||
- en-US
|
|
||||||
- th
|
|
||||||
- es-AR
|
|
||||||
- ga-IE
|
|
||||||
- he
|
- he
|
||||||
- hu
|
- ko
|
||||||
|
- vi
|
||||||
|
- ca
|
||||||
|
- el
|
||||||
|
- es-ES
|
||||||
|
- mk
|
||||||
|
- ms
|
||||||
|
- pt-BR
|
||||||
|
- th
|
||||||
|
- ga-IE
|
||||||
|
- my
|
||||||
|
- pl
|
||||||
- ru
|
- ru
|
||||||
|
- da
|
||||||
- sv-SE
|
- sv-SE
|
||||||
|
- tr
|
||||||
|
- hu
|
||||||
|
- ja
|
||||||
|
|
||||||
Usage: ./firefox.real [ options ... ] [URL]
|
Usage: ./firefox.real [ options ... ] [URL]
|
||||||
where options include:
|
where options include:
|
||||||
@ -169,6 +131,7 @@ Firefox options
|
|||||||
--setDefaultBrowser Set this app as the default browser.
|
--setDefaultBrowser Set this app as the default browser.
|
||||||
--first-startup Run post-install actions before opening a new window.
|
--first-startup Run post-install actions before opening a new window.
|
||||||
--kiosk Start the browser in kiosk mode.
|
--kiosk Start the browser in kiosk mode.
|
||||||
|
--disable-pinch Disable touch-screen and touch-pad pinch gestures.
|
||||||
--jsconsole Open the Browser Console.
|
--jsconsole Open the Browser Console.
|
||||||
--jsdebugger [<path>] Open the Browser Toolbox. Defaults to the local build
|
--jsdebugger [<path>] Open the Browser Toolbox. Defaults to the local build
|
||||||
but can be overridden by a firefox path.
|
but can be overridden by a firefox path.
|
||||||
@ -191,5 +154,3 @@ Tor Browser Script Options
|
|||||||
--detach Detach from terminal and run Tor Browser in the background.
|
--detach Detach from terminal and run Tor Browser in the background.
|
||||||
--register-app Register Tor Browser as a desktop app for this user
|
--register-app Register Tor Browser as a desktop app for this user
|
||||||
--unregister-app Unregister Tor Browser as a desktop app for this user
|
--unregister-app Unregister Tor Browser as a desktop app for this user
|
||||||
```
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
func CleanupArgs() (args []string, trailers []string) {
|
func CleanupArgs() (args []string, trailers []string) {
|
||||||
// get a list of all possible flags from the flag package
|
// get a list of all possible flags from the flag package
|
||||||
|
args = []string{os.Args[0]}
|
||||||
for i, arg := range os.Args[1:] {
|
for i, arg := range os.Args[1:] {
|
||||||
log.Printf("arg %d: %s", i, arg)
|
log.Printf("arg %d: %s", i, arg)
|
||||||
trailer := true
|
trailer := true
|
||||||
|
12
get/get.go
12
get/get.go
@ -350,8 +350,8 @@ func (wc *WriteCounter) Write(p []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wc WriteCounter) PrintProgress() {
|
func (wc WriteCounter) PrintProgress() {
|
||||||
fmt.Printf("\r%s", strings.Repeat(" ", 35))
|
fmt.Fprintf(os.Stderr, "\r%s", strings.Repeat(" ", 35))
|
||||||
fmt.Printf("\rDownloading... %s complete", humanize.Bytes(wc.Total))
|
fmt.Fprintf(os.Stderr, "\rDownloading... %s complete", humanize.Bytes(wc.Total))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TBDownloader) StartConf() *tor.StartConf {
|
func (t *TBDownloader) StartConf() *tor.StartConf {
|
||||||
@ -609,13 +609,13 @@ func (t *TBDownloader) BotherToDownload(dl, name string) bool {
|
|||||||
}
|
}
|
||||||
lenString := strconv.Itoa(int(contentLength))[:l]
|
lenString := strconv.Itoa(int(contentLength))[:l]
|
||||||
lenSize := strconv.Itoa(int(stat.Size()))[:l]
|
lenSize := strconv.Itoa(int(stat.Size()))[:l]
|
||||||
fmt.Println("comparing sizes:", lenString, lenSize)
|
fmt.Fprintf(os.Stderr, "comparing sizes: %v %v", lenString, lenSize)
|
||||||
|
|
||||||
if stat.Size() == contentLength {
|
if stat.Size() == contentLength {
|
||||||
//if lenString != lenSize {
|
//if lenString != lenSize {
|
||||||
// return true
|
// return true
|
||||||
//} else {
|
//} else {
|
||||||
fmt.Printf("BotherToDownload(): %s is fully downloaded\n", name)
|
fmt.Fprintf(os.Stderr, "BotherToDownload(): %s is fully downloaded\n", name)
|
||||||
return false
|
return false
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ func (t *TBDownloader) UnpackUpdater(binpath string) (string, error) {
|
|||||||
}
|
}
|
||||||
return t.BrowserDir(), nil
|
return t.BrowserDir(), nil
|
||||||
}
|
}
|
||||||
fmt.Printf("Unpacking %s %s\n", binpath, t.UnpackPath)
|
fmt.Fprintf(os.Stderr, "Unpacking %s %s\n", binpath, t.UnpackPath)
|
||||||
os.MkdirAll(t.UnpackPath, 0755)
|
os.MkdirAll(t.UnpackPath, 0755)
|
||||||
UNPACK_DIRECTORY, err := os.Open(t.UnpackPath)
|
UNPACK_DIRECTORY, err := os.Open(t.UnpackPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -834,7 +834,7 @@ func (t *TBDownloader) UnpackUpdater(binpath string) (string, error) {
|
|||||||
//remember to chmod the file afterwards
|
//remember to chmod the file afterwards
|
||||||
file.Chmod(mode)
|
file.Chmod(mode)
|
||||||
if t.Verbose {
|
if t.Verbose {
|
||||||
fmt.Printf("Unpacked %s\n", header.Name)
|
fmt.Fprintf(os.Stderr, "Unpacked %s\n", header.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !FileExists(t.I2PBrowserDir()) {
|
if !FileExists(t.I2PBrowserDir()) {
|
||||||
|
@ -292,11 +292,11 @@ func TorrentDownloaded(ietf, rtpair string) bool {
|
|||||||
if info.Size() == int64(cmpsize) {
|
if info.Size() == int64(cmpsize) {
|
||||||
sizeString := fmt.Sprintf("%d", info.Size())
|
sizeString := fmt.Sprintf("%d", info.Size())
|
||||||
cmpString := fmt.Sprintf("%d", cmpsize)
|
cmpString := fmt.Sprintf("%d", cmpsize)
|
||||||
fmt.Println("TorrentDownloaded: Torrent Download complete:", path, info.Size(), int64(cmpsize), len(sizeString), len(cmpString))
|
fmt.Fprintf(os.Stderr, "TorrentDownloaded: Torrent Download complete:", path, info.Size(), int64(cmpsize), len(sizeString), len(cmpString))
|
||||||
found = true
|
found = true
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("TorrentDownloaded: Torrent Download incomplete:", path, info.Size(), int64(cmpsize))
|
fmt.Fprintf(os.Stderr, "TorrentDownloaded: Torrent Download incomplete:", path, info.Size(), int64(cmpsize))
|
||||||
return fmt.Errorf("TorrentDownloaded: Torrent Download found but size is too small: %s", path)
|
return fmt.Errorf("TorrentDownloaded: Torrent Download found but size is too small: %s", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
48
main.go
48
main.go
@ -57,7 +57,7 @@ func LICENSE() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
fmt.Println(string(license_bytes))
|
fmt.Fprintf(os.Stderr, string(license_bytes))
|
||||||
I2P.PrintLicenses()
|
I2P.PrintLicenses()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
@ -190,36 +190,36 @@ func Password() string {
|
|||||||
|
|
||||||
func Mirror() string {
|
func Mirror() string {
|
||||||
if mir := os.Getenv("TOR_MANAGER_MIRROR"); mir != "" {
|
if mir := os.Getenv("TOR_MANAGER_MIRROR"); mir != "" {
|
||||||
fmt.Println("Using environment mirror", mir)
|
fmt.Fprintf(os.Stderr, "Using environment mirror %s", mir)
|
||||||
return mir
|
return mir
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
|
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
|
||||||
fmt.Println("Using arm64 mirror")
|
fmt.Fprintf(os.Stderr, "Using arm64 mirror")
|
||||||
return "https://sourceforge.net/projects/tor-browser-ports/files"
|
return "https://sourceforge.net/projects/tor-browser-ports/files"
|
||||||
}
|
}
|
||||||
clear := os.Getenv("TOR_MANAGER_CLEARNET")
|
clear := os.Getenv("TOR_MANAGER_CLEARNET")
|
||||||
switch clear {
|
switch clear {
|
||||||
case "1", "true", "yes", "on":
|
case "1", "true", "yes", "on":
|
||||||
fmt.Println("Using clearnet mirror")
|
fmt.Fprintf(os.Stderr, "Using clearnet mirror")
|
||||||
return "https://dist.torproject.org/torbrowser/"
|
return "https://dist.torproject.org/torbrowser/"
|
||||||
}
|
}
|
||||||
clearmirror := os.Getenv("TOR_MANAGER_CLEARNET_MIRROR")
|
clearmirror := os.Getenv("TOR_MANAGER_CLEARNET_MIRROR")
|
||||||
switch clearmirror {
|
switch clearmirror {
|
||||||
case "1", "true", "yes", "on":
|
case "1", "true", "yes", "on":
|
||||||
fmt.Println("Using clearnet mirror")
|
fmt.Fprintf(os.Stderr, "Using clearnet mirror")
|
||||||
return "https://dist.torproject.org/torbrowser/"
|
return "https://dist.torproject.org/torbrowser/"
|
||||||
}
|
}
|
||||||
if tbget.Torrent(*lang, OS()+ARCH()) {
|
if tbget.Torrent(*lang, OS()+ARCH()) {
|
||||||
fmt.Println("Using torrent mirror")
|
fmt.Fprintf(os.Stderr, "Using torrent mirror")
|
||||||
return "http://localhost:7657/i2psnark/"
|
return "http://localhost:7657/i2psnark/"
|
||||||
}
|
}
|
||||||
if tbget.TestHTTPDefaultProxy() {
|
if tbget.TestHTTPDefaultProxy() {
|
||||||
//fmt.Println("Using I2P mirror")
|
//fmt.Fprintf(os.Stderr,"Using I2P mirror")
|
||||||
//return "http://dist.torproject.i2p/torbrowser/"
|
//return "http://dist.torproject.i2p/torbrowser/"
|
||||||
fmt.Println("Using clearnet mirror instead of I2P mirror due to hash sum mismatch issue")
|
fmt.Fprintf(os.Stderr, "Using clearnet mirror instead of I2P mirror due to hash sum mismatch issue")
|
||||||
return "https://dist.torproject.org/torbrowser/"
|
return "https://dist.torproject.org/torbrowser/"
|
||||||
}
|
}
|
||||||
fmt.Println("Using clearnet mirror")
|
fmt.Fprintf(os.Stderr, "Using clearnet mirror")
|
||||||
return "https://dist.torproject.org/torbrowser/"
|
return "https://dist.torproject.org/torbrowser/"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,20 +241,24 @@ func main() {
|
|||||||
SnowflakeFlag()
|
SnowflakeFlag()
|
||||||
usage := flag.Usage
|
usage := flag.Usage
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Printf("Usage: %s %s\n", filename, "[options]")
|
fmt.Fprintf(os.Stdout, "Usage: %s %s\n", filename, "[options]")
|
||||||
fmt.Printf("\n")
|
fmt.Fprintf(os.Stdout, "\n")
|
||||||
fmt.Printf("Downloads, verifies and unpacks Tor Browser. Manages the Tor Browser\n")
|
fmt.Fprintf(os.Stdout, "Downloads, verifies and unpacks Tor Browser. Manages the Tor Browser\n")
|
||||||
fmt.Printf("system in environments where Tor is not in use. Monitors a long-running\n")
|
fmt.Fprintf(os.Stdout, "system in environments where Tor is not in use. Monitors a long-running\n")
|
||||||
fmt.Printf("Tor process and downloads updates when Tor is not available.\n")
|
fmt.Fprintf(os.Stdout, "Tor process and downloads updates when Tor is not available.\n")
|
||||||
fmt.Printf("\n")
|
fmt.Fprintf(os.Stdout, "\n")
|
||||||
fmt.Printf("Options:\n")
|
fmt.Fprintf(os.Stdout, "Options:\n")
|
||||||
fmt.Printf("\n")
|
fmt.Fprintf(os.Stdout, "\n")
|
||||||
|
// redirect stderr to stdout
|
||||||
|
flag.CommandLine.SetOutput(os.Stdout)
|
||||||
usage()
|
usage()
|
||||||
fmt.Printf("\nAvailable Languages:\n\n")
|
// redirect stderr back to stderr
|
||||||
|
flag.CommandLine.SetOutput(os.Stderr)
|
||||||
|
fmt.Fprintf(os.Stdout, "\nAvailable Languages:\n\n")
|
||||||
for _, l := range tbget.Languages() {
|
for _, l := range tbget.Languages() {
|
||||||
fmt.Printf(" - %s\n", l)
|
fmt.Fprintf(os.Stdout, " - %s\n", l)
|
||||||
}
|
}
|
||||||
fmt.Printf("\n")
|
fmt.Fprintf(os.Stdout, "\n")
|
||||||
}
|
}
|
||||||
args, trailers := CleanupArgs()
|
args, trailers := CleanupArgs()
|
||||||
log.Printf("Args: %v\n", args)
|
log.Printf("Args: %v\n", args)
|
||||||
@ -285,7 +289,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicln(err)
|
log.Panicln(err)
|
||||||
}
|
}
|
||||||
fmt.Println(torbrowserversion)
|
fmt.Fprintf(os.Stderr, torbrowserversion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if *ptop {
|
if *ptop {
|
||||||
@ -405,7 +409,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
// log.Fatalf("%s", client.TBS.PassThroughArgs)
|
// log.Fatalf("%s", client.TBS.PassThroughArgs)
|
||||||
if *help {
|
if *help {
|
||||||
|
log.Println("Usage:")
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
|
|
||||||
if err := client.TBS.RunTBHelpWithLang(); err != nil {
|
if err := client.TBS.RunTBHelpWithLang(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ func (ios *I2POnionService) ListenAndServe() error {
|
|||||||
|
|
||||||
func (ios *I2POnionService) UnpackSite() error {
|
func (ios *I2POnionService) UnpackSite() error {
|
||||||
docroot := ios.ServeDir
|
docroot := ios.ServeDir
|
||||||
fmt.Println("UnpackSite: ", docroot)
|
fmt.Fprintf(os.Stderr, "UnpackSite: %s", docroot)
|
||||||
if dir, err := os.Stat(docroot); err == nil && dir.IsDir() {
|
if dir, err := os.Stat(docroot); err == nil && dir.IsDir() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user