early-run tor, enable onion site
This commit is contained in:
21
Makefile
21
Makefile
@ -185,6 +185,27 @@ index-offline:
|
||||
@echo "</body>" >> offline.html
|
||||
@echo "</html>" >> offline.html
|
||||
|
||||
index-onion:
|
||||
@echo "<!DOCTYPE html>" > onion/www/index.html
|
||||
@echo "<html>" >> onion/www/index.html
|
||||
@echo "<head>" >> onion/www/index.html
|
||||
@echo " <title>$(BINARY) - $(CONSOLEPOSTNAME)</title>" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/style.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/default.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/desktop.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/mobile.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/syntax.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/widescreen.rtl.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/default.rtl.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/desktop.rtl.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/reset.css\" />" >> onion/www/index.html
|
||||
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/widescreen.css\" />" >> onion/www/index.html
|
||||
@echo "</head>" >> onion/www/index.html
|
||||
@echo "<body>" >> onion/www/index.html
|
||||
pandoc ONION.md >> onion/www/index.html
|
||||
@echo "</body>" >> onion/www/index.html
|
||||
@echo "</html>" >> onion/www/index.html
|
||||
|
||||
tor-browser/unpack/i2p.firefox:
|
||||
@echo "TODO"
|
||||
|
||||
|
26
ONION.md
26
ONION.md
@ -0,0 +1,26 @@
|
||||
Hello from I2P, OnionSpace! Thought I'd try to do something we'd both enjoy
|
||||
===========================================================================
|
||||
|
||||
This `.onion` site corresponds to an I2P user who is helping to distribute
|
||||
the Tor Browser bundle in a somewhat unique way. These users have downloaded
|
||||
the Tor Browser for their platform, and they have chosen to share it over
|
||||
I2P, using both the I2P Web and I2P Bittorrent. The goal is twofold, to provide
|
||||
a large number of ad-hoc mirrors of the latest offical Tor Browser Bundle, and
|
||||
provide a means for I2P users to download and configure the Tor Browser without
|
||||
initially retrieving Tor over the clearnet.
|
||||
|
||||
I2P is another anonymous network, it works slightly differently than Tor, it's
|
||||
designed in such a way that every router in the network is also a relay. This
|
||||
has advantages and disadvantages, which is why we try to encourage people to
|
||||
consider I2P and Tor separate, complementary, and not necessarily competitive
|
||||
tools. I2P can be quite good at distributing Tor and Tor Browser, and Tor Browser
|
||||
can be an effective tool for browsing I2P.
|
||||
|
||||
[Want to learn more about I2P? Visit our website(Clearnet link)](https://geti2p.net)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
- The author of this software is an I2P developer, `idk`. [You can see some of his other projects here(I2P Link)](http://idk.i2p)
|
||||
- I2P has many applications. One of the most popular is MuWire, by zlatinb. [MuWire is available here(Clearnet link)](https://muwire.com)
|
||||
and [here(I2P Link)](http://muwire.i2p).
|
||||
- Want to discuss I2P? Join us on [Reddit](https://old.reddit.com/r/i2p), [Our community forums](http://i2pforum.i2p), or our [Developer forums](http://zzz.i2p).
|
||||
- Want to work on I2P or use I2P in your application? Join us at [i2pgit.org](https://i2pgit.org), [git.idk.i2p](http://git.idk.i2p), or [our Github](https://github.com/i2p)
|
||||
|
5
main.go
5
main.go
@ -246,7 +246,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
client.TBS.RunTorWithLang()
|
||||
if *i2pbrowser {
|
||||
if err := client.TBS.RunI2PBWithLang(); err != nil {
|
||||
log.Fatal(err)
|
||||
@ -273,6 +273,9 @@ func main() {
|
||||
if *bemirror {
|
||||
go client.TBD.Serve()
|
||||
}
|
||||
if *solidarity {
|
||||
go client.Onion.ListenAndServe()
|
||||
}
|
||||
go runSysTray(false)
|
||||
if err := client.Serve(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -2,27 +2,36 @@ package i2pdotonion
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cretz/bine/tor"
|
||||
)
|
||||
|
||||
//go:embded www/*
|
||||
var content embed.FS
|
||||
|
||||
type I2POnionService struct {
|
||||
OnionService net.Listener
|
||||
ServeDir string
|
||||
}
|
||||
|
||||
func NewOnionService(dir string) *I2POnionService {
|
||||
return &I2POnionService{ServeDir: dir}
|
||||
func NewOnionService(dir string) (*I2POnionService, error) {
|
||||
ios := &I2POnionService{ServeDir: dir}
|
||||
if err := ios.UnpackSite(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ios, nil
|
||||
}
|
||||
|
||||
func (ios *I2POnionService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
@ -80,3 +89,34 @@ func (ios *I2POnionService) ListenAndServe() error {
|
||||
}
|
||||
return http.Serve(ios.OnionService, ios)
|
||||
}
|
||||
|
||||
func (ios *I2POnionService) UnpackSite() error {
|
||||
docroot := filepath.Join(ios.ServeDir, "www")
|
||||
os.MkdirAll(docroot, 0755)
|
||||
if dir, err := os.Stat(docroot); err == nil && dir.IsDir() {
|
||||
return nil
|
||||
}
|
||||
//unpack the contents to the docroot
|
||||
return fs.WalkDir(content, ".", func(embedpath string, d fs.DirEntry, err error) error {
|
||||
fp := filepath.Join(docroot)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(embedpath, filepath.Join(fp, strings.Replace(embedpath, "tor-browser/unpack/i2p.firefox", "", -1)))
|
||||
if d.IsDir() {
|
||||
os.MkdirAll(filepath.Join(fp, strings.Replace(embedpath, "tor-browser/unpack/i2p.firefox", "", -1)), 0755)
|
||||
} else {
|
||||
fullpath := path.Join(embedpath)
|
||||
bytes, err := content.ReadFile(fullpath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
unpack := filepath.Join(fp, strings.Replace(embedpath, "tor-browser/unpack/i2p.firefox", "", -1))
|
||||
if err := ioutil.WriteFile(unpack, bytes, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -1 +1,28 @@
|
||||
Hello from I2P, OnionSpace! Thought I'd try to do something we'd both enjoy.
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>i2p.plugins.tor-manager - Tor Binary Manager</title>
|
||||
<link rel="stylesheet" type="text/css" href ="/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/default.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/desktop.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/mobile.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/syntax.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/widescreen.rtl.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/default.rtl.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/desktop.rtl.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/reset.css" />
|
||||
<link rel="stylesheet" type="text/css" href ="/widescreen.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="hello-from-i2p-onionspace-thought-id-try-to-do-something-wed-both-enjoy">Hello from I2P, OnionSpace! Thought I’d try to do something we’d both enjoy</h1>
|
||||
<p>This <code>.onion</code> site corresponds to an I2P user who is helping to distribute the Tor Browser bundle in a somewhat unique way. These users have downloaded the Tor Browser for their platform, and they have chosen to share it over I2P, using both the I2P Web and I2P Bittorrent. The goal is twofold, to provide a large number of ad-hoc mirrors of the latest offical Tor Browser Bundle, and provide a means for I2P users to download and configure the Tor Browser without initially retrieving Tor over the clearnet.</p>
|
||||
<p>I2P is another anonymous network, it works slightly differently than Tor, it’s designed in such a way that every router in the network is also a relay. This has advantages and disadvantages, which is why we try to encourage people to consider I2P and Tor separate, complementary, and not necessarily competitive tools. I2P can be quite good at distributing Tor and Tor Browser, and Tor Browser can be an effective tool for browsing I2P.</p>
|
||||
<h2 id="want-to-learn-more-about-i2p-visit-our-websiteclearnet-link"><a href="https://geti2p.net">Want to learn more about I2P? Visit our website(Clearnet link)</a></h2>
|
||||
<ul>
|
||||
<li>The author of this software is an I2P developer, <code>idk</code>. <a href="http://idk.i2p">You can see some of his other projects here(I2P Link)</a></li>
|
||||
<li>I2P has many applications. One of the most popular is MuWire, by zlatinb. <a href="https://muwire.com">MuWire is available here(Clearnet link)</a> and <a href="http://muwire.i2p">here(I2P Link)</a>.</li>
|
||||
<li>Want to discuss I2P? Join us on <a href="https://old.reddit.com/r/i2p">Reddit</a>, <a href="http://i2pforum.i2p">Our community forums</a>, or our <a href="http://zzz.i2p">Developer forums</a>.</li>
|
||||
<li>Want to work on I2P or use I2P in your application? Join us at <a href="https://i2pgit.org">i2pgit.org</a>, <a href="http://git.idk.i2p">git.idk.i2p</a>, or <a href="https://github.com/i2p">our Github</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -38,6 +38,11 @@ func NewClient(verbose bool, lang, os, arch, mirror string, content *embed.FS) (
|
||||
m.TBD.Mirror = mirror
|
||||
m.TBD.Verbose = verbose
|
||||
m.TBD.MakeTBDirectory()
|
||||
var err error
|
||||
m.Onion, err = i2pdotonion.NewOnionService(m.TBD.DownloadPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tgz, sig, err := m.TBD.DownloadUpdaterForLang(lang)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
Reference in New Issue
Block a user