package app import ( "git.mascherari.press/cwtch/model" "git.mascherari.press/cwtch/peer" "log" ) type Application struct { Peer *peer.CwtchPeer } func (app *Application) NewProfile(name string, filename string) error { profile := peer.NewCwtchPeer(name) app.Peer = profile err := profile.Save(filename) if err == nil { go func() { err := app.Peer.Listen() if err != nil { log.Panic(err) } }() } return err } func (app *Application) SetProfile(filename string) error { profile, err := peer.LoadCwtchPeer(filename) app.Peer = profile if err == nil { go func() { err := app.Peer.Listen() if err != nil { log.Panic(err) } }() } return err } func (app *Application) PeerRequest(onion string) { app.Peer.PeerWithOnion(onion) }