hpsegreq

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownGroup = serrors.New("group not known to HPS")
	ErrNotReader    = serrors.New("peer is not a reader of this group")
)

Functions

func NewSegReqHandler

func NewSegReqHandler(fetcher Fetcher) infra.Handler

NewSegReqHandler returns a hidden path segment request handler

Types

type DefaultFetcher

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

DefaultFetcher fetches hidden path segments from database and remote HPS

func NewDefaultFetcher

func NewDefaultFetcher(groupInfo *GroupInfo, msger infra.Messenger,
	db hiddenpathdb.HiddenPathDB) *DefaultFetcher

NewDefaultFetcher creates a new DefaultFetcher

func (*DefaultFetcher) Fetch

func (f *DefaultFetcher) Fetch(ctx context.Context,
	req *path_mgmt.HPSegReq, peer *snet.Addr) ([]*path_mgmt.HPSegRecs, error)

Fetch fetches the hidden path segments either from DB or from a remote HPS

type Fetcher

type Fetcher interface {
	// Fetch fetches hidden path segments.
	// In case of local HPS the segments are fetched from the database,
	// otherwise segments are requested from a remote HPS
	Fetch(ctx context.Context,
		req *path_mgmt.HPSegReq, peer *snet.Addr) ([]*path_mgmt.HPSegRecs, error)
}

Fetcher is a fetcher for hidden path segments

type GroupInfo

type GroupInfo struct {
	// LocalIA is the local IA of the HPS.
	// In case a group contains this IA as Registry,
	// requests for that group can be resolved locally.
	LocalIA addr.IA
	// Groups contains all the groups known to a HPS
	Groups map[hiddenpath.GroupId]*hiddenpath.Group
}

GroupInfo holds all information about hidden path groups needed by the HPS throughout its life cycle

func (*GroupInfo) CheckIds

func (gi *GroupInfo) CheckIds(ids hiddenpath.GroupIdSet) error

CheckIds checks that the provided Ids are known to the HPS and that all Ids have at least one Registry.

func (*GroupInfo) GetRegistryMapping

func (gi *GroupInfo) GetRegistryMapping(ids hiddenpath.GroupIdSet) (
	map[addr.IA][]hiddenpath.GroupId, error)

GetRegistryMapping uses a greedy algorithm to approximate an optimal mapping from Registries to GroupIds such that all local Groups are mapped to the local Registry and the remaining Groups are mapped to a small number of remote Registries. The algorithm runs in O(Registries*Groups^2) and is at most ln(Groups)+1 times worse than an optimal solution.

Directories

Path Synopsis
Package mock_hpsegreq is a generated GoMock package.
Package mock_hpsegreq is a generated GoMock package.

Jump to

Keyboard shortcuts

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