gowaku

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 3 Imported by: 0

README

Mobile

Package mobile implements gomobile bindings for go-waku.

Usage

For properly using this package, please refer to Makefile in the root of go-waku directory.

To manually build library, run following commands:

iOS
gomobile init
gomobile bind -v -target=ios -ldflags="-s -w" github.com/waku-org/go-waku/mobile

This will produce gowaku.framework file in the current directory, which can be used in iOS project.

Android
export ANDROID_NDK_HOME=/path/to/android/ndk
export ANDROID_HOME=/path/to/android/sdk/
gomobile init
gomobile bind -v -target=android -ldflags="-s -w" github.com/waku-org/go-waku/mobile

This will generate gowaku.aar file in the current dir.

Notes

See https://github.com/golang/go/wiki/Mobile for more information on gomobile usage.

Documentation

Overview

Package gowaku implements gomobile bindings for go-waku. Contains a set of functions that are exported when go-waku is exported as libraries for mobile devices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPeer

func AddPeer(address string, protocolID string) string

AddPeer adds a node multiaddress and protocol to the wakunode peerstore

func Connect

func Connect(address string, ms int) string

Connect is used to connect to a peer at multiaddress. if ms > 0, cancel the function execution if it takes longer than N milliseconds

func ConnectPeerID

func ConnectPeerID(peerID string, ms int) string

ConnectPeerID is usedd to connect to a known peer by peerID. if ms > 0, cancel the function execution if it takes longer than N milliseconds

func ContentTopic

func ContentTopic(applicationName string, applicationVersion string, contentTopicName string, encoding string) string

ContentTopic creates a content topic string according to RFC 23

func DNSDiscovery

func DNSDiscovery(url string, nameserver string, ms int) string

DNSDiscovery executes dns discovery on an url and returns a list of nodes

func DecodeAsymmetric

func DecodeAsymmetric(messageJSON string, privateKey string) string

DecodeAsymmetric decodes a waku message using a secp256k1 private key. The key must be a hex encoded string with "0x" prefix

func DecodeSymmetric

func DecodeSymmetric(messageJSON string, symmetricKey string) string

DecodeSymmetric decodes a waku message using a 32 bytes symmetric key. The key must be a hex encoded string with "0x" prefix

func DefaultPubsubTopic

func DefaultPubsubTopic() string

DefaultPubsubTopic returns the default pubsub topic used in waku2: /waku/2/default-waku/proto

func Disconnect

func Disconnect(peerID string) string

Disconnect closes a connection to a known peer by peerID

func EncodeAsymmetric

func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey string) string

EncodeAsymmetric encodes a waku message using a secp256k1 public key. A secp256k1 private key can be used to optionally sign the message. The keys must be a hex encoded string with "0x" prefix

func EncodeSymmetric

func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey string) string

EncodeSymmetric encodes a waku message using a 32 bytes symmetric key. A secp256k1 private key can be used to optionally sign the message. The keys must be a hex encoded string with "0x" prefix

func FilterPing

func FilterPing(peerID string, ms int) string

FilterPing is used to determine if a peer has an active subscription

func FilterSubscribe

func FilterSubscribe(filterJSON string, peerID string, ms int) string

FilterSubscribe is used to create a subscription to a filter node to receive messages

func FilterUnsubscribe

func FilterUnsubscribe(filterJSON string, peerID string, ms int) string

FilterUnsubscribe is used to remove a filter criteria from an active subscription with a filter node

func FilterUnsubscribeAll

func FilterUnsubscribeAll(peerID string, ms int) string

FilterUnsubscribeAll is used to remove an active subscription to a peer. If no peerID is defined, it will stop all active filter subscriptions

func IsStarted

func IsStarted() string

IsStarted is used to determine is a node is started or not

func LegacyFilterSubscribe

func LegacyFilterSubscribe(filterJSON string, peerID string, ms int) string

LegacyFilterSubscribe is used to create a subscription to a filter node to receive messages Deprecated: Use FilterSubscribe instead

func LegacyFilterUnsubscribe

func LegacyFilterUnsubscribe(filterJSON string, ms int) string

LegacyFilterUnsubscribe is used to remove a filter criteria from an active subscription with a filter node Deprecated: Use FilterUnsubscribe or FilterUnsubscribeAll instead

func LightpushPublish

func LightpushPublish(messageJSON string, topic string, peerID string, ms int) string

LightpushPublish is used to publish a WakuMessage in a pubsub topic using Lightpush protocol

func ListenAddresses

func ListenAddresses() string

ListenAddresses returns the multiaddresses the wakunode is listening to

func NewNode

func NewNode(configJSON string) string

NewNode initializes a waku node. Receives a JSON string containing the configuration, and use default values for those config items not specified

func PeerCnt

func PeerCnt() string

PeerCnt returns the number of connected peers

func PeerID

func PeerID() string

PeerID is used to obtain the peer ID of the waku node

func Peers

func Peers() string

Peers retrieves the list of peers known by the waku node

func RelayEnoughPeers

func RelayEnoughPeers(topic string) string

RelayEnoughPeers determines if there are enough peers to publish a message on a topic

func RelayPublish

func RelayPublish(messageJSON string, topic string, ms int) string

RelayPublish publishes a message using waku relay and returns the message ID

func RelaySubscribe

func RelaySubscribe(topic string) string

RelaySubscribe subscribes to a WakuRelay topic.

func RelayTopics

func RelayTopics() string

RelayTopics returns a list of pubsub topics the node is subscribed to in WakuRelay

func RelayUnsubscribe

func RelayUnsubscribe(topic string) string

RelayUnsubscribe closes the pubsub subscription to a pubsub topic

func SetBootnodes

func SetBootnodes(bootnodes string) string

SetBootnodes is used to update the bootnodes receiving a JSON array of ENRs

func SetMobileSignalHandler added in v0.9.0

func SetMobileSignalHandler(handler SignalHandler)

SetMobileSignalHandler setup geth callback to notify about new signal used for gomobile builds nolint

func Start

func Start() string

Start starts the waku node

func StartDiscoveryV5

func StartDiscoveryV5() string

StartDiscoveryV5 starts discv5 discovery

func Stop

func Stop() string

Stop stops a waku node

func StopDiscoveryV5

func StopDiscoveryV5() string

StopDiscoveryV5 stops discv5 discovery

func StoreLocalQuery

func StoreLocalQuery(queryJSON string) string

StoreLocalQuery is used to retrieve historic messages stored in the localDB using waku store protocol.

func StoreQuery

func StoreQuery(queryJSON string, peerID string, ms int) string

StoreQuery is used to retrieve historic messages using waku store protocol.

Types

type SignalHandler added in v0.9.0

type SignalHandler interface {
	HandleSignal(string)
}

SignalHandler defines a minimal interface a signal handler needs to implement. nolint

Jump to

Keyboard shortcuts

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