Compare commits
8 Commits
116.0.73.0
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
491b3d37f3 | ||
![]() |
cc8e85c89c | ||
![]() |
d7055ec1f4 | ||
![]() |
3d5c7fe9c1 | ||
![]() |
a740c15292 | ||
![]() |
d09c1e2514 | ||
![]() |
607013b805 | ||
![]() |
56a5baade0 |
58
Makefile
58
Makefile
@@ -2,15 +2,17 @@
|
||||
export GO111MODULE=on
|
||||
GO111MODULE=on
|
||||
|
||||
BIN_NAME=i2pbrowser
|
||||
|
||||
EXT_VERSION=0.73
|
||||
SNOW_VERSION=0.2.2
|
||||
UMAT_VERSION=1.25.2
|
||||
UBLO_VERSION=1.4.0
|
||||
NOSS_VERSION=11.0.23
|
||||
ZERO_VERSION=v1.16
|
||||
ZERO_VERSION=v1.17
|
||||
ZERO_VERSION_B=`echo $(ZERO_VERSION) | tr -d 'v.'`
|
||||
LAST_VERSION=$(ZERO_VERSION_B).$(EXT_VERSION).095
|
||||
LAUNCH_VERSION=$(ZERO_VERSION_B).$(EXT_VERSION).096
|
||||
LAST_VERSION=$(ZERO_VERSION_B).$(EXT_VERSION).097
|
||||
LAUNCH_VERSION=$(ZERO_VERSION_B).$(EXT_VERSION).098
|
||||
|
||||
GO_COMPILER_OPTS = -a -tags netgo -ldflags '-w -extldflags "-static"'
|
||||
|
||||
@@ -26,7 +28,7 @@ gen:
|
||||
go run $(GO_COMPILER_OPTS) -tags generate gen.go extensions.go
|
||||
|
||||
clean: fmt
|
||||
rm -f i2pfirefox*
|
||||
rm -f $(BIN_NAME)*
|
||||
|
||||
fmt:
|
||||
gofmt -w -s *.go
|
||||
@@ -49,31 +51,31 @@ all: pure variant
|
||||
pure: fmt lib/assets.go windows osx linux
|
||||
|
||||
windows: fmt
|
||||
GOOS=windows go build $(GO_COMPILER_OPTS) -o i2pfirefox.exe
|
||||
GOOS=windows go build $(GO_COMPILER_OPTS) -o $(BIN_NAME).exe
|
||||
|
||||
osx: fmt
|
||||
GOOS=darwin go build $(GO_COMPILER_OPTS) -o i2pfirefox-darwin
|
||||
GOOS=darwin go build $(GO_COMPILER_OPTS) -o $(BIN_NAME)-darwin
|
||||
|
||||
linux: fmt
|
||||
GOOS=linux go build $(GO_COMPILER_OPTS) -o i2pfirefox
|
||||
GOOS=linux go build $(GO_COMPILER_OPTS) -o $(BIN_NAME)
|
||||
|
||||
variant: fmt lib/assets.go vwindows vosx vlinux
|
||||
|
||||
vwindows: fmt
|
||||
GOOS=windows go build $(GO_COMPILER_OPTS) -tags variant -o i2pfirefox-variant.exe
|
||||
GOOS=windows go build $(GO_COMPILER_OPTS) -tags variant -o $(BIN_NAME)-variant.exe
|
||||
|
||||
vosx: fmt
|
||||
GOOS=darwin go build $(GO_COMPILER_OPTS) -tags variant -o i2pfirefox-variant-darwin
|
||||
GOOS=darwin go build $(GO_COMPILER_OPTS) -tags variant -o $(BIN_NAME)-variant-darwin
|
||||
|
||||
vlinux: fmt
|
||||
GOOS=linux go build $(GO_COMPILER_OPTS) -tags variant -o i2pfirefox-variant
|
||||
GOOS=linux go build $(GO_COMPILER_OPTS) -tags variant -o $(BIN_NAME)-variant
|
||||
|
||||
sumwindows=`sha256sum i2pfirefox.exe`
|
||||
sumlinux=`sha256sum i2pfirefox`
|
||||
sumdarwin=`sha256sum i2pfirefox-darwin`
|
||||
sumvwindows=`sha256sum i2pfirefox-variant.exe`
|
||||
sumvlinux=`sha256sum i2pfirefox-variant`
|
||||
sumvdarwin=`sha256sum i2pfirefox-variant-darwin`
|
||||
sumwindows=`sha256sum $(BIN_NAME).exe`
|
||||
sumlinux=`sha256sum $(BIN_NAME)`
|
||||
sumdarwin=`sha256sum $(BIN_NAME)-darwin`
|
||||
sumvwindows=`sha256sum $(BIN_NAME)-variant.exe`
|
||||
sumvlinux=`sha256sum $(BIN_NAME)-variant`
|
||||
sumvdarwin=`sha256sum $(BIN_NAME)-variant-darwin`
|
||||
|
||||
check:
|
||||
echo "$(sumwindows)"
|
||||
@@ -84,7 +86,7 @@ check:
|
||||
echo "$(sumvdarwin)"
|
||||
|
||||
release:
|
||||
gothub release -p -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -n "Launchers" -d "A self-configuring launcher for mixed I2P and clearnet Browsing with Firefox"
|
||||
gothub release -p -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -n "Launchers" -d "A self-configuring launcher for mixed I2P and clearnet Browsing with Firefox"
|
||||
sed -i "s|$(LAST_VERSION)|$(LAUNCH_VERSION)|g" README.md
|
||||
sed -i "s|$(LAST_VERSION)|$(LAUNCH_VERSION)|g" Makefile
|
||||
git commit -am "Make release version $(LAUNCH_VERSION)" && git push
|
||||
@@ -92,38 +94,40 @@ release:
|
||||
upload: upload-windows upload-darwin upload-linux
|
||||
|
||||
upload-windows:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumwindows)" -n "i2pfirefox.exe" -f "i2pfirefox.exe"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumwindows)" -n "$(BIN_NAME).exe" -f "$(BIN_NAME).exe"
|
||||
|
||||
upload-darwin:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumdarwin)" -n "i2pfirefox-darwin" -f "i2pfirefox-darwin"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumdarwin)" -n "$(BIN_NAME)-darwin" -f "$(BIN_NAME)-darwin"
|
||||
|
||||
upload-linux:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumlinux)" -n "i2pfirefox" -f "i2pfirefox"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumlinux)" -n "$(BIN_NAME)" -f "$(BIN_NAME)"
|
||||
|
||||
upload-variant: upload-variant-windows upload-variant-darwin upload-variant-linux
|
||||
|
||||
upload-variant-windows:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumvwindows)" -n "i2pfirefox-variant.exe" -f "i2pfirefox-variant.exe"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumvwindows)" -n "$(BIN_NAME)-variant.exe" -f "$(BIN_NAME)-variant.exe"
|
||||
|
||||
upload-variant-darwin:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumvdarwin)" -n "i2pfirefox-variant-darwin" -f "i2pfirefox-variant-darwin"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumvdarwin)" -n "$(BIN_NAME)-variant-darwin" -f "$(BIN_NAME)-variant-darwin"
|
||||
|
||||
upload-variant-linux:
|
||||
gothub upload -R -u eyedeekay -r "i2pfirefox" -t $(LAUNCH_VERSION) -l "$(sumvlinux)" -n "i2pfirefox-variant" -f "i2pfirefox-variant"
|
||||
gothub upload -R -u eyedeekay -r "$(BIN_NAME)" -t $(LAUNCH_VERSION) -l "$(sumvlinux)" -n "$(BIN_NAME)-variant" -f "$(BIN_NAME)-variant"
|
||||
|
||||
upload-all: upload upload-variant
|
||||
|
||||
release-all: release upload-all
|
||||
|
||||
release-pure:
|
||||
make pure
|
||||
make release; true
|
||||
make upload
|
||||
make linux upload-linux
|
||||
make windows upload-windows
|
||||
make osx upload-darwin
|
||||
|
||||
release-variant:
|
||||
make variant
|
||||
make release; true
|
||||
make upload-variant
|
||||
make vlinux upload-variant-linux
|
||||
make vwindows upload-variant-windows
|
||||
make vosx upload-variant-darwin
|
||||
|
||||
clean-release: clean release-pure release-variant
|
||||
|
||||
|
@@ -29,15 +29,15 @@ description.
|
||||
|
||||
```Bash
|
||||
# Linux
|
||||
wget -O i2pfirefox https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.096/i2pfirefox
|
||||
wget -O i2pfirefox https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.097/i2pfirefox
|
||||
sha256sum i2pfirefox
|
||||
|
||||
# Windows
|
||||
wget -O i2pfirefox.exe https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.096/i2pfirefox.exe
|
||||
wget -O i2pfirefox.exe https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.097/i2pfirefox.exe
|
||||
does-windows-even-have-sha25sum i2pfirefox.exe
|
||||
|
||||
# OSX
|
||||
wget -O i2pfirefox-darwin https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.096/i2pfirefox-darwin
|
||||
wget -O i2pfirefox-darwin https://github.com/eyedeekay/i2pfirefox/releases/download/116.0.73.097/i2pfirefox-darwin
|
||||
sha256sum i2pfirefox-darwin
|
||||
```
|
||||
|
||||
|
4
go.mod
4
go.mod
@@ -4,11 +4,11 @@ go 1.14
|
||||
|
||||
require (
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200702210346-bb2ed34c11fb
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200828154258-d799f84952aa
|
||||
github.com/eyedeekay/I2P-Configuration-for-Chromium v0.0.0-20200802063209-8973270c836e
|
||||
github.com/eyedeekay/go-fpw v0.0.0-20200805184710-5435dc443213
|
||||
github.com/eyedeekay/httptunnel v0.0.0-20200116022455-631ab90f707d
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822030320-56c6bd77f723
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822053838-bd4cc0b91c15
|
||||
github.com/frankban/quicktest v1.4.0 // indirect
|
||||
github.com/klauspost/compress v1.10.10 // indirect
|
||||
github.com/klauspost/pgzip v1.2.4 // indirect
|
||||
|
10
go.sum
10
go.sum
@@ -105,6 +105,12 @@ github.com/elliotchance/orderedmap v1.2.0/go.mod h1:8hdSl6jmveQw8ScByd3AaNHNk51R
|
||||
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200702210346-bb2ed34c11fb h1:tUfxSHBVabVBpX0Rcupybxr7pBfG2E+p3N7EX4p9sc0=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200702210346-bb2ed34c11fb/go.mod h1:PY7znvZ1ZF1QG5/4j9u769EX49l49z2rCdE0o4z8fMw=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200823015403-11c67f550c33 h1:VD2HttHlFt6wfTjkbJMt/M/pmQT8Iq0I7CmEG81dwVM=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200823015403-11c67f550c33/go.mod h1:kDfSkqEyzswi8r4m6U0Q9jD4PJqOzKXVCX4XbYhBJCs=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200824044622-7e8d465550e5 h1:vUDYV/R8RNo7cxVN4ftdrXa9zsGQ74Bot5E/LMndhv0=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200824044622-7e8d465550e5/go.mod h1:kDfSkqEyzswi8r4m6U0Q9jD4PJqOzKXVCX4XbYhBJCs=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200828154258-d799f84952aa h1:wqjB9kcYjAMrw92QxZnbAbdMsfF0FSPq9vsKx98XWrU=
|
||||
github.com/eyedeekay/GingerShrew v0.0.0-20200828154258-d799f84952aa/go.mod h1:kDfSkqEyzswi8r4m6U0Q9jD4PJqOzKXVCX4XbYhBJCs=
|
||||
github.com/eyedeekay/I2P-Configuration-for-Chromium v0.0.0-20200802063209-8973270c836e h1:oEoiXkil4L/ahtVlljDwz5LXbE1qBsJqvC3/utNrKe4=
|
||||
github.com/eyedeekay/I2P-Configuration-for-Chromium v0.0.0-20200802063209-8973270c836e/go.mod h1:XchhjbeZKhEszN64SHavfaLGP2lFhWeO0ipH4cyBq5o=
|
||||
github.com/eyedeekay/checki2cp v0.0.15 h1:Vlwp9opuQJSgp139VVrLkKXRwLYYrXiBkqed35ZbqzY=
|
||||
@@ -146,6 +152,10 @@ github.com/eyedeekay/zerobundle v0.0.0-20200821145537-e36dff8c7dfc h1:XWYtE6oKCk
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200821145537-e36dff8c7dfc/go.mod h1:J4pHO/M5C5c5kD2nwCHuJc06i0mkOjSwIurnj7fVIPY=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822030320-56c6bd77f723 h1:WTWh03+SJxAlJtfNDXgMDwmu7yalSQcX/26EExGNCWo=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822030320-56c6bd77f723/go.mod h1:J4pHO/M5C5c5kD2nwCHuJc06i0mkOjSwIurnj7fVIPY=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822042922-d7ea80e6232b h1:8sLM7g5XwaWbcTM7CYqHCU7JGRiYSEmtVGpxUtgQ4qI=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822042922-d7ea80e6232b/go.mod h1:J4pHO/M5C5c5kD2nwCHuJc06i0mkOjSwIurnj7fVIPY=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822053838-bd4cc0b91c15 h1:o8btYu9FRR5xBnsRvpoX28ii4emNbLPZ5mx1+LUL37k=
|
||||
github.com/eyedeekay/zerobundle v0.0.0-20200822053838-bd4cc0b91c15/go.mod h1:J4pHO/M5C5c5kD2nwCHuJc06i0mkOjSwIurnj7fVIPY=
|
||||
github.com/eyedeekay/zerobundle/parts/aa v0.0.0-20200801165455-baeb0e58fc5a h1:YB1v+KkQusKKe7UjXIV2vI87okJXmBC7UHjnY6BkL04=
|
||||
github.com/eyedeekay/zerobundle/parts/aa v0.0.0-20200801165455-baeb0e58fc5a/go.mod h1:tVoCDPZqyc9Q5NKmU7m9jMHCFLuDhurZPsnnzv89pGE=
|
||||
github.com/eyedeekay/zerobundle/parts/ab v0.0.0-20200801165455-baeb0e58fc5a h1:tRCO7vRlUEBN/RxmUomwAlKQtZ6gtRoDMDyP2fravKI=
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package i2pbrowser
|
||||
|
||||
/*
|
||||
Released under the The MIT License (MIT)
|
@@ -1,6 +1,6 @@
|
||||
//+build generate
|
||||
|
||||
package main
|
||||
package i2pbrowser
|
||||
|
||||
/*
|
||||
Released under the The MIT License (MIT)
|
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package i2pbrowser
|
||||
|
||||
/*
|
||||
Released under the The MIT License (MIT)
|
||||
@@ -10,3 +10,7 @@ import "github.com/eyedeekay/i2pbrowser/lib"
|
||||
func firefoxMain() {
|
||||
i2pfirefox.FirefoxMain()
|
||||
}
|
||||
|
||||
func firefoxLaunch() {
|
||||
i2pfirefox.FirefoxLaunch()
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package i2pbrowser
|
||||
|
||||
/*
|
||||
Released under the The MIT License (MIT)
|
142
import/import.go
Normal file
142
import/import.go
Normal file
@@ -0,0 +1,142 @@
|
||||
//go:generate go run -tags generate gen.go extensions.go
|
||||
|
||||
/*
|
||||
Released under the The MIT License (MIT)
|
||||
see ./LICENSE
|
||||
*/
|
||||
|
||||
package i2pbrowser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/eyedeekay/GingerShrew/import"
|
||||
. "github.com/eyedeekay/go-fpw"
|
||||
. "github.com/eyedeekay/i2pbrowser/lib"
|
||||
"github.com/eyedeekay/zerobundle"
|
||||
)
|
||||
|
||||
type handler struct {
|
||||
}
|
||||
|
||||
func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
fmt.Fprintf(w, "hello\n")
|
||||
/*In the future, we may use this as a sort of loopback for privately testing the browser
|
||||
fingerprint. At first this will be 100% user-initiated, but it may be useful to query such
|
||||
a service periodically, in order to inform the user when a fingerprint change has occurred
|
||||
and prompt them to potentially re-set their browser to it's original state.
|
||||
for name, headers := range req.Header {
|
||||
for _, h := range headers {
|
||||
fmt.Fprintf(w, "%v: %v\n", name, h)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
func hello() error {
|
||||
server := &http.Server{Addr: "localhost:", Handler: &handler{}}
|
||||
|
||||
go func() {
|
||||
if err := server.ListenAndServe(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Setting up signal capturing
|
||||
// stop := make(chan os.Signal, 1)
|
||||
// signal.Notify(stop, os.Interrupt)
|
||||
|
||||
// Waiting for SIGINT (pkill -2)
|
||||
// <-stop
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func proxyCheck() bool {
|
||||
conn, err := net.Dial("tcp4", "localhost:4444")
|
||||
log.Println("Doing dial check")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
log.Println("Dial check true, proxy is up")
|
||||
defer conn.Close()
|
||||
return true
|
||||
}
|
||||
|
||||
func Main() {
|
||||
if err := hello(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
chromium := flag.Bool("chromium", false, "use a chromium-based browser instead of a firefox-based browser.")
|
||||
flag.Parse()
|
||||
ARGS = append(ARGS, flag.Args()...)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
if runtime.GOOS == "linux" {
|
||||
if !*chromium {
|
||||
if os.Getenv("FIREFOX_BIN") == "" {
|
||||
if err := gingershrew.UnpackTBZ(GingerDir); err != nil {
|
||||
log.Fatal("Error unpacking embedded browser")
|
||||
} else {
|
||||
os.Setenv("LD_LIBRARY_PATH", filepath.Join(GingerDir, "lib/x86_64-linux-gnu")+","+filepath.Join(GingerDir, "usr/lib/x86_64-linux-gnu"))
|
||||
log.Println("LD_LIBRARY_PATH", filepath.Join(GingerDir, "lib/x86_64-linux-gnu")+","+filepath.Join(GingerDir, "usr/lib/x86_64-linux-gnu"))
|
||||
os.Setenv("FIREFOX_BIN", filepath.Join(GingerDir, "gingershrew", "gingershrew"))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if LocateFirefox() == "" {
|
||||
*chromium = true
|
||||
}
|
||||
}
|
||||
if err := WriteI2CPConf(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
if err := zerobundle.ZeroMain(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
if !proxyCheck() {
|
||||
go proxyMain(ctx)
|
||||
}
|
||||
if !*chromium {
|
||||
firefoxMain()
|
||||
} else {
|
||||
chromiumMain()
|
||||
}
|
||||
}
|
||||
|
||||
func MainNoEmbeddedStuff() {
|
||||
if err := hello(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
chromium := false
|
||||
ARGS = append(ARGS, flag.Args()...)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
if LocateFirefox() == "" {
|
||||
chromium = true
|
||||
}
|
||||
if !proxyCheck() {
|
||||
go proxyMain(ctx)
|
||||
}
|
||||
if !chromium {
|
||||
firefoxLaunch()
|
||||
} else {
|
||||
chromiumMain()
|
||||
}
|
||||
}
|
@@ -14,6 +14,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
// "strings"
|
||||
"syscall"
|
||||
|
||||
. "github.com/eyedeekay/go-fpw"
|
||||
@@ -91,6 +92,50 @@ func WriteProfile(FS *fs) bool {
|
||||
return firstrun
|
||||
}
|
||||
|
||||
func FirefoxLaunch() {
|
||||
firstrun := WriteProfile(FS)
|
||||
prefs := filepath.Join(UserDir, "/user.js")
|
||||
if _, err := os.Stat(prefs); os.IsNotExist(err) {
|
||||
if err := ioutil.WriteFile(prefs, []byte(PREFS), 0644); err == nil {
|
||||
log.Println("wrote", prefs)
|
||||
} else {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
if firstrun {
|
||||
_, ERROR := SecureExtendedFirefox(UserDir, false, EXTENSIONS, EXTENSIONHASHES, ARGS...)
|
||||
if ERROR != nil {
|
||||
log.Fatal(ERROR)
|
||||
}
|
||||
// defer FIREFOX.Close()
|
||||
//<-FIREFOX.Done()
|
||||
} else {
|
||||
_, ERROR := BasicFirefox(UserDir, false, ARGS...)
|
||||
if ERROR != nil {
|
||||
log.Fatal(ERROR)
|
||||
}
|
||||
//<-FIREFOX.Done()
|
||||
// defer FIREFOX.Close()
|
||||
|
||||
/* sigs := make(chan os.Signal, 1)
|
||||
done := make(chan bool, 1)
|
||||
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
sig := <-sigs
|
||||
fmt.Println()
|
||||
fmt.Println(sig)
|
||||
done <- true
|
||||
}()
|
||||
|
||||
fmt.Println("awaiting signal")
|
||||
<-done
|
||||
fmt.Println("exiting")
|
||||
<-FIREFOX.Done()*/
|
||||
}
|
||||
}
|
||||
|
||||
func FirefoxMain() {
|
||||
firstrun := WriteProfile(FS)
|
||||
prefs := filepath.Join(UserDir, "/user.js")
|
||||
|
104
main.go
104
main.go
@@ -8,109 +8,9 @@ see ./LICENSE
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
. "github.com/eyedeekay/GingerShrew/import"
|
||||
. "github.com/eyedeekay/go-fpw"
|
||||
. "github.com/eyedeekay/i2pbrowser/lib"
|
||||
"github.com/eyedeekay/zerobundle"
|
||||
. "github.com/eyedeekay/i2pbrowser/import"
|
||||
)
|
||||
|
||||
type handler struct {
|
||||
}
|
||||
|
||||
func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
fmt.Fprintf(w, "hello\n")
|
||||
/*In the future, we may use this as a sort of loopback for privately testing the browser
|
||||
fingerprint. At first this will be 100% user-initiated, but it may be useful to query such
|
||||
a service periodically, in order to inform the user when a fingerprint change has occurred
|
||||
and prompt them to potentially re-set their browser to it's original state.
|
||||
for name, headers := range req.Header {
|
||||
for _, h := range headers {
|
||||
fmt.Fprintf(w, "%v: %v\n", name, h)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
func hello() error {
|
||||
server := &http.Server{Addr: "localhost:", Handler: &handler{}}
|
||||
|
||||
go func() {
|
||||
if err := server.ListenAndServe(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Setting up signal capturing
|
||||
// stop := make(chan os.Signal, 1)
|
||||
// signal.Notify(stop, os.Interrupt)
|
||||
|
||||
// Waiting for SIGINT (pkill -2)
|
||||
// <-stop
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func proxyCheck() bool {
|
||||
conn, err := net.Dial("tcp4", "localhost:4444")
|
||||
log.Println("Doing dial check")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
log.Println("Dial check true, proxy is up")
|
||||
defer conn.Close()
|
||||
return true
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := hello(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
chromium := flag.Bool("chromium", false, "use a chromium-based browser instead of a firefox-based browser.")
|
||||
flag.Parse()
|
||||
ARGS = append(ARGS, flag.Args()...)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
if runtime.GOOS == "linux" {
|
||||
if !*chromium {
|
||||
if err := UnpackTBZ(GingerDir); err != nil {
|
||||
log.Fatal("Error unpacking embedded browser")
|
||||
} else {
|
||||
os.Setenv("FIREFOX_BIN", filepath.Join(GingerDir, "gingershrew", "gingershrew"))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if LocateFirefox() == "" {
|
||||
*chromium = true
|
||||
}
|
||||
}
|
||||
if err := WriteI2CPConf(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
if err := zerobundle.ZeroMain(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
if !proxyCheck() {
|
||||
go proxyMain(ctx)
|
||||
}
|
||||
if !*chromium {
|
||||
firefoxMain()
|
||||
} else {
|
||||
chromiumMain()
|
||||
}
|
||||
Main()
|
||||
}
|
||||
|
Reference in New Issue
Block a user