Enable a SendPeerMessage EngineHook for Fuzzbot #508
10
app/app.go
10
app/app.go
|
@ -51,7 +51,7 @@ func (app *application) IsFeatureEnabled(experiment string) bool {
|
|||
type Application interface {
|
||||
LoadProfiles(password string)
|
||||
CreateProfile(name string, password string, autostart bool)
|
||||
|
||||
InstallEngineHooks(engineHooks connections.EngineHooks)
|
||||
ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error)
|
||||
EnhancedImportProfile(exportedCwtchFile string, password string) string
|
||||
DeleteProfile(onion string, currentPassword string)
|
||||
|
@ -95,11 +95,11 @@ func LoadAppSettings(appDirectory string) *settings.GlobalSettingsFile {
|
|||
}
|
||||
|
||||
// NewApp creates a new app with some environment awareness and initializes a Tor Manager
|
||||
func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.GlobalSettingsFile, engineHooks connections.EngineHooks) Application {
|
||||
func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.GlobalSettingsFile) Application {
|
||||
|
||||
app := &application{engines: make(map[string]connections.Engine), eventBuses: make(map[string]event.Manager), directory: appDirectory, appBus: event.NewEventManager(), settings: settings}
|
||||
app.peers = make(map[string]peer.CwtchPeer)
|
||||
app.engineHooks = engineHooks
|
||||
app.engineHooks = DefaultEngineHooks{}
|
||||
app.acn = acn
|
||||
statusHandler := app.getACNStatusHandler()
|
||||
acn.SetStatusCallback(statusHandler)
|
||||
|
@ -110,6 +110,10 @@ func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.Global
|
|||
return app
|
||||
}
|
||||
|
||||
func (app *application) InstallEngineHooks(engineHooks connections.EngineHooks) {
|
||||
app.engineHooks = engineHooks
|
||||
}
|
||||
|
||||
func (app *application) ReadSettings() settings.GlobalSettings {
|
||||
app.appmutex.Lock()
|
||||
defer app.appmutex.Unlock()
|
||||
|
|
|
@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) {
|
|||
acn.WaitTillBootstrapped()
|
||||
defer acn.Close()
|
||||
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{})
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"))
|
||||
|
||||
usr, _ := user.Current()
|
||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||
|
|
|
@ -139,7 +139,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
|
|||
const ServerAddr = "nfhxzvzxinripgdh4t2m4xcy3crf6p4cbhectgckuj3idsjsaotgowad"
|
||||
serverKeyBundle, _ := base64.StdEncoding.DecodeString(ServerKeyBundleBase64)
|
||||
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{})
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"))
|
||||
|
||||
usr, _ := user.Current()
|
||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||
|
|
|
@ -59,7 +59,7 @@ func TestEncryptedStorage(t *testing.T) {
|
|||
|
||||
defer acn.Close()
|
||||
acn.WaitTillBootstrapped()
|
||||
app := app2.NewApp(acn, cwtchDir, app2.LoadAppSettings(cwtchDir), app2.DefaultEngineHooks{})
|
||||
app := app2.NewApp(acn, cwtchDir, app2.LoadAppSettings(cwtchDir))
|
||||
app.CreateProfile("alice", "password", true)
|
||||
app.CreateProfile("bob", "password", true)
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) {
|
|||
acn.WaitTillBootstrapped()
|
||||
defer acn.Close()
|
||||
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{})
|
||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"))
|
||||
|
||||
usr, _ := user.Current()
|
||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||
|
|
Loading…
Reference in New Issue