fully automatic onionv3 reseeds
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cretz/bine/tor"
|
||||
"github.com/cretz/bine/torutil/ed25519"
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/justinas/alice"
|
||||
"gopkg.in/throttled/throttled.v2"
|
||||
@@ -114,7 +116,7 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) error {
|
||||
return srv.Serve(tlsListener)
|
||||
}
|
||||
|
||||
func (srv *Server) ListenAndServeOnion(startConf *tor.StartConf, listenConf *tor.ListenConf) error {
|
||||
func (srv *Server) ListenAndServeOnion(startConf *tor.StartConf, listenConf *tor.ListenConf, onionKey string) error {
|
||||
log.Println("Starting and registering onion service, please wait a couple of minutes...")
|
||||
tor, err := tor.Start(nil, startConf)
|
||||
if err != nil {
|
||||
@@ -128,6 +130,10 @@ func (srv *Server) ListenAndServeOnion(startConf *tor.StartConf, listenConf *tor
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(onionKey, []byte(srv.OnionListener.Key.(ed25519.KeyPair).PrivateKey()), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("Onionv3 server started on http://%v.onion\n", srv.OnionListener.ID)
|
||||
return srv.Serve(srv.OnionListener)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user