Documentation ¶
Index ¶
- Variables
- func IDFromPublicKey(publicKey ed25519.PublicKey) uint64
- type PeerCopy
- type PeerDistance
- type Store
- func (s *Store) AddPeer(addrPort netip.AddrPort, isEdge bool) error
- func (s *Store) AuthChallengeSolved(addrPort netip.AddrPort)
- func (s *Store) CountActive() int
- func (s *Store) CreateAuthChallenge(addrPort netip.AddrPort) (auth.AuthChallenge, error)
- func (s *Store) CurrentAuthChallengeAndPubKey(addrPort netip.AddrPort) (auth.AuthChallenge, ed25519.PublicKey, error)
- func (s *Store) Edges() []PeerCopy
- func (s *Store) IsEdge(addrPort netip.AddrPort) bool
- func (s *Store) ListActive(exclude *netip.AddrPort) []PeerCopy
- func (s *Store) ListAll() []PeerCopy
- func (s *Store) RandPeers(limit int, exclude *netip.AddrPort) []PeerCopy
- func (s *Store) SetPeerUsedSpaceAndCapacity(addrPort netip.AddrPort, usedSpace, capacity int64) error
- func (s *Store) SetPublicKeyAndID(addrPort netip.AddrPort, publicKey ed25519.PublicKey) error
- func (s *Store) TotalUsedSpaceAndCapacity() (usedSpace, capacity uint64)
- type StoreCfg
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPeerNotFound = errors.New("peer not found")
Functions ¶
func IDFromPublicKey ¶ added in v0.0.51
Returns the first 8 bytes of the public key
Types ¶
type PeerDistance ¶ added in v0.0.51
func SortPeersByDistance ¶ added in v0.0.51
func SortPeersByDistance(target uint64, peers []PeerCopy) []PeerDistance
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AuthChallengeSolved ¶ added in v0.0.51
func (*Store) CountActive ¶ added in v0.0.51
func (*Store) CreateAuthChallenge ¶ added in v0.0.51
func (*Store) CurrentAuthChallengeAndPubKey ¶ added in v0.0.51
func (*Store) ListActive ¶ added in v0.0.51
func (*Store) RandPeers ¶
For such a simple problem, I found it surprisingly tough to make an efficient implementation.
func (*Store) SetPeerUsedSpaceAndCapacity ¶ added in v0.0.51
func (*Store) SetPublicKeyAndID ¶ added in v0.0.51
func (*Store) TotalUsedSpaceAndCapacity ¶ added in v0.0.51
Currently this is flawed, as a peer can lie about their resources. Maybe remove this entirely, or set bounds for acceptable figures. The larger the network, the more accurate this becomes.
Click to show internal directories.
Click to hide internal directories.