Documentation ¶
Index ¶
- Constants
- Variables
- func GetDefaultSyncWorkerCount() int
- func GetHelper(vaultDir string) (string, error)
- func GetVaultKey(kc *keychain.Keychain) ([]byte, error)
- func HasVaultKey(kc *keychain.Keychain) (bool, error)
- func NewVaultKey(kc *keychain.Keychain) ([]byte, error)
- func SetHelper(vaultDir, helper string) error
- func SetVaultKey(kc *keychain.Keychain, key []byte) error
- type AddressMode
- type Cert
- type Certs
- type Data
- type Data_2_3_x
- type Data_2_4_x
- type File
- type Keychain
- type Settings
- type Settings_2_3_x
- type Settings_2_4_x
- type SyncStatus
- type User
- func (user *User) AddFailedMessageID(messageID string) error
- func (user *User) AddressMode() AddressMode
- func (user *User) AuthRef() string
- func (user *User) AuthUID() string
- func (user *User) BridgePass() []byte
- func (user *User) Clear() error
- func (user *User) ClearSyncStatus() error
- func (user *User) Close() error
- func (user *User) EventID() string
- func (user *User) GetGluonIDs() map[string]string
- func (user *User) GetSyncStatus() SyncStatus
- func (user *User) GluonKey() []byte
- func (user *User) KeyPass() []byte
- func (user *User) PrimaryEmail() string
- func (user *User) RemFailedMessageID(messageID string) error
- func (user *User) RemoveGluonID(addrID, gluonID string) error
- func (user *User) SetAddressMode(mode AddressMode) error
- func (user *User) SetAuth(authUID, authRef string) error
- func (user *User) SetBridgePass(newPass []byte) error
- func (user *User) SetEventID(eventID string) error
- func (user *User) SetGluonID(addrID, gluonID string) error
- func (user *User) SetHasLabels(hasLabels bool) error
- func (user *User) SetHasMessages(hasMessages bool) error
- func (user *User) SetKeyPass(keyPass []byte) error
- func (user *User) SetLastMessageID(messageID string) error
- func (user *User) SetPrimaryEmail(email string) error
- func (user *User) SyncStatus() SyncStatus
- func (user *User) UserID() string
- func (user *User) Username() string
- type UserData
- type UserData_2_3_x
- type UserData_2_4_x
- type Vault
- func (vault *Vault) AddUser(userID, username, primaryEmail, authUID, authRef string, keyPass []byte) (*User, error)
- func (vault *Vault) Close() error
- func (vault *Vault) DeleteUser(userID string) error
- func (vault *Vault) ForUser(parallelism int, fn func(*User) error) error
- func (vault *Vault) GetAutoUpdate() bool
- func (vault *Vault) GetAutostart() bool
- func (vault *Vault) GetBridgeTLSCert() ([]byte, []byte)
- func (vault *Vault) GetCertsInstalled() bool
- func (vault *Vault) GetColorScheme() string
- func (vault *Vault) GetCookies() ([]byte, error)
- func (vault *Vault) GetFirstStart() bool
- func (vault *Vault) GetGluonCacheDir() string
- func (vault *Vault) GetIMAPPort() int
- func (vault *Vault) GetIMAPSSL() bool
- func (vault *Vault) GetLastVersion() *semver.Version
- func (vault *Vault) GetMaxSyncMemory() uint64
- func (vault *Vault) GetProxyAllowed() bool
- func (vault *Vault) GetSMTPPort() int
- func (vault *Vault) GetSMTPSSL() bool
- func (vault *Vault) GetShowAllMail() bool
- func (vault *Vault) GetUpdateChannel() updater.Channel
- func (vault *Vault) GetUpdateRollout() float64
- func (vault *Vault) GetUser(userID string, fn func(*User)) error
- func (vault *Vault) GetUserIDs() []string
- func (vault *Vault) HasUser(userID string) bool
- func (vault *Vault) Migrated() bool
- func (vault *Vault) NewUser(userID string) (*User, error)
- func (vault *Vault) Path() string
- func (vault *Vault) Reset(gluonDir string) error
- func (vault *Vault) SetAutoUpdate(autoUpdate bool) error
- func (vault *Vault) SetAutostart(autostart bool) error
- func (vault *Vault) SetBridgeTLSCertKey(cert, key []byte) error
- func (vault *Vault) SetBridgeTLSCertPath(certPath, keyPath string) error
- func (vault *Vault) SetCertsInstalled(installed bool) error
- func (vault *Vault) SetColorScheme(colorScheme string) error
- func (vault *Vault) SetCookies(cookies []byte) error
- func (vault *Vault) SetFirstStart(firstStart bool) error
- func (vault *Vault) SetGluonDir(dir string) error
- func (vault *Vault) SetIMAPPort(port int) error
- func (vault *Vault) SetIMAPSSL(ssl bool) error
- func (vault *Vault) SetLastVersion(version *semver.Version) error
- func (vault *Vault) SetMaxSyncMemory(maxMemory uint64) error
- func (vault *Vault) SetMigrated() error
- func (vault *Vault) SetProxyAllowed(allowed bool) error
- func (vault *Vault) SetSMTPPort(port int) error
- func (vault *Vault) SetSMTPSSL(ssl bool) error
- func (vault *Vault) SetShowAllMail(showAllMail bool) error
- func (vault *Vault) SetUpdateChannel(channel updater.Channel) error
- func (vault *Vault) SetUpdateRollout(rollout float64) error
- type Version
Constants ¶
const (
Current = v2_5_x
)
const DefaultMaxSyncMemory = 2 * 1024 * uint64(1024*1024)
const (
ForbiddenRollout = 0.6046602879796196
)
Variables ¶
var RandomToken = crypto.RandomToken // nolint:gochecknoglobals
RandomToken is a function that returns a random token. By default, we use crypto.RandomToken to generate tokens.
Functions ¶
func GetDefaultSyncWorkerCount ¶
func GetDefaultSyncWorkerCount() int
Types ¶
type AddressMode ¶
type AddressMode int
const ( CombinedMode AddressMode = iota SplitMode )
func (AddressMode) String ¶
func (mode AddressMode) String() string
type Data_2_3_x ¶
type Data_2_3_x struct { Settings Settings_2_3_x Users []UserData_2_3_x }
type Data_2_4_x ¶
type Data_2_4_x struct { Settings Settings_2_4_x Users []UserData_2_4_x }
type Settings ¶
type Settings struct { GluonDir string IMAPPort int SMTPPort int IMAPSSL bool SMTPSSL bool UpdateChannel updater.Channel UpdateRollout float64 ColorScheme string ProxyAllowed bool ShowAllMail bool Autostart bool AutoUpdate bool LastVersion string FirstStart bool MaxSyncMemory uint64 // **WARNING**: These entry can't be removed until they vault has proper migration support. SyncWorkers int SyncAttPool int }
type Settings_2_3_x ¶
type Settings_2_4_x ¶
type SyncStatus ¶
type SyncStatus struct { HasLabels bool HasMessages bool LastMessageID string FailedMessageIDs []string }
func (SyncStatus) IsComplete ¶
func (status SyncStatus) IsComplete() bool
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) AddFailedMessageID ¶ added in v3.0.6
AddFailedMessageID adds a message ID to the list of failed message IDs.
func (*User) AddressMode ¶
func (user *User) AddressMode() AddressMode
AddressMode returns the user's address mode.
func (*User) BridgePass ¶
BridgePass returns the user's bridge password as raw token bytes (unencoded).
func (*User) ClearSyncStatus ¶
ClearSyncStatus clears the user's sync status.
func (*User) GetGluonIDs ¶
func (*User) GetSyncStatus ¶ added in v3.0.14
func (user *User) GetSyncStatus() SyncStatus
GetSyncStatus returns the user's sync status.
func (*User) PrimaryEmail ¶ added in v3.0.12
PrimaryEmail returns the user's primary email address.
func (*User) RemFailedMessageID ¶ added in v3.0.6
RemFailedMessageID removes a message ID from the list of failed message IDs.
func (*User) RemoveGluonID ¶
func (*User) SetAddressMode ¶
func (user *User) SetAddressMode(mode AddressMode) error
SetAddressMode sets the address mode for the given user.
func (*User) SetBridgePass ¶ added in v3.0.7
SetBridgePass saves bridge password as raw token bytes (unecoded).
func (*User) SetEventID ¶
SetEventID sets the event ID for the given user.
func (*User) SetGluonID ¶
func (*User) SetHasLabels ¶
SetHasLabels sets whether the user's labels have been synced.
func (*User) SetHasMessages ¶
SetHasMessages sets whether the user's messages have been synced.
func (*User) SetKeyPass ¶
SetKeyPass sets the user's (salted) key password.
func (*User) SetLastMessageID ¶
SetLastMessageID sets the last synced message ID for the given user.
func (*User) SetPrimaryEmail ¶ added in v3.0.12
SetPrimaryEmail sets the user's primary email address.
func (*User) SyncStatus ¶
func (user *User) SyncStatus() SyncStatus
SyncStatus return's the user's sync status.
type UserData ¶
type UserData struct { UserID string Username string PrimaryEmail string GluonKey []byte GluonIDs map[string]string BridgePass []byte // raw token represented as byte slice (needs to be encoded) AddressMode AddressMode AuthUID string AuthRef string KeyPass []byte SyncStatus SyncStatus EventID string // **WARNING**: This value can't be removed until we have vault migration support. UIDValidity map[string]imap.UID }
UserData holds information about a single bridge user. The user may or may not be logged in.
type UserData_2_3_x ¶
type UserData_2_4_x ¶
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
Vault is an encrypted data vault that stores bridge and user data.
func New ¶
func New(vaultDir, gluonCacheDir string, key []byte, panicHandler async.PanicHandler) (*Vault, bool, error)
New constructs a new encrypted data vault at the given filepath using the given encryption key.
func (*Vault) AddUser ¶
func (vault *Vault) AddUser(userID, username, primaryEmail, authUID, authRef string, keyPass []byte) (*User, error)
AddUser creates a new user in the vault with the given ID, username and password. A bridge password and gluon key are generated using the package's token generator.
func (*Vault) DeleteUser ¶
DeleteUser removes the given user from the vault.
func (*Vault) GetAutoUpdate ¶
GetAutoUpdate sets whether the bridge should automatically update.
func (*Vault) GetAutostart ¶
GetAutostart sets whether the bridge should autostart.
func (*Vault) GetBridgeTLSCert ¶
GetBridgeTLSCert returns the PEM-encoded certificate for the bridge. If CertPEMPath is set, it will attempt to read the certificate from the file. Otherwise, or on read/validation failure, it will return the certificate from the vault.
func (*Vault) GetCertsInstalled ¶
func (*Vault) GetColorScheme ¶
GetColorScheme sets the color scheme to be used by the bridge GUI.
func (*Vault) GetCookies ¶
func (*Vault) GetFirstStart ¶
GetFirstStart returns whether this is the first time the bridge has been started.
func (*Vault) GetGluonCacheDir ¶ added in v3.0.12
GetGluonCacheDir sets the directory where the gluon should store its data.
func (*Vault) GetIMAPPort ¶
GetIMAPPort sets the port that the IMAP server should listen on.
func (*Vault) GetIMAPSSL ¶
GetIMAPSSL sets whether the IMAP server should use SSL.
func (*Vault) GetLastVersion ¶
func (vault *Vault) GetLastVersion() *semver.Version
GetLastVersion returns the last version of the bridge that was run.
func (*Vault) GetMaxSyncMemory ¶ added in v3.1.0
GetMaxSyncMemory returns the maximum amount of memory the sync process should use.
func (*Vault) GetProxyAllowed ¶
GetProxyAllowed sets whether the bridge is allowed to use alternative routing.
func (*Vault) GetSMTPPort ¶
GetSMTPPort sets the port that the SMTP server should listen on.
func (*Vault) GetSMTPSSL ¶
GetSMTPSSL sets whether the SMTP server should use SSL.
func (*Vault) GetShowAllMail ¶
GetShowAllMail sets whether the bridge should show the All Mail folder.
func (*Vault) GetUpdateChannel ¶
GetUpdateChannel sets the update channel.
func (*Vault) GetUpdateRollout ¶
GetUpdateRollout sets the update rollout.
func (*Vault) GetUser ¶
GetUser provides access to a vault user. It returns an error if the user does not exist.
func (*Vault) GetUserIDs ¶
GetUserIDs returns the user IDs and usernames of all users in the vault.
func (*Vault) NewUser ¶
NewUser returns a new vault user. It must be closed before it can be deleted.
func (*Vault) SetAutoUpdate ¶
SetAutoUpdate sets whether the bridge should automatically update.
func (*Vault) SetAutostart ¶
SetAutostart sets whether the bridge should autostart.
func (*Vault) SetBridgeTLSCertKey ¶ added in v3.0.21
SetBridgeTLSCertKey sets the path to PEM-encoded certificates for the bridge.
func (*Vault) SetBridgeTLSCertPath ¶ added in v3.1.0
SetBridgeTLSCertPath sets the path to PEM-encoded certificates for the bridge.
func (*Vault) SetCertsInstalled ¶
func (*Vault) SetColorScheme ¶
SetColorScheme sets the color scheme to be used by the bridge GUI.
func (*Vault) SetCookies ¶
func (*Vault) SetFirstStart ¶
SetFirstStart sets whether this is the first time the bridge has been started.
func (*Vault) SetGluonDir ¶
SetGluonDir sets the directory where the gluon should store its data.
func (*Vault) SetIMAPPort ¶
SetIMAPPort sets the port that the IMAP server should listen on.
func (*Vault) SetIMAPSSL ¶
SetIMAPSSL sets whether the IMAP server should use SSL.
func (*Vault) SetLastVersion ¶
SetLastVersion sets the last version of the bridge that was run.
func (*Vault) SetMaxSyncMemory ¶ added in v3.1.0
SetMaxSyncMemory sets the maximum amount of memory the sync process should use.
func (*Vault) SetMigrated ¶
func (*Vault) SetProxyAllowed ¶
SetProxyAllowed sets whether the bridge is allowed to use alternative routing.
func (*Vault) SetSMTPPort ¶
SetSMTPPort sets the port that the SMTP server should listen on.
func (*Vault) SetSMTPSSL ¶
SetSMTPSSL sets whether the SMTP server should use SSL.
func (*Vault) SetShowAllMail ¶
SetShowAllMail sets whether the bridge should show the All Mail folder.
func (*Vault) SetUpdateChannel ¶
SetUpdateChannel sets the update channel.
func (*Vault) SetUpdateRollout ¶
SetUpdateRollout sets the update rollout.