Documentation ¶
Index ¶
- Variables
- func CreateFileRow(bk Backend, pairs types.TagPairs, filename string, plaintags []string) (*types.Row, error)
- func CreateJSONRow(bk Backend, pairs types.TagPairs, obj interface{}, plaintags []string) (*types.Row, error)
- func CreateRow(bk Backend, pairs types.TagPairs, rowData []byte, plaintags []string) (*types.Row, error)
- func CreateTag(backend Backend, plaintag string) (*types.TagPair, error)
- func CreateTagsFromPlain(backend Backend, plaintags []string, pairs types.TagPairs) (newPairs types.TagPairs, err error)
- func DeleteRows(bk Backend, pairs types.TagPairs, plaintags cryptag.PlainTags) error
- func DropboxConfigToMap(cfg DropboxConfig) map[string]interface{}
- func ListRowsFromPlainTags(bk Backend, pairs types.TagPairs, plaintags cryptag.PlainTags) (types.Rows, error)
- func NewTagPair(key *[32]byte, plaintag string) (*types.TagPair, error)
- func PopulateRowBeforeSave(backend Backend, row *types.Row, pairs types.TagPairs) (newPairs types.TagPairs, err error)
- func RowsFromPlainTags(bk Backend, pairs types.TagPairs, plaintags cryptag.PlainTags) (types.Rows, error)
- func UpdateKey(bk Backend, newKey interface{}) error
- func WebserverConfigToMap(cfg WebserverConfig) map[string]interface{}
- type Backend
- type Config
- type DropboxConfig
- type DropboxRemote
- func (db *DropboxRemote) AllTagPairs(oldPairs types.TagPairs) (types.TagPairs, error)
- func (db *DropboxRemote) DeleteRows(randTags cryptag.RandomTags) error
- func (db *DropboxRemote) GetTagCursor() string
- func (db *DropboxRemote) Key() *[32]byte
- func (db *DropboxRemote) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
- func (db *DropboxRemote) Name() string
- func (db *DropboxRemote) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
- func (db *DropboxRemote) SaveRow(row *types.Row) error
- func (db *DropboxRemote) SaveTagPair(pair *types.TagPair) error
- func (db *DropboxRemote) SetHTTPClient(c *http.Client)
- func (db *DropboxRemote) SetTagCursor(cursor string)
- func (db *DropboxRemote) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
- func (db *DropboxRemote) ToConfig() (*Config, error)
- func (db *DropboxRemote) UseTor() error
- type FileSystem
- func (fs *FileSystem) AllTagPairs(oldPairs types.TagPairs) (types.TagPairs, error)
- func (fs *FileSystem) DeleteRows(randTags cryptag.RandomTags) error
- func (fs *FileSystem) Key() *[32]byte
- func (fs *FileSystem) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
- func (fs *FileSystem) Name() string
- func (fs *FileSystem) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
- func (fs *FileSystem) SaveRow(row *types.Row) error
- func (fs *FileSystem) SaveTagPair(pair *types.TagPair) error
- func (fs *FileSystem) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
- func (fs *FileSystem) ToConfig() (*Config, error)
- type WebserverBackend
- func (wb *WebserverBackend) AllTagPairs(oldPairs types.TagPairs) (types.TagPairs, error)
- func (wb *WebserverBackend) DeleteRows(randtags cryptag.RandomTags) error
- func (wb *WebserverBackend) Key() *[32]byte
- func (wb *WebserverBackend) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
- func (wb *WebserverBackend) Name() string
- func (wb *WebserverBackend) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
- func (wb *WebserverBackend) SaveRow(row *types.Row) error
- func (wb *WebserverBackend) SaveTagPair(pair *types.TagPair) error
- func (wb *WebserverBackend) SetHTTPClient(client *http.Client)
- func (wb *WebserverBackend) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
- func (wb *WebserverBackend) ToConfig() (*Config, error)
- func (wb *WebserverBackend) UseTor() error
- type WebserverConfig
Constants ¶
This section is empty.
Variables ¶
var ( RANDOM_TAG_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789" RANDOM_TAG_LENGTH = 9 )
var (
ErrConfigExists = errors.New("Backend config already exists")
)
var (
HttpGetTimeout = 300 * time.Second
)
Functions ¶
func CreateFileRow ¶
func CreateJSONRow ¶
func CreateTagsFromPlain ¶
func DeleteRows ¶
func DropboxConfigToMap ¶
func DropboxConfigToMap(cfg DropboxConfig) map[string]interface{}
func ListRowsFromPlainTags ¶
func PopulateRowBeforeSave ¶
func RowsFromPlainTags ¶
func UpdateKey ¶
newKey can be of type *[32]byte, []byte (with length 32), or a string to be parsed with keyutil.Parse.
func WebserverConfigToMap ¶
func WebserverConfigToMap(cfg WebserverConfig) map[string]interface{}
Types ¶
type Backend ¶
type Backend interface { Name() string Key() *[32]byte AllTagPairs(oldPairs types.TagPairs) (types.TagPairs, error) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error) SaveTagPair(pair *types.TagPair) error ListRows(randtags cryptag.RandomTags) (types.Rows, error) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error) SaveRow(row *types.Row) error DeleteRows(randtags cryptag.RandomTags) error ToConfig() (*Config, error) }
type Config ¶
type Config struct { Name string New bool `json:"-"` Key *[32]byte Local bool DataPath string // Used by backend.FileSystem, other local backends Custom map[string]interface{} `json:",omitempty"` // Used by Dropbox, Webserver, other backends }
func (*Config) Canonicalize ¶
type DropboxConfig ¶
type DropboxConfig struct { AppKey string AppSecret string AccessToken string BasePath string // e.g., "/cryptag_folder_in_dropbox_root" }
func DropboxConfigFromMap ¶
func DropboxConfigFromMap(m map[string]interface{}) (DropboxConfig, error)
func (*DropboxConfig) Valid ¶
func (dc *DropboxConfig) Valid() error
type DropboxRemote ¶
type DropboxRemote struct {
// contains filtered or unexported fields
}
func LoadDropboxRemote ¶
func LoadDropboxRemote(backendPath, backendName string) (*DropboxRemote, error)
func NewDropboxRemote ¶
func NewDropboxRemote(key []byte, name string, cfg DropboxConfig) (*DropboxRemote, error)
NewDropboxRemote will save this backend to disk if len(key) == 0 or name == "".
func (*DropboxRemote) AllTagPairs ¶
func (*DropboxRemote) DeleteRows ¶
func (db *DropboxRemote) DeleteRows(randTags cryptag.RandomTags) error
func (*DropboxRemote) GetTagCursor ¶
func (db *DropboxRemote) GetTagCursor() string
GetTagCursor gets the cursor for the remote tags directory used for incremental TagPair fetching.
func (*DropboxRemote) Key ¶
func (db *DropboxRemote) Key() *[32]byte
func (*DropboxRemote) ListRows ¶
func (db *DropboxRemote) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
func (*DropboxRemote) Name ¶
func (db *DropboxRemote) Name() string
func (*DropboxRemote) RowsFromRandomTags ¶
func (db *DropboxRemote) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
func (*DropboxRemote) SaveTagPair ¶
func (db *DropboxRemote) SaveTagPair(pair *types.TagPair) error
func (*DropboxRemote) SetHTTPClient ¶
func (db *DropboxRemote) SetHTTPClient(c *http.Client)
SetHTTPClient sets the underlying HTTP client used. Probably most useful for using a custom client that does proxied requests, perhaps through Tor.
func (*DropboxRemote) SetTagCursor ¶
func (db *DropboxRemote) SetTagCursor(cursor string)
SetTagCursor sets the cursor for the remote tags directory incremental TagPair fetching so it can be used for incremental TagPair fetching.
func (*DropboxRemote) TagPairsFromRandomTags ¶
func (db *DropboxRemote) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
func (*DropboxRemote) ToConfig ¶
func (db *DropboxRemote) ToConfig() (*Config, error)
func (*DropboxRemote) UseTor ¶
func (db *DropboxRemote) UseTor() error
UseTor sets db's HTTP client to one that uses Tor.
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
func LoadOrCreateFileSystem ¶
func LoadOrCreateFileSystem(backendPath, backendName string) (*FileSystem, error)
func NewFileSystem ¶
func NewFileSystem(conf *Config) (*FileSystem, error)
func (*FileSystem) AllTagPairs ¶
func (*FileSystem) DeleteRows ¶
func (fs *FileSystem) DeleteRows(randTags cryptag.RandomTags) error
func (*FileSystem) Key ¶
func (fs *FileSystem) Key() *[32]byte
func (*FileSystem) ListRows ¶
func (fs *FileSystem) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
func (*FileSystem) Name ¶
func (fs *FileSystem) Name() string
func (*FileSystem) RowsFromRandomTags ¶
func (fs *FileSystem) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
func (*FileSystem) SaveTagPair ¶
func (fs *FileSystem) SaveTagPair(pair *types.TagPair) error
func (*FileSystem) TagPairsFromRandomTags ¶
func (fs *FileSystem) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
func (*FileSystem) ToConfig ¶
func (fs *FileSystem) ToConfig() (*Config, error)
type WebserverBackend ¶
type WebserverBackend struct {
// contains filtered or unexported fields
}
func CreateWebserver ¶
func CreateWebserver(key []byte, backendName, baseURL, authToken string) (*WebserverBackend, error)
CreateWebserver is a high-level function that creates a new WebserverBackend and saves its config to disk. (Useful for config init and more.)
func LoadWebserverBackend ¶
func LoadWebserverBackend(backendPath, backendName string) (*WebserverBackend, error)
func NewWebserverBackend ¶
func NewWebserverBackend(key []byte, serverName, serverBaseUrl, authToken string) (*WebserverBackend, error)
func (*WebserverBackend) AllTagPairs ¶
func (*WebserverBackend) DeleteRows ¶
func (wb *WebserverBackend) DeleteRows(randtags cryptag.RandomTags) error
func (*WebserverBackend) Key ¶
func (wb *WebserverBackend) Key() *[32]byte
func (*WebserverBackend) ListRows ¶
func (wb *WebserverBackend) ListRows(randtags cryptag.RandomTags) (types.Rows, error)
func (*WebserverBackend) Name ¶
func (wb *WebserverBackend) Name() string
func (*WebserverBackend) RowsFromRandomTags ¶
func (wb *WebserverBackend) RowsFromRandomTags(randtags cryptag.RandomTags) (types.Rows, error)
func (*WebserverBackend) SaveTagPair ¶
func (wb *WebserverBackend) SaveTagPair(pair *types.TagPair) error
func (*WebserverBackend) SetHTTPClient ¶
func (wb *WebserverBackend) SetHTTPClient(client *http.Client)
SetHTTPClient sets the underlying HTTP client used. Useful for using a custom client that does proxied requests, perhaps through Tor.
func (*WebserverBackend) TagPairsFromRandomTags ¶
func (wb *WebserverBackend) TagPairsFromRandomTags(randtags cryptag.RandomTags) (types.TagPairs, error)
func (*WebserverBackend) ToConfig ¶
func (wb *WebserverBackend) ToConfig() (*Config, error)
func (*WebserverBackend) UseTor ¶
func (wb *WebserverBackend) UseTor() error
UseTor sets wb's HTTP client to one that uses Tor and records that Tor should be used.
type WebserverConfig ¶
func WebserverConfigFromMap ¶
func WebserverConfigFromMap(m map[string]interface{}) (WebserverConfig, error)
func (*WebserverConfig) Valid ¶
func (wc *WebserverConfig) Valid() error