daemon

package
v0.0.0-...-9a70a3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2016 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

watches the file system for new messages --> sends them communicates with the server --> receive new messages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllRatchets

func AllRatchets(d *Daemon, fillAuth func(tag, data []byte, theirAuthPublic *[32]byte), checkAuth func(tag, data, msg []byte, ourAuthPrivate *[32]byte) error) ([]*ratchet.Ratchet, error)

func Copy

func Copy(source string, dest string, perm os.FileMode) error

Copy copyes the contents of file source to dest. NOT atomic.

func GeneratePrekeys

func GeneratePrekeys(numKeys int) ([]*[32]byte, []*[32]byte, error)

returns public, secret, error

func Init

func Init(rootDir, dename, serverAddr string, serverPort int, serverPK *[32]byte, torAddr string) error

Init creates a new account locally and at the server

func InitFs

func InitFs(d *Daemon) error

func LoadPrekeys

func LoadPrekeys(d *Daemon) ([]*[32]byte, []*[32]byte, error)

func LoadRatchet

func LoadRatchet(d *Daemon, name string, fillAuth func(tag, data []byte, theirAuthPublic *[32]byte), checkAuth func(tag, data, msg []byte, ourAuthPrivate *[32]byte) error) (*ratchet.Ratchet, error)

func StoreLocalAccountConfig

func StoreLocalAccountConfig(d *Daemon, localAccountConfig *proto.LocalAccountConfig) error

func StorePrekeys

func StorePrekeys(d *Daemon, prekeyPublics, prekeySecrets []*[32]byte) error

func StoreRatchet

func StoreRatchet(d *Daemon, name string, ratch *ratchet.Ratchet) error

func ValidateName

func ValidateName(name string) error

func WatchDir

func WatchDir(watcher *fsnotify.Watcher, dir string, initFn filepath.WalkFunc) error

Types

type Daemon

type Daemon struct {
	persistence.Paths

	// Gets the current time
	Now func() time.Time

	proto.LocalAccountConfig
	proto.LocalAccount
	// contains filtered or unexported fields
}

Daemon encapsulates long-running client-side chatterbox functionality

func Load

func Load(rootDir string, denameConfig *client.Config) (*Daemon, error)

Load initializes a chatterbox daemon from rootDir

func PrepareTestAccountDaemon

func PrepareTestAccountDaemon(name string, rootDir string, denameConfig *denameClient.Config, serverAddr string, serverPk *[32]byte, t testing.TB) *Daemon

func (*Daemon) LatestProfile

func (d *Daemon) LatestProfile(name string, received *dename.Profile) (*dename.Profile, error)

func (*Daemon) OurChatterboxProfilePath

func (d *Daemon) OurChatterboxProfilePath() string

TODO: move to persistence and point somewhere other than daemon directory?

func (*Daemon) ProfileRatchet

func (d *Daemon) ProfileRatchet(name string, reply *dename.ClientReply) (*dename.Profile, error)

func (*Daemon) Start

func (d *Daemon) Start()

Start activates the already initialized chatterbox daemon

func (*Daemon) Stop

func (d *Daemon) Stop()

Stop stops the daemon and returns when it has completely shut down

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL