forked from cwtch.im/cwtch
make local port selection deterministic and detach from the control port to improve performance
This commit is contained in:
parent
007c72c43c
commit
dc8d90263d
|
@ -394,8 +394,8 @@ func (cp *cwtchPeer) ContactRequest(name string, message string) string {
|
|||
// Listen sets up an onion listener to process incoming cwtch messages
|
||||
func (cp *cwtchPeer) Listen() error {
|
||||
cwtchpeer := new(application.RicochetApplication)
|
||||
l, err := application.SetupOnionV3("127.0.0.1:9051", "tcp4", "", cp.Profile.Ed25519PrivateKey, 9878)
|
||||
if err != nil {
|
||||
l, err := application.SetupOnionV3("127.0.0.1:9051", "tcp4", "", cp.Profile.Ed25519PrivateKey, cp.GetProfile().Onion, 9878)
|
||||
if err != nil && fmt.Sprintf("%v", err) != "550 Unspecified Tor error: Onion address collision" {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"git.openprivacy.ca/openprivacy/libricochet-go/application"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||
"log"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||
)
|
||||
|
||||
// Server encapsulates a complete, compliant Cwtch server.
|
||||
|
@ -25,7 +26,7 @@ func (s *Server) Run(serverConfig Config) {
|
|||
cwtchserver := new(application.RicochetApplication)
|
||||
s.metricsPack.Start(cwtchserver, s.config.ServerReporting.LogMetricsToFile)
|
||||
|
||||
l, err := application.SetupOnionV3("127.0.0.1:9051", "tcp4", "", s.config.PrivateKey, 9878)
|
||||
l, err := application.SetupOnionV3("127.0.0.1:9051", "tcp4", "", s.config.PrivateKey, utils.GetTorV3Hostname(s.config.PublicKey), 9878)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("error setting up onion service: %v", err)
|
||||
|
|
Loading…
Reference in New Issue