mirror of https://github.com/logos-co/wadoku.git
first commit
This commit is contained in:
commit
fc71d71005
|
@ -0,0 +1,6 @@
|
|||
# wadoku
|
||||
This repo houses the code for initial runs to assess overhead of running waku nodes on bare metal, docker or kurtosis. The waku nodes are specifically chosen to be non-full nodes to minimise protocol cross talk.
|
||||
|
||||
Bare metal run is done, docker run is done. kurtosis run is more or less done. Will run some sanity check runs, and add the plots soonish .
|
||||
|
||||
the `run_waku.sh' takes 3 options, metal | docker | kurtosis, for each type of runs. From build to run to collecting data, everything is automated. Plots will be automated as well.
|
|
@ -0,0 +1,185 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage(){
|
||||
echo "Usage: ./run.sh <metal | docker | kurtosis>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
filtr="filter"
|
||||
lpush="lightpush"
|
||||
|
||||
prefix="waku"
|
||||
docker_op_dir="/go/bin/out"
|
||||
enclave="waku-enclave"
|
||||
|
||||
content_topic="80fc1f6b30b63bdd0a65df833f1da3fa"
|
||||
duration="1000s"
|
||||
iat="300ms"
|
||||
|
||||
sleep_time=5
|
||||
|
||||
build_metal() {
|
||||
parent=$(pwd)
|
||||
cd waku/$filtr
|
||||
make
|
||||
cd ..
|
||||
cd $lpush
|
||||
make
|
||||
cd $parent
|
||||
}
|
||||
|
||||
build_docker() {
|
||||
parent=$(pwd)
|
||||
cd waku/$filtr
|
||||
make docker
|
||||
cd ..
|
||||
cd $lpush
|
||||
make docker
|
||||
cd $parent
|
||||
wait
|
||||
}
|
||||
|
||||
start() {
|
||||
echo "\t\t.........................."
|
||||
echo "\t\tBEGINNING THE $1 RUN..."
|
||||
echo "\t\t.........................."
|
||||
}
|
||||
|
||||
end() {
|
||||
echo "\t\t $1 RUN DONE..."
|
||||
}
|
||||
|
||||
metal_run() {
|
||||
parent=$(pwd)
|
||||
time="$(\date +"%Y-%m-%d-%Hh%Mm%Ss")"
|
||||
FTDIR="$(pwd)/data/metal/$time"
|
||||
LPDIR="$(pwd)/data/metal/$time"
|
||||
|
||||
cd waku/$filtr
|
||||
[ -d $FTDIR ] || mkdir -p $FTDIR
|
||||
ofname="$FTDIR/$filtr.out"
|
||||
#echo $ofname
|
||||
echo -n "starting $filtr... $pwd "
|
||||
./$prefix-$filtr -o $ofname -d $duration -i $iat > $FTDIR/$filtr.log &
|
||||
echo " done"
|
||||
cd ..
|
||||
cd lightpush
|
||||
sleep $sleep_time
|
||||
[ -d $LPDIR ] || mkdir -p $LPDIR
|
||||
ofname="$LPDIR/$lpush.out"
|
||||
#echo $ofnameelapsed
|
||||
echo -n "starting $lpush... "
|
||||
./$prefix-$lpush -o $ofname -d $duration -i $iat > $LPDIR/$lpush.log &
|
||||
echo "done"
|
||||
cd $parent
|
||||
echo "$(date): Waiting for the metal run to finish in $duration"
|
||||
wait
|
||||
}
|
||||
|
||||
|
||||
docker_run() {
|
||||
parent=$(pwd)
|
||||
time="$(\date +"%Y-%m-%d-%Hh%Mm%Ss")"
|
||||
FTDIR="$(pwd)/data/docker/$time"
|
||||
LPDIR="$(pwd)/data/docker/$time"
|
||||
|
||||
[ -d $FTDIR ] || mkdir -p $FTDIR
|
||||
ofname="$FTDIR/$filtr.out"
|
||||
echo "docker run $filtr $ofname"
|
||||
|
||||
docker rm $prefix-$filtr
|
||||
echo "(docker run --name "$prefix-$filtr" "$prefix-$filtr:alpha" -o /go/bin/out/$filtr.out -d $duration -i $iat > $FTDIR/$filtr.log)"
|
||||
docker run --name "$prefix-$filtr" "$prefix-$filtr:alpha" -o /go/bin/out/$filtr.out -d $duration -i $iat > $FTDIR/$filtr.log &
|
||||
echo "$prefix-$filtr is running as $prefix-$filtr"
|
||||
sleep $sleep_time
|
||||
# docker run '$prefix-$filtr:alpha' -o /go/bin/out/$filtr.out -d $duration -i $iat > $FTDIR/$filtr.log
|
||||
#filtr_cid="$(docker container ls | grep '$prefix-$filtr' | awk '{print $1}')"
|
||||
#docker run --mount type=bind,source="$FTDIR",target=/go/bin/out "$filtr:alpha" -o /go/bin/out/$filtr.out -d $duration -i $iat > $FTDIR/$filtr.log &
|
||||
# docker run -d --entry-point --mount type=bind,source="$(pwd)/FTDIR",target=/go/bin/out $filtr:alpha
|
||||
#./filter -o $ofname > filter.log &
|
||||
[ -d $LPDIR ] || mkdir -p $LPDIR
|
||||
ofname="$LPDIR/$lpush.out"
|
||||
echo "docker run $lpush $ofname"
|
||||
docker rm $prefix-$lpush
|
||||
docker run --name "$prefix-$lpush" "$prefix-$lpush:alpha" -o /go/bin/out/$lpush.out -d $duration -i $iat > $LPDIR/$lpush.log &
|
||||
echo "$prefix-$filtr is running as $prefix-$lpush"
|
||||
|
||||
# echo "(docker run '$prefix-$lpush:alpha' -o /go/bin/out/$lpush.out -d $duration -i $iat > $FTDIR/$filtr.log)"
|
||||
# docker run '$prefix-$lpush:alpha' -o /go/bin/out/$lpush.out -d $duration -i $iat > $FTDIR/$filtr.log
|
||||
|
||||
# sleep 5
|
||||
# lpush_cid="$(docker container ls | grep '$prefix-$filtr' | awk '{print $1}')"
|
||||
# echo "$prefix-$lpush is running as $lpush_cid"
|
||||
#docker run --mount type=bind,source="$LPDIR",target=/go/bin/out "$lpush:alpha" -o /go/bin/out/$lpush.out -d $duration -i $iat > $LPDIR/$lpush.log &
|
||||
cd $parent
|
||||
echo "$(date): Waiting for the docker run to finish in $duration"
|
||||
status_code="$(docker container wait $prefix-$filtr $prefix-$lpush)"
|
||||
echo "Status code of docker run: ${status_code}"
|
||||
echo "$(date): copying output files from docker"
|
||||
docker cp "$filtr_cid:/go/bin/out/$filtr.out" $FTDIR
|
||||
docker cp "$lpush_cid:/go/bin/out/$lpush.out" $LPDIR
|
||||
# docker cp "$lpush_cid:/go/bin/out" $LPDIR
|
||||
}
|
||||
|
||||
kurtosis_run() {
|
||||
parent=$(pwd)
|
||||
time="$(\date +"%Y-%m-%d-%Hh%Mm%Ss")"
|
||||
FTDIR="$(pwd)/data/kurtosis/$time"
|
||||
LPDIR="$(pwd)/data/kurtosis/$time"
|
||||
|
||||
[ -d $FTDIR ] || mkdir -p $FTDIR
|
||||
[ -d $LPDIR ] || mkdir -p $LPDIR
|
||||
cd waku
|
||||
kurtosis clean -a
|
||||
docker rm $prefix-$filtr
|
||||
docker rm $prefix-$lpush
|
||||
kurtosis run --enclave-id $enclave main.star '{"config":"github.com/0xFugue/wadoku/waku/config.json"}' > $FTDIR/kurtosis_output.log
|
||||
sleep 5
|
||||
filtr_suffix="$(kurtosis enclave inspect $enclave | grep $prefix-$filtr | cut -f 1 -d ' ')"
|
||||
lpush_suffix="$(kurtosis enclave inspect $enclave | grep $prefix-$lpush | cut -f 1 -d ' ')"
|
||||
filtr_cid="$enclave--user-service--$filtr_suffix"
|
||||
lpush_cid="$enclave--user-service--$lpush_suffix"
|
||||
echo "created $filtr_cid, $lpush_cid..."
|
||||
echo "$(date): Waiting for the kurtosis run to finish in $duration"
|
||||
status_code="$(docker container wait $filtr_cid $lpush_cid)"
|
||||
echo "Status code of the kurtosis run: ${status_code}"
|
||||
docker cp "$filtr_cid:/go/bin/out/$filtr.out" $FTDIR
|
||||
docker cp "$lpush_cid:/go/bin/out/$lpush.out" $LPDIR
|
||||
cd $parent
|
||||
#filtr_cid="$(docker container ls | grep '$prefix-$filtr' | awk '{print $1}')"
|
||||
#lpush_cid="$(docker container ls | grep '$prefix-$lpush' | awk '{print $1}')"
|
||||
}
|
||||
|
||||
echo "$# $1"
|
||||
[ 1 -eq "$#" ] || usage
|
||||
[ metal != $1 -a docker != $1 -a kurtosis != $1 ] && usage
|
||||
|
||||
|
||||
|
||||
|
||||
if [ metal = $1 ]; then
|
||||
build_metal
|
||||
start $1
|
||||
metal_run
|
||||
end $1
|
||||
elif [ docker = $1 ]; then
|
||||
build_metal
|
||||
build_docker
|
||||
start $1
|
||||
docker_run
|
||||
end $1
|
||||
elif [ kurtosis = $1 ]; then
|
||||
build_metal
|
||||
build_docker
|
||||
start $1
|
||||
kurtosis_run
|
||||
end $1
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
||||
|
||||
#[ 'kurtosis' = '$1' ] || run_kurtosis
|
||||
|
||||
|
||||
#docker run -d --mount type=bind,source="$(pwd)/target",target=/go/bin\ lightpush:alpha
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"output_file": "output.out",
|
||||
"duration": "1000s",
|
||||
"iat": "500ms",
|
||||
"mount_target": "/go/bin/out",
|
||||
"log_file": "output.log"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"output_file": "filter.out",
|
||||
"duration": "1000s",
|
||||
"iat": "500ms",
|
||||
"mount_src": "./data",
|
||||
"mount_target": "/go/bin/out",
|
||||
"log_file": "filter.log"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
.PHONY: all build
|
||||
FILE=waku-filter
|
||||
|
||||
build:
|
||||
go build -o $(FILE)
|
||||
|
||||
docker: build
|
||||
docker build --rm -t $(FILE):alpha .
|
||||
|
||||
all: build
|
|
@ -0,0 +1,17 @@
|
|||
# Specifies a parent image
|
||||
FROM golang:1.18
|
||||
|
||||
# Create the app directory to hold app’s source code
|
||||
|
||||
ADD waku-filter /go/bin/waku-filter
|
||||
RUN umask -S 202
|
||||
RUN mkdir -p /go/bin/out
|
||||
|
||||
ADD filter.go /go/src/filter.go
|
||||
ADD go.mod go.sum /go/src/
|
||||
|
||||
# Tells Docker which network port your container listens on
|
||||
EXPOSE 8080
|
||||
|
||||
# Specifies the executable command that runs when the container starts
|
||||
ENTRYPOINT [ "/go/bin/waku-filter"]
|
|
@ -0,0 +1,144 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"github.com/waku-org/go-waku/waku/v2/dnsdisc"
|
||||
"github.com/waku-org/go-waku/waku/v2/node"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
//"crypto/rand"
|
||||
//"encoding/hex"
|
||||
//"github.com/ethereum/go-ethereum/crypto"
|
||||
//"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
//"github.com/waku-org/go-waku/waku/v2/payload"
|
||||
)
|
||||
|
||||
var log = logging.Logger("filter")
|
||||
var pubSubTopic = protocol.DefaultPubsubTopic()
|
||||
|
||||
const dnsDiscoveryUrl = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"
|
||||
const nameServer = "1.1.1.1" // your local dns provider might be blocking entr
|
||||
|
||||
type Config struct {
|
||||
Ofname string
|
||||
ContentTopic string
|
||||
Iat time.Duration
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
var conf = Config{}
|
||||
|
||||
func init() {
|
||||
// args
|
||||
fmt.Println("Populating CLI params...")
|
||||
flag.DurationVar(&conf.Duration, "d", 1000*time.Second,
|
||||
"Specify the duration (1s,2m,4h)")
|
||||
flag.DurationVar(&conf.Iat, "i", 100*time.Millisecond,
|
||||
"Specify the interarrival time in millisecs")
|
||||
flag.StringVar(&conf.Ofname, "o", "lightpush.out",
|
||||
"Specify the output file")
|
||||
flag.StringVar(&conf.ContentTopic, "c", "d608b04e6b6fd7006afdfe916f08b5d",
|
||||
"Specify the content topic")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// setup the log
|
||||
lvl, err := logging.LevelFromString("info")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logging.SetAllLoggers(lvl)
|
||||
|
||||
// create the waku node
|
||||
hostAddr, _ := net.ResolveTCPAddr("tcp", "0.0.0.0:60000")
|
||||
ctx := context.Background()
|
||||
lightNode, err := node.New(ctx,
|
||||
//node.WithWakuRelay(),
|
||||
node.WithHostAddress(hostAddr),
|
||||
node.WithWakuFilter(false),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// find the list of full node fleet peers
|
||||
fmt.Printf("attempting DNS discovery with %s\n", dnsDiscoveryUrl)
|
||||
nodes, err := dnsdisc.RetrieveNodes(ctx, dnsDiscoveryUrl, dnsdisc.WithNameserver(nameServer))
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
// connect to the first peer
|
||||
var nodeList []multiaddr.Multiaddr
|
||||
for _, n := range nodes {
|
||||
nodeList = append(nodeList, n.Addresses...)
|
||||
}
|
||||
fmt.Printf("Discovered and connecting to %v \n", nodeList[0])
|
||||
peerID, err := nodeList[0].ValueForProtocol(multiaddr.P_P2P)
|
||||
if err != nil {
|
||||
fmt.Printf("could not get peerID: %s \n", err)
|
||||
panic(err)
|
||||
}
|
||||
err = lightNode.DialPeerWithMultiAddress(ctx, nodeList[0])
|
||||
if err != nil {
|
||||
fmt.Printf("could not connect to %s: %s \n", peerID, err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("STARTING THE LIGHTNODE ", conf.ContentTopic)
|
||||
// start the light node
|
||||
err = lightNode.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("SUBSCRIBING TO THE TOPIC ", conf.ContentTopic)
|
||||
// Subscribe to our ContentTopic and send a FilterRequest
|
||||
cf := filter.ContentFilter{
|
||||
Topic: pubSubTopic.String(),
|
||||
ContentTopics: []string{conf.ContentTopic},
|
||||
}
|
||||
_, theFilter, err := lightNode.Filter().Subscribe(ctx, cf)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
stopC := make(chan struct{})
|
||||
go func() {
|
||||
f, err := os.OpenFile(conf.Ofname, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
for env := range theFilter.Chan {
|
||||
msg := env.Message()
|
||||
log.Info("Light node received msg, ", string(msg.Payload))
|
||||
str := fmt.Sprintf("Received msg, @", string(msg.ContentTopic), "@", msg.Timestamp, "@", utils.GetUnixEpochFrom(lightNode.Timesource().Now()))
|
||||
log.Info(str)
|
||||
//"Received msg, @", string(msg.ContentTopic), "@", msg.Timestamp, "@", utils.GetUnixEpochFrom(lightNode.Timesource().Now()) )
|
||||
if _, err = f.WriteString(str + "\n"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
log.Info("Message channel closed!")
|
||||
stopC <- struct{}{}
|
||||
}()
|
||||
|
||||
<-time.After(conf.Duration)
|
||||
|
||||
// shut the nodes down
|
||||
lightNode.Stop()
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
module github.com/0xFugue/wadoku/waku/filter
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||
github.com/beevik/ntp v0.3.0 // indirect
|
||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/containerd/cgroups v1.0.4 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
|
||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d // indirect
|
||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/elastic/gosigar v0.14.2 // indirect
|
||||
github.com/ethereum/go-ethereum v1.10.25 // indirect
|
||||
github.com/flynn/noise v1.0.0 // indirect
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-migrate/migrate/v4 v4.15.2 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
|
||||
github.com/huin/goupnp v1.0.3 // indirect
|
||||
github.com/ipfs/go-cid v0.3.2 // indirect
|
||||
github.com/ipfs/go-log v1.0.5 // indirect
|
||||
github.com/ipfs/go-log/v2 v2.5.1 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
github.com/klauspost/compress v1.15.10 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
|
||||
github.com/koron/go-ssdp v0.0.3 // indirect
|
||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
||||
github.com/libp2p/go-cidranger v1.1.0 // indirect
|
||||
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p v0.23.2 // indirect
|
||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
||||
github.com/libp2p/go-mplex v0.7.0 // indirect
|
||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||
github.com/libp2p/go-reuseport v0.2.0 // indirect
|
||||
github.com/libp2p/go-yamux/v4 v4.0.0 // indirect
|
||||
github.com/lucas-clemente/quic-go v0.29.1 // indirect
|
||||
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
|
||||
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
|
||||
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/miekg/dns v1.1.50 // indirect
|
||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||
github.com/multiformats/go-base36 v0.1.0 // indirect
|
||||
github.com/multiformats/go-multiaddr v0.8.0 // indirect
|
||||
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
|
||||
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
|
||||
github.com/multiformats/go-multibase v0.1.1 // indirect
|
||||
github.com/multiformats/go-multicodec v0.6.0 // indirect
|
||||
github.com/multiformats/go-multihash v0.2.1 // indirect
|
||||
github.com/multiformats/go-multistream v0.3.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
||||
github.com/rjeczalik/notify v0.9.1 // indirect
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
|
||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 // indirect
|
||||
github.com/waku-org/go-waku v0.3.1 // indirect
|
||||
github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg // indirect
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.23.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
lukechampine.com/blake3 v1.1.7 // indirect
|
||||
)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
name: "github.com/0xFugue/wadoku"
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"output_file": "lightpush.out",
|
||||
"duration": "1000s",
|
||||
"iat": "500ms",
|
||||
"mount_src": "./data",
|
||||
"mount_target": "/go/bin/out",
|
||||
"log_file": "lightpush.log"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
.PHONY: all build
|
||||
FILE=waku-lightpush
|
||||
|
||||
build:
|
||||
go build -o $(FILE)
|
||||
|
||||
docker: build
|
||||
docker build --rm -t $(FILE):alpha .
|
||||
|
||||
all: build
|
|
@ -0,0 +1,16 @@
|
|||
# Specifies a parent image
|
||||
FROM golang:1.18
|
||||
|
||||
# Create the app directory to hold app’s source code
|
||||
|
||||
ADD ./waku-lightpush /go/bin/waku-lightpush
|
||||
RUN mkdir -p /go/bin/out
|
||||
|
||||
ADD ./lightpush.go /go/src/lightpush.go
|
||||
ADD go.mod go.sum /go/src/
|
||||
|
||||
# Tells Docker which network port your container listens on
|
||||
EXPOSE 8080
|
||||
|
||||
# Specifies the executable command that runs when the container starts
|
||||
ENTRYPOINT [ "/go/bin/waku-lightpush" ]
|
|
@ -0,0 +1,123 @@
|
|||
module github.com/0xFugue/wadoku/waku/lightpush
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||
github.com/beevik/ntp v0.3.0 // indirect
|
||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/containerd/cgroups v1.0.4 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
|
||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d // indirect
|
||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/elastic/gosigar v0.14.2 // indirect
|
||||
github.com/ethereum/go-ethereum v1.10.25 // indirect
|
||||
github.com/flynn/noise v1.0.0 // indirect
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-migrate/migrate/v4 v4.15.2 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
|
||||
github.com/huin/goupnp v1.0.3 // indirect
|
||||
github.com/ipfs/go-cid v0.3.2 // indirect
|
||||
github.com/ipfs/go-log v1.0.5 // indirect
|
||||
github.com/ipfs/go-log/v2 v2.5.1 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
github.com/klauspost/compress v1.15.10 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
|
||||
github.com/koron/go-ssdp v0.0.3 // indirect
|
||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
||||
github.com/libp2p/go-cidranger v1.1.0 // indirect
|
||||
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p v0.23.2 // indirect
|
||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
||||
github.com/libp2p/go-mplex v0.7.0 // indirect
|
||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||
github.com/libp2p/go-reuseport v0.2.0 // indirect
|
||||
github.com/libp2p/go-yamux/v4 v4.0.0 // indirect
|
||||
github.com/lucas-clemente/quic-go v0.29.1 // indirect
|
||||
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
|
||||
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
|
||||
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/miekg/dns v1.1.50 // indirect
|
||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||
github.com/multiformats/go-base36 v0.1.0 // indirect
|
||||
github.com/multiformats/go-multiaddr v0.8.0 // indirect
|
||||
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
|
||||
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
|
||||
github.com/multiformats/go-multibase v0.1.1 // indirect
|
||||
github.com/multiformats/go-multicodec v0.6.0 // indirect
|
||||
github.com/multiformats/go-multihash v0.2.1 // indirect
|
||||
github.com/multiformats/go-multistream v0.3.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
||||
github.com/rjeczalik/notify v0.9.1 // indirect
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
|
||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 // indirect
|
||||
github.com/waku-org/go-waku v0.3.1 // indirect
|
||||
github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg // indirect
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.23.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
lukechampine.com/blake3 v1.1.7 // indirect
|
||||
)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,156 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"github.com/waku-org/go-waku/waku/v2/dnsdisc"
|
||||
"github.com/waku-org/go-waku/waku/v2/node"
|
||||
"github.com/waku-org/go-waku/waku/v2/payload"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
//"crypto/rand"
|
||||
//"encoding/hex"
|
||||
//"github.com/ethereum/go-ethereum/crypto"
|
||||
//"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||
//"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||
|
||||
//"github.com/0xFugue/wadoku/utils"
|
||||
)
|
||||
|
||||
var log = logging.Logger("lightpush")
|
||||
const NameServer = "1.1.1.1" // your local dns provider might be blocking entr
|
||||
const DnsDiscoveryUrl = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"
|
||||
|
||||
type Config struct {
|
||||
Ofname string
|
||||
ContentTopic string
|
||||
Iat time.Duration
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
var conf = Config{}
|
||||
|
||||
func init() {
|
||||
// args
|
||||
fmt.Println("Populating CLI params...")
|
||||
flag.DurationVar(&conf.Duration, "d", 1000*time.Second,
|
||||
"Specify the duration (1s,2m,4h)")
|
||||
flag.DurationVar(&conf.Iat, "i", 100*time.Millisecond,
|
||||
"Specify the interarrival time in millisecs")
|
||||
flag.StringVar(&conf.Ofname, "o", "lightpush.out",
|
||||
"Specify the output file")
|
||||
flag.StringVar(&conf.ContentTopic, "c", "d608b04e6b6fd7006afdfe916f08b5d",
|
||||
"Specify the content topic")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// setup the log
|
||||
lvl, err := logging.LevelFromString("info")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logging.SetAllLoggers(lvl)
|
||||
|
||||
// create the waku node
|
||||
hostAddr, _ := net.ResolveTCPAddr("tcp", "0.0.0.0:60000")
|
||||
ctx := context.Background()
|
||||
lightNode, err := node.New(ctx,
|
||||
node.WithWakuRelay(),
|
||||
node.WithHostAddress(hostAddr),
|
||||
node.WithWakuFilter(false),
|
||||
node.WithLightPush(),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// find the list of full node fleet peers
|
||||
fmt.Printf("attempting DNS discovery with %s\n", DnsDiscoveryUrl)
|
||||
nodes, err := dnsdisc.RetrieveNodes(ctx, DnsDiscoveryUrl, dnsdisc.WithNameserver(NameServer))
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
// connect to the first peer
|
||||
var nodeList []multiaddr.Multiaddr
|
||||
for _, n := range nodes {
|
||||
nodeList = append(nodeList, n.Addresses...)
|
||||
}
|
||||
fmt.Printf("Discovered and connecting to %v \n", nodeList[0])
|
||||
peerID, err := nodeList[0].ValueForProtocol(multiaddr.P_P2P)
|
||||
if err != nil {
|
||||
fmt.Printf("could not connect to %s: %s \n", peerID, err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = lightNode.DialPeerWithMultiAddress(ctx, nodeList[0])
|
||||
if err != nil {
|
||||
fmt.Printf("could not connect to %s: %s \n", peerID, err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("STARTING THE LIGHTNODE ", conf.ContentTopic)
|
||||
// start the light node
|
||||
err = lightNode.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
go writeLoop(ctx, &conf, lightNode)
|
||||
|
||||
<-time.After(conf.Duration)
|
||||
|
||||
// shut the nodes down
|
||||
lightNode.Stop()
|
||||
}
|
||||
|
||||
func writeLoop(ctx context.Context, conf *Config, wakuNode *node.WakuNode) {
|
||||
fmt.Println("STARTING THE WRITELOOP ", conf.ContentTopic)
|
||||
|
||||
f, err := os.OpenFile(conf.Ofname, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
for {
|
||||
time.Sleep(conf.Iat)
|
||||
|
||||
// build the message
|
||||
p := new(payload.Payload)
|
||||
var version uint32 = 0
|
||||
payload, err := p.Encode(version)
|
||||
if err != nil {
|
||||
log.Error("Could not Encode: ", err)
|
||||
}
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
ContentTopic: conf.ContentTopic,
|
||||
Timestamp: utils.GetUnixEpochFrom(wakuNode.Timesource().Now()),
|
||||
}
|
||||
|
||||
// publish the message
|
||||
_, err = wakuNode.Lightpush().Publish(ctx, msg)
|
||||
if err != nil {
|
||||
log.Error("Could not publish: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
str := fmt.Sprintf("MSG: %s\n", msg)
|
||||
if _, err = f.WriteString(str); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("PUBLISHED/PUSHED...", msg)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
DEFAULT_CONFIG_FILE = "github.com/0xFugue/wadoku/waku/config.json"
|
||||
|
||||
def get_config_file(args):
|
||||
return DEFAULT_CONFIG_FILE if not hasattr(args, "config") else args.config
|
||||
|
||||
|
||||
def run(args):
|
||||
print(args)
|
||||
config_file = get_config_file(args)
|
||||
print("Reading the config from: %s" %config_file)
|
||||
config_json = read_file(src=config_file)
|
||||
config = json.decode(config_json)
|
||||
|
||||
#input_file = config['input_file']
|
||||
output_file = config['output_file']
|
||||
duration = config['duration']
|
||||
iat = config['iat']
|
||||
mount_src = config['mount_src']
|
||||
mount_dst = config['mount_target']
|
||||
print(config)
|
||||
|
||||
waku_filtr = add_service(
|
||||
service_id = "waku-filter",
|
||||
config = struct(
|
||||
image = "waku-filter:alpha",
|
||||
entrypoint= ["/go/bin/waku-filter"],
|
||||
cmd = [ "-o=" + "/go/bin/out/filter.out",
|
||||
"-d=" + "100s",
|
||||
"-i=" + iat ],
|
||||
),
|
||||
)
|
||||
waku_lpush = add_service(
|
||||
service_id = "waku-lightpush",
|
||||
config = struct(
|
||||
image = "waku-lightpush:alpha",
|
||||
entrypoint= ["/go/bin/waku-lightpush"],
|
||||
cmd = [ "-o=" + "/go/bin/out/lightpush.out",
|
||||
"-d=" + "100s",
|
||||
"-i=" + iat ],
|
||||
),
|
||||
)
|
||||
|
||||
print(waku_filtr, waku_lpush)
|
||||
|
Loading…
Reference in New Issue