oniontree

package module
v0.0.0-...-4686cbe Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrIdExists

type ErrIdExists struct {
	// contains filtered or unexported fields
}

func (*ErrIdExists) Error

func (e *ErrIdExists) Error() string

type ErrIdNotExists

type ErrIdNotExists struct {
	// contains filtered or unexported fields
}

func (*ErrIdNotExists) Error

func (e *ErrIdNotExists) Error() string

type ErrInvalidID

type ErrInvalidID struct {
	// contains filtered or unexported fields
}

func (*ErrInvalidID) Error

func (e *ErrInvalidID) Error() string

type ErrInvalidTagName

type ErrInvalidTagName struct {
	// contains filtered or unexported fields
}

func (*ErrInvalidTagName) Error

func (e *ErrInvalidTagName) Error() string

type ErrNotOnionTree

type ErrNotOnionTree struct {
	// contains filtered or unexported fields
}

func (*ErrNotOnionTree) Error

func (e *ErrNotOnionTree) Error() string

type ErrTagNotExists

type ErrTagNotExists struct {
	// contains filtered or unexported fields
}

func (*ErrTagNotExists) Error

func (e *ErrTagNotExists) Error() string

type OnionTree

type OnionTree struct {
	// contains filtered or unexported fields
}

func New

func New(dir string) *OnionTree

New returns initialized OnionTree structure. The function does not check if `dir` is a valid OnionTree repository.

func Open

func Open(dir string) (*OnionTree, error)

Open attempts to "open" `dir` as a valid OnionTree repository. The function fails if the `dir` is not a valid OnionTree repository.

func (OnionTree) AddService

func (o OnionTree) AddService(s *Service) error

Add adds a new service to the repository with data from `s`.

func (OnionTree) Dir

func (o OnionTree) Dir() string

func (OnionTree) GetService

func (o OnionTree) GetService(id string) (*Service, error)

GetService returns content of service `id`.

func (OnionTree) GetServiceBytes

func (o OnionTree) GetServiceBytes(id string) ([]byte, error)

GetServiceBytes returns raw bytes of service `id`.

func (OnionTree) Init

func (o OnionTree) Init() error

Init initializes empty repository.

func (OnionTree) ListServiceTags

func (o OnionTree) ListServiceTags(id string) ([]Tag, error)

ListServiceTags returns tags of service `id`. NOTICE: This function is very inefficient as it has to scale down the tagged directory recursively to find all symbolic links matching a pattern.

func (OnionTree) ListServices

func (o OnionTree) ListServices() ([]string, error)

ListServices returns a list of service IDs found in the repository.

func (OnionTree) ListServicesWithTag

func (o OnionTree) ListServicesWithTag(tag Tag) ([]string, error)

ListServicesWithTag returns a list of services tagged with `tag`.

func (OnionTree) ListTags

func (o OnionTree) ListTags() ([]Tag, error)

ListTags returns a list of tags found in the repository.

func (OnionTree) RemoveService

func (o OnionTree) RemoveService(id string) error

Remove removes a service `id` from the repository with all its tags.

func (OnionTree) TagService

func (o OnionTree) TagService(id string, tags []Tag) error

TagService adds tags `tags` to service `id`.

func (OnionTree) TaggedDir

func (o OnionTree) TaggedDir() string

func (OnionTree) UnsortedDir

func (o OnionTree) UnsortedDir() string

func (OnionTree) UntagService

func (o OnionTree) UntagService(id string, tags []Tag) error

UntagService removes tags `tags` from service `id`.

func (OnionTree) UpdateService

func (o OnionTree) UpdateService(s *Service) error

Update replaces existing service with new data from `s`.

type PublicKey

type PublicKey struct {
	ID          string `json:"id,omitempty" yaml:"id,omitempty"`
	UserID      string `json:"user_id,omitempty" yaml:"user_id,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty" yaml:"fingerprint,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Value       string `json:"value" yaml:"value"`
}

func NewPublicKey

func NewPublicKey(b []byte) (*PublicKey, error)

type PublicKeys

type PublicKeys []*PublicKey

The type implements openpgp.KeyRing interface.

func (PublicKeys) DecryptionKeys

func (pks PublicKeys) DecryptionKeys() []openpgp.Key

DecryptionKeys returns all private keys that are valid for decryption.

func (PublicKeys) KeysById

func (pks PublicKeys) KeysById(id uint64) []openpgp.Key

KeysById returns the set of keys that have the given key id.

func (PublicKeys) KeysByIdUsage

func (pks PublicKeys) KeysByIdUsage(id uint64, requiredUsage byte) []openpgp.Key

KeysByIdAndUsage returns the set of keys with the given id that also meet the key usage given by requiredUsage. The requiredUsage is expressed as the bitwise-OR of packet.KeyFlag* values.

type Service

type Service struct {
	Name        string     `json:"name" yaml:"name"`
	Description string     `json:"description,omitempty" yaml:"description,omitempty"`
	URLs        []string   `json:"urls" yaml:"urls"`
	PublicKeys  PublicKeys `json:"public_keys,omitempty" yaml:"public_keys,omitempty"`
	// contains filtered or unexported fields
}

func NewService

func NewService(id string) *Service

func (*Service) AddPublicKeys

func (s *Service) AddPublicKeys(publicKeys []*PublicKey) int

func (*Service) AddURLs

func (s *Service) AddURLs(urls []string) int

func (*Service) ID

func (s *Service) ID() string

func (*Service) SetPublicKeys

func (s *Service) SetPublicKeys(publicKeys []*PublicKey) int

func (*Service) SetURLs

func (s *Service) SetURLs(urls []string) int

func (*Service) Validate

func (s *Service) Validate() error

type Tag

type Tag string

func (Tag) String

func (t Tag) String() string

func (Tag) Validate

func (t Tag) Validate() error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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