Fixup EngineHook API
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
5f448ac2c2
commit
7255a6c71e
10
app/app.go
10
app/app.go
|
@ -51,7 +51,7 @@ func (app *application) IsFeatureEnabled(experiment string) bool {
|
||||||
type Application interface {
|
type Application interface {
|
||||||
LoadProfiles(password string)
|
LoadProfiles(password string)
|
||||||
CreateProfile(name string, password string, autostart bool)
|
CreateProfile(name string, password string, autostart bool)
|
||||||
|
InstallEngineHooks(engineHooks connections.EngineHooks)
|
||||||
ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error)
|
ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error)
|
||||||
EnhancedImportProfile(exportedCwtchFile string, password string) string
|
EnhancedImportProfile(exportedCwtchFile string, password string) string
|
||||||
DeleteProfile(onion string, currentPassword 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
|
// 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 := &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.peers = make(map[string]peer.CwtchPeer)
|
||||||
app.engineHooks = engineHooks
|
app.engineHooks = DefaultEngineHooks{}
|
||||||
app.acn = acn
|
app.acn = acn
|
||||||
statusHandler := app.getACNStatusHandler()
|
statusHandler := app.getACNStatusHandler()
|
||||||
acn.SetStatusCallback(statusHandler)
|
acn.SetStatusCallback(statusHandler)
|
||||||
|
@ -110,6 +110,10 @@ func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.Global
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (app *application) InstallEngineHooks(engineHooks connections.EngineHooks) {
|
||||||
|
app.engineHooks = engineHooks
|
||||||
|
}
|
||||||
|
|
||||||
func (app *application) ReadSettings() settings.GlobalSettings {
|
func (app *application) ReadSettings() settings.GlobalSettings {
|
||||||
app.appmutex.Lock()
|
app.appmutex.Lock()
|
||||||
defer app.appmutex.Unlock()
|
defer app.appmutex.Unlock()
|
||||||
|
|
|
@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) {
|
||||||
acn.WaitTillBootstrapped()
|
acn.WaitTillBootstrapped()
|
||||||
defer acn.Close()
|
defer acn.Close()
|
||||||
|
|
||||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{})
|
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"))
|
||||||
|
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||||
|
|
|
@ -139,7 +139,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
|
||||||
const ServerAddr = "nfhxzvzxinripgdh4t2m4xcy3crf6p4cbhectgckuj3idsjsaotgowad"
|
const ServerAddr = "nfhxzvzxinripgdh4t2m4xcy3crf6p4cbhectgckuj3idsjsaotgowad"
|
||||||
serverKeyBundle, _ := base64.StdEncoding.DecodeString(ServerKeyBundleBase64)
|
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()
|
usr, _ := user.Current()
|
||||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||||
|
|
|
@ -59,7 +59,7 @@ func TestEncryptedStorage(t *testing.T) {
|
||||||
|
|
||||||
defer acn.Close()
|
defer acn.Close()
|
||||||
acn.WaitTillBootstrapped()
|
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("alice", "password", true)
|
||||||
app.CreateProfile("bob", "password", true)
|
app.CreateProfile("bob", "password", true)
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) {
|
||||||
acn.WaitTillBootstrapped()
|
acn.WaitTillBootstrapped()
|
||||||
defer acn.Close()
|
defer acn.Close()
|
||||||
|
|
||||||
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{})
|
app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"))
|
||||||
|
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
cwtchDir := path.Join(usr.HomeDir, ".cwtch")
|
||||||
|
|
Loading…
Reference in New Issue