Merge branch 'tor-retry' of dan/cwtch into master
This commit is contained in:
commit
55c5343b2b
|
@ -60,7 +60,7 @@ func (psc *PeerServerConnection) Run() error {
|
|||
rc.TraceLog(true)
|
||||
psc.connection = rc
|
||||
psc.state = CONNECTED
|
||||
pub, priv, _ := ed25519.GenerateKey(rand.Reader)
|
||||
pub, priv, err := ed25519.GenerateKey(rand.Reader)
|
||||
if err == nil {
|
||||
_, err := connection.HandleOutboundConnection(psc.connection).ProcessAuthAsV3Client(identity.InitializeV3("cwtchpeer", &priv, &pub))
|
||||
if err == nil {
|
||||
|
|
|
@ -9,7 +9,11 @@ import (
|
|||
"git.openprivacy.ca/openprivacy/libricochet-go/application"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||
|
||||
"log"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Server encapsulates a complete, compliant Cwtch server.
|
||||
|
@ -28,16 +32,10 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
|
|||
cwtchserver := new(application.RicochetApplication)
|
||||
s.metricsPack.Start(cwtchserver, serverConfig.ConfigDir, s.config.ServerReporting.LogMetricsToFile)
|
||||
|
||||
listenService, err := acn.Listen(s.config.PrivateKey, application.RicochetPort)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("error setting up onion service: %v", err)
|
||||
}
|
||||
|
||||
af := application.ApplicationInstanceFactory{}
|
||||
af.Init()
|
||||
ms := new(storage.MessageStore)
|
||||
err = ms.Init(serverConfig.ConfigDir, s.config.MaxBufferLines, s.metricsPack.MessageCounter)
|
||||
err := ms.Init(serverConfig.ConfigDir, s.config.MaxBufferLines, s.metricsPack.MessageCounter)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -68,10 +66,22 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
|
|||
}
|
||||
})
|
||||
|
||||
cwtchserver.Init(acn, "cwtch server for "+listenService.AddressIdentity(), s.config.Identity(), af, new(application.AcceptAllContactManager))
|
||||
log.Printf("cwtch server running on cwtch:%s", listenService.AddressFull())
|
||||
addressIdentity := utils.GetTorV3Hostname(s.config.PublicKey)
|
||||
cwtchserver.Init(acn, "cwtch server for "+addressIdentity, s.config.Identity(), af, new(application.AcceptAllContactManager))
|
||||
port := strconv.Itoa(application.RicochetPort)
|
||||
log.Printf("cwtch server running on cwtch:%s", addressIdentity+".onion:"+port)
|
||||
|
||||
s.app = cwtchserver
|
||||
s.app.Run(listenService)
|
||||
|
||||
for true {
|
||||
listenService, err := acn.Listen(s.config.PrivateKey, application.RicochetPort)
|
||||
if err != nil {
|
||||
log.Printf("Listen() error setting up onion service: %v\n", err)
|
||||
} else {
|
||||
s.app.Run(listenService)
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
// Shutdown kills the app closing all connections and freeing all goroutines
|
||||
|
|
Loading…
Reference in New Issue