Documentation ¶
Index ¶
- Constants
- Variables
- func InitAppStorage() error
- func InitAppStorageWith(store Store)
- type CompareBridge
- type CompareIntroducer
- type DBStore
- func (s *DBStore) Clear() error
- func (s *DBStore) Close() error
- func (s *DBStore) Contains(key string) (bool, error)
- func (s *DBStore) GetBoolean(key string) bool
- func (s *DBStore) GetBooleanWithDefault(key string, value bool) bool
- func (s *DBStore) GetByteArray(key string) []byte
- func (s *DBStore) GetByteArrayWithDefault(key string, value []byte) []byte
- func (s *DBStore) GetInt(key string) int
- func (s *DBStore) GetIntWithDefault(key string, value int) int
- func (s *DBStore) GetLong(key string) int64
- func (s *DBStore) GetLongWithDefault(key string, value int64) int64
- func (s *DBStore) GetString(key string) string
- func (s *DBStore) GetStringWithDefault(key string, value string) string
- func (s *DBStore) Open() error
- func (s *DBStore) Remove(key string) error
- func (s *DBStore) SetBoolean(key string, value bool)
- func (s *DBStore) SetByteArray(key string, value []byte)
- func (s *DBStore) SetInt(key string, value int)
- func (s *DBStore) SetLong(key string, value int64)
- func (s *DBStore) SetString(key string, value string)
- type Storage
- func (s *Storage) AddIntroducer(intro *introducer.Introducer) error
- func (s *Storage) Close()
- func (s *Storage) DeleteBridge(name string) error
- func (s *Storage) DeleteIntroducer(fqdn string) error
- func (s *Storage) GetBridgeByName(name string) (*bridge.Bridge, error)
- func (s *Storage) GetBridgesByLocation(location string) ([]bridge.Bridge, error)
- func (s *Storage) GetBridgesByType(bridgeType string) ([]bridge.Bridge, error)
- func (s *Storage) GetFallbackCountryCode() string
- func (s *Storage) GetIntroducerByFQDN(fqdn string) (*introducer.Introducer, error)
- func (s *Storage) ListBridges() ([]bridge.Bridge, error)
- func (s *Storage) ListIntroducers() ([]introducer.Introducer, error)
- func (s *Storage) NewBridge(name, bridgeType, location, raw string) error
- func (s *Storage) SaveFallbackCountryCode(cc string)
- type Store
Constants ¶
const ( INTRODUCER = "INTRODUCER" BRIDGE = "BRIDGE" COUNTRYCODE = "COUNTRYCODE" )
Variables ¶
var AppName = "bitmask"
Functions ¶
Types ¶
type CompareBridge ¶
CompareBridge is a function type for the comparison of bridges
type CompareIntroducer ¶
type CompareIntroducer func(introducer introducer.Introducer) bool
CompareIntroducer is a function type for the comparison of introducers
type DBStore ¶
type DBStore struct { Store // contains filtered or unexported fields }
func (*DBStore) GetBooleanWithDefault ¶
func (*DBStore) GetByteArrayWithDefault ¶
func (*DBStore) GetLongWithDefault ¶
func (*DBStore) GetStringWithDefault ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func GetStorage ¶
GetStorage returns an initialized storage instance if the global appStorage was initialized it has precedence
func NewStorage ¶
NewStorage initializes a new storage with a given path. `NewStorageWithDefaultDir` should be preferred to initialize a storage, since it will try to pick a default path.
func NewStorageWithDefaultDir ¶
NewStoreageWithDefaultDir initializes a storage struct with a storm DB and looks up the correct default paths for Linux, MacOS and Windows. Don't call this method in context of mobile app development
func NewStorageWithStore ¶
NewStorageWithStore initializes the storage struct with a custom store. This can be used to implement custom storage adapters e.g. for different database types
func (*Storage) AddIntroducer ¶
func (s *Storage) AddIntroducer(intro *introducer.Introducer) error
Add new introducer to storage. Before, delete all existing introducers with the same fqdn
func (*Storage) DeleteBridge ¶
DeleteBridge accepts a name and an ID. If you want to delete by name, pass 0 as the ID; if you want to delete by ID, pass the empty string as name.
func (*Storage) DeleteIntroducer ¶
DeleteIntroducer deletes all introducers for a given fqdn.
func (*Storage) GetBridgeByName ¶
GetBridgeByName will return the Bridge with the given Name, if found, and an error.
func (*Storage) GetBridgesByLocation ¶
GetBridgesByLocation will return all Bridges with the given Location, if found, and an error.
func (*Storage) GetBridgesByType ¶
GetBridgesByType will return all Bridges with the given Type, if found, and an error.
func (*Storage) GetIntroducerByFQDN ¶
func (s *Storage) GetIntroducerByFQDN(fqdn string) (*introducer.Introducer, error)
GetIntroducerByFQDN returns the first introducer for a given fqdn.
func (*Storage) ListBridges ¶
ListBridges returns an array of all the bridges.
func (*Storage) ListIntroducers ¶
func (s *Storage) ListIntroducers() ([]introducer.Introducer, error)
ListIntroducers returns an array of all introducers
func (*Storage) NewBridge ¶
NewBridge creates a new Bridge from the passed parameters.
type Store ¶
type Store interface { // Key-Value Getters GetString(key string) string GetStringWithDefault(key string, value string) string GetBoolean(key string) bool GetBooleanWithDefault(key string, value bool) bool GetInt(key string) int GetIntWithDefault(key string, value int) int GetLong(key string) int64 GetLongWithDefault(key string, value int64) int64 GetByteArray(key string) []byte GetByteArrayWithDefault(key string, value []byte) []byte // Key-Value Setters SetString(key string, value string) SetBoolean(key string, value bool) SetInt(key string, value int) SetLong(key string, value int64) SetByteArray(key string, value []byte) Open() error Close() error Contains(key string) (bool, error) Remove(key string) error Clear() error }