resolve

package
v0.0.0-...-1f0a743 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainRepository

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

ChainRepository holds a list of multiple repositories which can all be tried to resolve addresses and keys

func NewChainRepository

func NewChainRepository() *ChainRepository

NewChainRepository Return a new chain repository

func (*ChainRepository) Add

func (r *ChainRepository) Add(repo Repository) error

Add a new repository to the chain

func (*ChainRepository) Resolve

func (r *ChainRepository) Resolve(addr address.HashAddress) (*Info, error)

Resolve an address through the chained repos

func (*ChainRepository) Upload

func (r *ChainRepository) Upload(addr address.HashAddress, pubKey, address, signature string) error

Upload public key through the chained repos

type Info

type Info struct {
	Hash      string `json:"hash"`
	PublicKey string `json:"public_key"`
	Address   string `json:"address"`
}

Info is a structure returned by the external resolver system

func (*Info) IsLocal

func (info *Info) IsLocal() bool

IsLocal returns true when the resolve address of the info is our own server address

type KeyDownload

type KeyDownload struct {
	Hash      string `json:"hash"`
	PublicKey string `json:"public_key"`
	Address   string `json:"address"`
}

KeyDownload is a JSON structure we download from a resolver server

type KeyUpload

type KeyUpload struct {
	PublicKey string `json:"public_key"`
	Address   string `json:"address"`
	Signature string `json:"signature"`
}

KeyUpload is a JSON structure we upload to a resolver server

type Repository

type Repository interface {
	Resolve(addr address.HashAddress) (*Info, error)
	Upload(addr address.HashAddress, pubKey, resolveAddress, signature string) error
}

Repository is the interface to manage address resolving

func NewDHTRepository

func NewDHTRepository() Repository

NewDHTRepository generates a new DHT repository

func NewLocalRepository

func NewLocalRepository(s *account.Service) Repository

NewLocalRepository intializes a local repository

func NewRemoteRepository

func NewRemoteRepository(baseURL string) Repository

NewRemoteRepository creates new remote resolve repository

type Service

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

Service represents a resolver service tied to a specific repository

func KeyRetrievalService

func KeyRetrievalService(repo Repository) *Service

KeyRetrievalService initialises a key retrieval service.

func (*Service) Resolve

func (s *Service) Resolve(addr address.HashAddress) (*Info, error)

Resolve resolves an address.

func (*Service) UploadInfo

func (s *Service) UploadInfo(info account.Info, resolveAddress string) error

UploadInfo uploads resolve information to a service.

Jump to

Keyboard shortcuts

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