routing

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const KeyTTL = 10 * time.Minute

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper interface {
	Run(ctx context.Context, id string) error
	Get() (*peer.AddrInfo, error)
}

func NewKubernetesBootstrapper

func NewKubernetesBootstrapper(cs kubernetes.Interface, namespace, name string) Bootstrapper

type HTTPBootstrapper

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

func NewHTTPBootstrapper

func NewHTTPBootstrapper(addr, peer string) *HTTPBootstrapper

func (*HTTPBootstrapper) Get

func (h *HTTPBootstrapper) Get() (*peer.AddrInfo, error)

func (*HTTPBootstrapper) Run

func (h *HTTPBootstrapper) Run(ctx context.Context, id string) error

type KubernetesBootstrapper

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

func (*KubernetesBootstrapper) Get

func (*KubernetesBootstrapper) Run

type MockRouter

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

func NewMockRouter

func NewMockRouter(resolver map[string][]netip.AddrPort, self netip.AddrPort) *MockRouter

func (*MockRouter) Advertise

func (m *MockRouter) Advertise(ctx context.Context, keys []string) error

func (*MockRouter) LookupKey

func (m *MockRouter) LookupKey(key string) ([]netip.AddrPort, bool)

func (*MockRouter) Ready

func (m *MockRouter) Ready() (bool, error)

func (*MockRouter) Resolve

func (m *MockRouter) Resolve(ctx context.Context, key string, allowSelf bool, count int) (<-chan netip.AddrPort, error)

type P2PRouter

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

func NewP2PRouter

func NewP2PRouter(ctx context.Context, addr string, bootstrapper Bootstrapper, registryPortStr string, opts ...libp2p.Option) (*P2PRouter, error)

func (*P2PRouter) Advertise

func (r *P2PRouter) Advertise(ctx context.Context, keys []string) error

func (*P2PRouter) Close

func (r *P2PRouter) Close() error

func (*P2PRouter) Ready

func (r *P2PRouter) Ready() (bool, error)

func (*P2PRouter) Resolve

func (r *P2PRouter) Resolve(ctx context.Context, key string, allowSelf bool, count int) (<-chan netip.AddrPort, error)

func (*P2PRouter) Run

func (r *P2PRouter) Run(ctx context.Context) error

type Router

type Router interface {
	Ready() (bool, error)
	Resolve(ctx context.Context, key string, allowSelf bool, count int) (<-chan netip.AddrPort, error)
	Advertise(ctx context.Context, keys []string) error
}

Jump to

Keyboard shortcuts

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