tavern

package
v0.0.0-...-e836074 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerEntry

type PeerEntry struct {
	Peer      *tavernv1.Peer
	Timestamp time.Time
}

type PeerIndex

type PeerIndex struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*PeerIndex) Clean

func (index *PeerIndex) Clean(hash []byte, timeout int64)

func (*PeerIndex) Find

func (index *PeerIndex) Find(hash []byte) ([]PeerEntry, bool)

func (*PeerIndex) Seed

func (index *PeerIndex) Seed(hash []byte, peer *tavernv1.Peer)

type Tavern

type Tavern struct {
	AnnounceInterval int64

	tavernv1connect.UnimplementedTavernServiceHandler
	// contains filtered or unexported fields
}

func New

func New(interval int64) *Tavern

func (*Tavern) Announce

func (tavern *Tavern) Announce(ctx context.Context, req *connect.Request[tavernv1.AnnounceRequest]) (*connect.Response[tavernv1.AnnounceResponse], error)

Announce a new peer for the given hash.

func (*Tavern) List

func (tavern *Tavern) List(ctx context.Context, req *connect.Request[tavernv1.ListRequest]) (*connect.Response[tavernv1.ListResponse], error)

List all announced peers for the given hash.

func (*Tavern) ListenAndServe

func (tavern *Tavern) ListenAndServe(addr string, tlsConfig *tls.Config) error

Jump to

Keyboard shortcuts

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