Documentation ¶
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDigest(name string) ([sha256.Size]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func AssetString(name string) (string, error)
- func Bytes256(b []byte) [256]byte
- func Bytes32(b []byte) [32]byte
- func Digests() (map[string][sha256.Size]byte, error)
- func MustAsset(name string) []byte
- func MustAssetString(name string) string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.MembershipKeyPair, r.MembershipIndex, error)
- func ToRateLimitProof(msg *pb.WakuMessage) *r.RateLimitProof
- type MessageValidationResult
- type RegistrationEventHandler
- type RegistrationHandler
- type SpamHandler
- type WakuRLNRelay
- func (rln *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTime time.Time) error
- func (rln *WakuRLNRelay) HandleGroupUpdates(handler RegistrationEventHandler, errChan chan<- error)
- func (rln *WakuRLNRelay) HasDuplicate(msg *pb.WakuMessage) (bool, error)
- func (r *WakuRLNRelay) MembershipIndex() r.MembershipIndex
- func (r *WakuRLNRelay) MembershipKeyPair() r.MembershipKeyPair
- func (rln *WakuRLNRelay) Register(ctx context.Context) (*r.MembershipIndex, error)
- func (rln *WakuRLNRelay) Stop()
- func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time.Time) (MessageValidationResult, error)
Constants ¶
const AssetDebug = false
AssetDebug is true if the assets were built with the debug flag enabled.
const MAX_CLOCK_GAP_SECONDS = 20
the maximum clock difference between peers in seconds
const MAX_EPOCH_GAP = int64(MAX_CLOCK_GAP_SECONDS / r.EPOCH_UNIT_SECONDS)
maximum allowed gap between the epochs of messages' RateLimitProofs
Variables ¶
var MEMBERSHIP_FEE = big.NewInt(1000000000000000) // wei - 0.001 eth
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDigest ¶
AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetString ¶
AssetString returns the asset contents as a string (instead of a []byte).
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func MustAssetString ¶
MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory.
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively.
func StaticSetup ¶
func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.MembershipKeyPair, r.MembershipIndex, error)
func ToRateLimitProof ¶
func ToRateLimitProof(msg *pb.WakuMessage) *r.RateLimitProof
Types ¶
type MessageValidationResult ¶
type MessageValidationResult int
const ( MessageValidationResult_Unknown MessageValidationResult = iota MessageValidationResult_Valid MessageValidationResult_Invalid MessageValidationResult_Spam )
type RegistrationEventHandler ¶
type RegistrationEventHandler = func(pubkey r.IDCommitment, index r.MembershipIndex) error
the types of inputs to this handler matches the MemberRegistered event/proc defined in the MembershipContract interface
type RegistrationHandler ¶ added in v0.2.2
type RegistrationHandler = func(tx *types.Transaction)
type SpamHandler ¶
type SpamHandler = func(message *pb.WakuMessage) error
type WakuRLNRelay ¶
func RlnRelayDynamic ¶
func RlnRelayDynamic( ctx context.Context, relay *relay.WakuRelay, ethClientAddr string, ethAccountPrivateKey *ecdsa.PrivateKey, memContractAddr common.Address, memKeyPair *r.MembershipKeyPair, memIndex r.MembershipIndex, pubsubTopic string, contentTopic string, spamHandler SpamHandler, registrationHandler RegistrationHandler, log *zap.Logger, ) (*WakuRLNRelay, error)
func RlnRelayStatic ¶
func RlnRelayStatic( ctx context.Context, relay *relay.WakuRelay, group []r.IDCommitment, memKeyPair r.MembershipKeyPair, memIndex r.MembershipIndex, pubsubTopic string, contentTopic string, spamHandler SpamHandler, log *zap.Logger, ) (*WakuRLNRelay, error)
func (*WakuRLNRelay) AppendRLNProof ¶
func (rln *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTime time.Time) error
func (*WakuRLNRelay) HandleGroupUpdates ¶
func (rln *WakuRLNRelay) HandleGroupUpdates(handler RegistrationEventHandler, errChan chan<- error)
HandleGroupUpdates mounts the supplied handler for the registration events emitting from the membership contract It connects to the eth client, subscribes to the `MemberRegistered` event emitted from the `MembershipContract` and collects all the events, for every received event, it calls the `handler`
func (*WakuRLNRelay) HasDuplicate ¶
func (rln *WakuRLNRelay) HasDuplicate(msg *pb.WakuMessage) (bool, error)
func (*WakuRLNRelay) MembershipIndex ¶
func (r *WakuRLNRelay) MembershipIndex() r.MembershipIndex
func (*WakuRLNRelay) MembershipKeyPair ¶
func (r *WakuRLNRelay) MembershipKeyPair() r.MembershipKeyPair
func (*WakuRLNRelay) Register ¶
func (rln *WakuRLNRelay) Register(ctx context.Context) (*r.MembershipIndex, error)
Register registers the public key of the rlnPeer which is rlnPeer.membershipKeyPair.publicKey into the membership contract whose address is in rlnPeer.membershipContractAddress
func (*WakuRLNRelay) Stop ¶
func (rln *WakuRLNRelay) Stop()
func (*WakuRLNRelay) ValidateMessage ¶
func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time.Time) (MessageValidationResult, error)