reservation

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReservationService = NewRemoteRepository(baseReservedUrl, nil)

Functions

This section is empty.

Types

type MockRepository

type MockRepository struct {
	Entries []domainEntry
	DNS     map[string]string
}

MockRepository is a simple repository that allows you to easily mock reserved accounts and organisations

func NewMockRepository

func NewMockRepository() *MockRepository

func (*MockRepository) AddDNS

func (m *MockRepository) AddDNS(domain, value string)

Adds a DNS entry so we can verify

func (*MockRepository) AddEntry

func (m *MockRepository) AddEntry(h hash.Hash, domains []string)

Adds a new entry to the mock reservations

func (*MockRepository) GetDomains

func (m *MockRepository) GetDomains(h hash.Hash) ([]string, error)

GetDomains will return the domains for the given reserved hash, or empty slice when not reserved

func (*MockRepository) IsReserved

func (m *MockRepository) IsReserved(h hash.Hash) (bool, error)

IsReserved will return true when the hash is a reserved hash

func (*MockRepository) IsValidated

func (m *MockRepository) IsValidated(h hash.Hash, pk *bmcrypto.PubKey) (bool, error)

IsValidated will check if a hash has a DNS entry with the correct value

type RemoteRepository

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

RemoteRepository allows you to fetch reservations from a remote server (the keyserver)

func (RemoteRepository) GetDomains

func (r RemoteRepository) GetDomains(h hash.Hash) ([]string, error)

GetDomains will return the domains for the given reserved hash, or empty slice when not reserved

func (RemoteRepository) IsReserved

func (r RemoteRepository) IsReserved(h hash.Hash) (bool, error)

IsReserved will return true when the hash is a reserved hash

func (RemoteRepository) IsValidated

func (r RemoteRepository) IsValidated(h hash.Hash, pk *bmcrypto.PubKey) (bool, error)

IsValidated will check if a hash has a DNS entry with the correct value

type ReservationRepository

type ReservationRepository interface {
	IsValidated(h hash.Hash, pk *bmcrypto.PubKey) (bool, error)
	IsReserved(h hash.Hash) (bool, error)
	GetDomains(h hash.Hash) ([]string, error)
}

func NewRemoteRepository

func NewRemoteRepository(baseUrl string, client *http.Client) ReservationRepository

NewRemoteRepository creates a new repository for fetching reservations through HTTP

Jump to

Keyboard shortcuts

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