id

package
v0.0.0-...-66b3d1b Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2015 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Id

type Id struct {
	Priv PrivKey

	Pub PubKey

	Psk PreSharedKey

	// This is automatically generated from Psk. It must be 20 bytes long
	Infohash []byte
	// contains filtered or unexported fields
}

The ID structure represents all the information a peer needs to know to be able to participate in a swarm sharing a given directory.

IDs start from the highest privileged type: a peer handling such an ID has the ability to write content to the folder, along with reading and storing its content. Its human-intelligible value can be retrieved from WriteReadStoreID

When derived once, the new ID now has lost the ability to write, but can still read and store content. Its human-intelligible value can be retrieved from ReadStoreID.

When derived a second time, the new ID can only store content; it cannot read it (because the actual content is encrypted). The corresponding value is StoreID.

Finally, when derived a third time, we get a infohash like the Bittorrent ones, that is used to find peers.

func New

func New() (Id, error)

func NewFromString

func NewFromString(in string) (id Id, err error)

func (Id) CanRead

func (id Id) CanRead() bool

func (Id) CanWrite

func (id Id) CanWrite() bool

func (Id) RS

func (id Id) RS() string

func (Id) S

func (id Id) S() string

func (Id) WRS

func (id Id) WRS() string

type PreSharedKey

type PreSharedKey [32]byte

type PrivKey

type PrivKey [ed.PrivateKeySize]byte

type PubKey

type PubKey [ed.PublicKeySize]byte

type Role

type Role byte
var (
	ROLE_WRITEREADSTORE Role = 0x1
	ROLE_READSTORE      Role = 0x2
	ROLE_STORE          Role = 0x4
)

Jump to

Keyboard shortcuts

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