use new Cwtch ActiveEngines
continuous-integration/drone/pr Build is running Details

This commit is contained in:
Dan Ballard 2022-12-02 16:54:39 -08:00
parent c88700b226
commit 18c6907dbe
4 changed files with 12 additions and 13 deletions

4
go.mod
View File

@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/libcwtch-go
go 1.17
require (
cwtch.im/cwtch v0.18.4
cwtch.im/cwtch v0.18.5
git.openprivacy.ca/cwtch.im/server v1.4.5
git.openprivacy.ca/openprivacy/connectivity v1.8.6
git.openprivacy.ca/openprivacy/log v1.0.3
@ -28,4 +28,4 @@ require (
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
)

2
go.sum
View File

@ -3,6 +3,8 @@ cwtch.im/cwtch v0.18.3 h1:3zBvC4buII6pWQ+OOVUR6WuAwQDKCxSrj0ZOYKEeB6I=
cwtch.im/cwtch v0.18.3/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
cwtch.im/cwtch v0.18.4 h1:Oht7rEDVJjVWDOKg0xqDgXvY/H059HMJlOPt/nBGqxk=
cwtch.im/cwtch v0.18.4/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.5 h1:yqDns4flbowsbaWjMiUm7Em4IAlM8kkgm79CCcXV1GE=
cwtch.im/cwtch v0.18.5/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=

1
lib.go
View File

@ -238,6 +238,7 @@ func buildACN(settings utils.GlobalSettings, torPath string, appDir string) conn
}
torrc := tor.NewTorrc().WithSocksPort(socksPort).WithOnionTrafficOnly().WithControlPort(controlPort).WithHashedPassword(base64.StdEncoding.EncodeToString(key))
// torrc.WithLog(path.Join(appDir, "tor", "tor.log"), tor.TorLogLevelNotice)
if settings.UseCustomTorrc {
customTorrc := settings.CustomTorrc
torrc.WithCustom(strings.Split(customTorrc, "\n"))

View File

@ -100,15 +100,11 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if newAcnStatus == 100 {
if acnStatus != 100 {
// just came online
for _, onion := range eh.app.ListProfiles() {
// launch a listen thread (internally this does a check that the protocol engine is not listening)
// and as such is safe to call.
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
eh.app.ActivePeerEngine(onion, true, true, doServers)
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
eh.app.ActivateEngines(true, true, doServers)
eh.api.LaunchServers()
}
} else {
@ -144,8 +140,8 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
}
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
eh.app.AddPeerPlugin(onion, plugins.CONNECTIONRETRY)
eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
// disabeling network check for connection attempt reservation, needs rework
//eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
eh.app.AddPeerPlugin(onion, plugins.ANTISPAM)
// If the user has chosen to block unknown profiles
@ -164,7 +160,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
eh.app.ActivePeerEngine(onion, true, true, doServers)
eh.app.ActivatePeerEngine(onion, true, true, doServers)
}
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)