Versions in this module Expand all Collapse all v1 v1.8.12 Jul 4, 2018 Changes in this version + const IsActiveHandshake + const IsActiveProtocol + var PingProtocol = &protocols.Spec + var PingTopic = ProtocolTopic(PingProtocol) + func NewPingProtocol(ping *Ping) *p2p.Protocol + func NewProtocolMsg(code uint64, msg interface{}) ([]byte, error) + func SetHandshakeController(pss *Pss, params *HandshakeParams) error + func ToP2pMsg(msg []byte) (p2p.Msg, error) + type API struct + func NewAPI(ps *Pss) *API + func (pssapi *API) BaseAddr() (PssAddress, error) + func (pssapi *API) GetAddress(topic Topic, asymmetric bool, key string) (PssAddress, error) + func (pssapi *API) GetAsymmetricAddressHint(topic Topic, pubkeyid string) (PssAddress, error) + func (pssapi *API) GetPeerAddress(pubkeyhex string, topic Topic) (PssAddress, error) + func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) + func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) + func (pssapi *API) GetSymmetricAddressHint(topic Topic, symkeyid string) (PssAddress, error) + func (pssapi *API) GetSymmetricKey(symkeyid string) (hexutil.Bytes, error) + func (pssapi *API) Receive(ctx context.Context, topic Topic) (*rpc.Subscription, error) + func (pssapi *API) SendAsym(pubkeyhex string, topic Topic, msg hexutil.Bytes) error + func (pssapi *API) SendSym(symkeyhex string, topic Topic, msg hexutil.Bytes) error + func (pssapi *API) SetPeerPublicKey(pubkey hexutil.Bytes, topic Topic, addr PssAddress) error + func (pssapi *API) StringToTopic(topicstring string) (Topic, error) + type APIMsg struct + Asymmetric bool + Key string + Msg hexutil.Bytes + type Handler func(msg []byte, p *p2p.Peer, asymmetric bool, keyid string) error + type HandshakeAPI struct + func (api *HandshakeAPI) AddHandshake(topic Topic) error + func (api *HandshakeAPI) GetHandshakeKeyCapacity(symkeyid string) (uint16, error) + func (api *HandshakeAPI) GetHandshakeKeys(pubkeyid string, topic Topic, in bool, out bool) (keys []string, err error) + func (api *HandshakeAPI) GetHandshakePublicKey(symkeyid string) (string, error) + func (api *HandshakeAPI) Handshake(pubkeyid string, topic Topic, sync bool, flush bool) (keys []string, err error) + func (api *HandshakeAPI) ReleaseHandshakeKey(pubkeyid string, topic Topic, symkeyid string, flush bool) (removed bool, err error) + func (api *HandshakeAPI) RemoveHandshake(topic *Topic) error + func (api *HandshakeAPI) SendSym(symkeyid string, topic Topic, msg hexutil.Bytes) (err error) + type HandshakeController struct + type HandshakeParams struct + SymKeyCapacity uint8 + SymKeyExpiryTimeout time.Duration + SymKeyRequestTimeout time.Duration + SymKeySendLimit uint16 + func NewHandshakeParams() *HandshakeParams + type Ping struct + InC chan bool + OutC chan bool + Pong bool + type PingMsg struct + Created time.Time + Pong bool + type Protocol struct + Asymmetric bool + RWPoolMu sync.Mutex + Symmetric bool + func RegisterProtocol(ps *Pss, topic *Topic, spec *protocols.Spec, targetprotocol *p2p.Protocol, ...) (*Protocol, error) + func (p *Protocol) AddPeer(peer *p2p.Peer, topic Topic, asymmetric bool, key string) (p2p.MsgReadWriter, error) + func (p *Protocol) Handle(msg []byte, peer *p2p.Peer, asymmetric bool, keyid string) error + func (p *Protocol) RemovePeer(asymmetric bool, key string) + type ProtocolMsg struct + Code uint64 + Payload []byte + ReceivedAt time.Time + Size uint32 + type ProtocolParams struct + Asymmetric bool + Symmetric bool + type Pss struct + func NewPss(k network.Overlay, params *PssParams) (*Pss, error) + func (p *Pss) APIs() []rpc.API + func (p *Pss) BaseAddr() []byte + func (p *Pss) GetPublickeyPeers(keyid string) (topic []Topic, address []PssAddress, err error) + func (p *Pss) GetSymmetricKey(symkeyid string) ([]byte, error) + func (p *Pss) Protocols() []p2p.Protocol + func (p *Pss) PublicKey() *ecdsa.PublicKey + func (p *Pss) Register(topic *Topic, handler Handler) func() + func (p *Pss) Run(peer *p2p.Peer, rw p2p.MsgReadWriter) error + func (p *Pss) SendAsym(pubkeyid string, topic Topic, msg []byte) error + func (p *Pss) SendRaw(address PssAddress, topic Topic, msg []byte) error + func (p *Pss) SendSym(symkeyid string, topic Topic, msg []byte) error + func (p *Pss) SetPeerPublicKey(pubkey *ecdsa.PublicKey, topic Topic, address *PssAddress) error + func (p *Pss) SetSymmetricKey(key []byte, topic Topic, address *PssAddress, addtocache bool) (string, error) + func (p *Pss) Start(srv *p2p.Server) error + func (p *Pss) Stop() error + func (p *Pss) String() string + type PssAddress []byte + func (a *PssAddress) UnmarshalJSON(input []byte) error + func (a PssAddress) MarshalJSON() ([]byte, error) + type PssMsg struct + Control []byte + Expire uint32 + Payload *whisper.Envelope + To []byte + func (msg *PssMsg) String() string + type PssParams struct + AllowRaw bool + CacheTTL time.Duration + MsgTTL time.Duration + SymKeyCacheCapacity int + func NewPssParams() *PssParams + func (params *PssParams) WithPrivateKey(privatekey *ecdsa.PrivateKey) *PssParams + type PssReadWriter struct + LastActive time.Time + func (prw *PssReadWriter) ReadMsg() (p2p.Msg, error) + func (prw *PssReadWriter) WriteMsg(msg p2p.Msg) error + type Topic whisper.TopicType + func BytesToTopic(b []byte) Topic + func ProtocolTopic(spec *protocols.Spec) Topic + func (t *Topic) String() string + func (t *Topic) UnmarshalJSON(input []byte) error + func (t Topic) MarshalJSON() (b []byte, err error)