Versions in this module Expand all Collapse all v0 v0.1.3 Aug 26, 2019 v0.1.2 Apr 9, 2019 v0.1.0 Feb 23, 2019 Changes in this version + const DigestEmptyTar + const SHA256 + var ErrInvalidPeerIDLength = errors.New("peer id has invalid length") + func NamespaceFixture() string + func PieceHash() hash.Hash32 + func TagFixture() string + func ValidateSHA256(s string) error + type BlobFixture struct + Content []byte + Digest Digest + MetaInfo *MetaInfo + func CustomBlobFixture(content []byte, digest Digest, mi *MetaInfo) *BlobFixture + func NewBlobFixture() *BlobFixture + func SizedBlobFixture(size uint64, pieceLength uint64) *BlobFixture + func (f *BlobFixture) Info() *BlobInfo + func (f *BlobFixture) Length() int64 + type BlobInfo struct + Size int64 + func NewBlobInfo(size int64) *BlobInfo + type Digest struct + func DigestFixture() Digest + func DigestListFixture(n int) []Digest + func NewSHA256DigestFromHex(hex string) (Digest, error) + func ParseSHA256Digest(raw string) (Digest, error) + func (d *Digest) Scan(src interface{}) error + func (d *Digest) UnmarshalJSON(str []byte) error + func (d Digest) Algo() string + func (d Digest) Hex() string + func (d Digest) MarshalJSON() ([]byte, error) + func (d Digest) ShardID() string + func (d Digest) String() string + func (d Digest) Value() (driver.Value, error) + type DigestList []Digest + func (l *DigestList) Scan(src interface{}) error + func (l DigestList) Value() (driver.Value, error) + type Digester struct + func NewDigester() *Digester + func (d *Digester) Digest() Digest + func (d Digester) FromBytes(p []byte) (Digest, error) + func (d Digester) FromReader(rd io.Reader) (Digest, error) + func (d Digester) Tee(r io.Reader) io.Reader + type InfoHash [20]byte + func InfoHashFixture() InfoHash + func NewInfoHashFromBytes(b []byte) InfoHash + func NewInfoHashFromHex(s string) (InfoHash, error) + func (h InfoHash) Bytes() []byte + func (h InfoHash) Hex() string + func (h InfoHash) String() string + type MetaInfo struct + func DeserializeMetaInfo(data []byte) (*MetaInfo, error) + func MetaInfoFixture() *MetaInfo + func NewMetaInfo(d Digest, blob io.Reader, pieceLength int64) (*MetaInfo, error) + func (mi *MetaInfo) Digest() Digest + func (mi *MetaInfo) GetPieceLength(i int) int64 + func (mi *MetaInfo) GetPieceSum(i int) uint32 + func (mi *MetaInfo) InfoHash() InfoHash + func (mi *MetaInfo) Length() int64 + func (mi *MetaInfo) NumPieces() int + func (mi *MetaInfo) PieceLength() int64 + func (mi *MetaInfo) Serialize() ([]byte, error) + type PeerContext struct + Cluster string + IP string + Origin bool + PeerID PeerID + Port int + Zone string + func NewPeerContext(f PeerIDFactory, zone, cluster, ip string, port int, origin bool) (PeerContext, error) + func OriginContextFixture() PeerContext + func PeerContextFixture() PeerContext + type PeerID [20]byte + func HashedPeerID(s string) (PeerID, error) + func NewPeerID(s string) (PeerID, error) + func PeerIDFixture() PeerID + func RandomPeerID() (PeerID, error) + func (p PeerID) LessThan(o PeerID) bool + func (p PeerID) String() string + type PeerIDFactory string + const AddrHashPeerIDFactory + const RandomPeerIDFactory + func (f PeerIDFactory) GeneratePeerID(ip string, port int) (PeerID, error) + type PeerInfo struct + Complete bool + IP string + Origin bool + PeerID PeerID + Port int + func NewPeerInfo(peerID PeerID, ip string, port int, origin bool, complete bool) *PeerInfo + func OriginPeerInfoFixture() *PeerInfo + func PeerInfoFixture() *PeerInfo + func PeerInfoFromContext(pctx PeerContext, complete bool) *PeerInfo + func SortedByPeerID(peers []*PeerInfo) []*PeerInfo + type PeerInfos []*PeerInfo + func (s PeerInfos) Len() int + func (s PeerInfos) Swap(i, j int) + type PeersByPeerID struct + func (s PeersByPeerID) Less(i, j int) bool