hostselector

package
v0.0.0-...-c0fde58 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildrenManager

type ChildrenManager interface {
	// TryAccept try to accept a new host as child
	// return result
	TryAccept(url string, host string) (bool, string)
}

ChildrenManager is the

func NewLimitedChildrenManager

func NewLimitedChildrenManager(limit int, expiration time.Duration) ChildrenManager

NewLimitedChildrenManager creator of limited children manager

type HostPicker

type HostPicker interface {
	// GetHost query url should fetch from which host
	// returns empty stream shows data should fetch from source
	// non-empty string present upstream p2p host
	GetHost(url string) string
	// PutHost stores query url matching source
	PutHost(url string, source string)
	// ResetHost clear up url matched source if exists
	ResetHost(url string)
}

HostPicker is an interface to keep p2p host information

func NewHostPicker

func NewHostPicker(roots []string, pool cache.FileCachePool) HostPicker

NewHostPicker creator of random host picker

Jump to

Keyboard shortcuts

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