Documentation ¶
Overview ¶
storage provides an embeddable database that bitmask uses to persist a series of values. For now, we store the following items in the database: - Introducer metadata. - Private bridges.
Index ¶
- Variables
- func MaybeGetBridgeByName(name string) (models.Bridge, error)
- func MaybeGetIntroducerURLByName(introducerName string) string
- func MaybeUpdateLastUsedForIntroducer(url string) error
- type Storage
- func (s *Storage) Close()
- func (s *Storage) DeleteBridge(id int, name string) error
- func (s *Storage) DeleteIntroducer(id int, name string) error
- func (s *Storage) GetBridgeByID(id int) (models.Bridge, error)
- func (s *Storage) GetBridgeByName(name string) (models.Bridge, error)
- func (s *Storage) GetBridgesByLocation(location string) ([]models.Bridge, error)
- func (s *Storage) GetBridgesByType(bridgeType string) ([]models.Bridge, error)
- func (s *Storage) GetIntroducerByID(id int) (models.Introducer, error)
- func (s *Storage) GetIntroducerByName(name string) (models.Introducer, error)
- func (s *Storage) ListBridges() ([]models.Bridge, error)
- func (s *Storage) ListIntroducers() ([]models.Introducer, error)
- func (s *Storage) NewBridge(name, bridgeType, location, raw string) error
- func (s *Storage) NewIntroducer(name, url string) error
Constants ¶
This section is empty.
Variables ¶
var AppName = "bitmask"
Functions ¶
func MaybeUpdateLastUsedForIntroducer ¶
MaybeUpdateLastUsedForIntroducer will attempt to update the LastUsed timestamp for the introducer that matches the passed URL.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
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 (*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 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) GetBridgeByID ¶
GetBridgeByID will return the Bridge with the given ID, if found, and an error.
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) GetIntroducerByID ¶
func (s *Storage) GetIntroducerByID(id int) (models.Introducer, error)
GetIntroducerByID will return the Introducer with the given ID, if found, and an error.
func (*Storage) GetIntroducerByName ¶
func (s *Storage) GetIntroducerByName(name string) (models.Introducer, error)
GetIntroducerByName will return the Introducer with the given Name, if found, and an error.
func (*Storage) ListBridges ¶
ListBridges returns an array of all the bridges.
func (*Storage) ListIntroducers ¶
func (s *Storage) ListIntroducers() ([]models.Introducer, error)
ListIntroducers returns an array of all the introducers
func (*Storage) NewIntroducer ¶
NewIntroducer creates a new Introducer from the name and URL.