whisper

package
v0.7.10-broken Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2014 License: LGPL-2.1-or-later Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPow = 50 * time.Millisecond
)
View Source
const DefaultTtl = 50 * time.Second

Variables

This section is empty.

Functions

func NewPeer

func NewPeer(host *Whisper, p *p2p.Peer, ws p2p.MsgReadWriter) *peer

func Topics

func Topics(data [][]byte) [][]byte

Returns a formatted topics byte slice. data: unformatted data (e.g., no hashes needed)

func TopicsFromString

func TopicsFromString(data []string) [][]byte

Types

type Envelope

type Envelope struct {
	Expiry uint32 // Whisper protocol specifies int32, really should be int64
	Ttl    uint32 // ^^^^^^
	Topics [][]byte
	Data   []byte
	Nonce  uint32
	// contains filtered or unexported fields
}

func NewEnvelope

func NewEnvelope(ttl time.Duration, topics [][]byte, data *Message) *Envelope

func NewEnvelopeFromReader

func NewEnvelopeFromReader(reader io.Reader) (*Envelope, error)

func (*Envelope) Hash

func (self *Envelope) Hash() Hash

func (*Envelope) Open

func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error)

func (*Envelope) RlpData

func (self *Envelope) RlpData() interface{}

func (*Envelope) Seal

func (self *Envelope) Seal(pow time.Duration)

type Filter

type Filter struct {
	To     *ecdsa.PrivateKey
	From   *ecdsa.PublicKey
	Topics [][]byte
	Fn     func(*Message)
}

type Hash

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

MOVE ME

var EmptyHash Hash

func H

func H(hash []byte) Hash

func HS

func HS(hash string) Hash

func (Hash) Compare

func (self Hash) Compare(other Hash) int

type Message

type Message struct {
	Flags     byte
	Signature []byte
	Payload   []byte
}

func NewMessage

func NewMessage(payload []byte) *Message

func (*Message) Bytes

func (self *Message) Bytes() []byte

func (*Message) Encrypt

func (self *Message) Encrypt(to *ecdsa.PublicKey) (err error)

func (*Message) Recover

func (self *Message) Recover() *ecdsa.PublicKey

func (*Message) Seal

func (self *Message) Seal(pow time.Duration, opts Opts) (*Envelope, error)

type MessageEvent

type MessageEvent struct {
	To      *ecdsa.PrivateKey
	From    *ecdsa.PublicKey
	Message *Message
}

type Opts

type Opts struct {
	From   *ecdsa.PrivateKey
	To     *ecdsa.PublicKey
	Ttl    time.Duration
	Topics [][]byte
}

type Whisper

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

func New

func New() *Whisper

func (*Whisper) HasIdentity

func (self *Whisper) HasIdentity(key *ecdsa.PrivateKey) bool

func (*Whisper) NewIdentity

func (self *Whisper) NewIdentity() *ecdsa.PrivateKey

func (*Whisper) Protocol

func (self *Whisper) Protocol() p2p.Protocol

func (*Whisper) Send

func (self *Whisper) Send(envelope *Envelope) error

func (*Whisper) Stop

func (self *Whisper) Stop()

func (*Whisper) Watch

func (self *Whisper) Watch(opts Filter) int

Jump to

Keyboard shortcuts

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