mirror of https://github.com/status-im/go-waku.git
refactor: connectedness
Uses libp2p network notifier to determine when a peer connects or disconnects, as well as using the host network peerstore instead of managing out own separate peer map
This commit is contained in:
parent
79e21dbb99
commit
1991a54d64
|
@ -878,8 +878,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
|||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 h1:v2gpjWKyI+vZZugjjhPDqIhg6uNrGLusHh3ilvbv8/Y=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574/go.mod h1:Fa1uJjMz9MpfZc2tC5xdN9q90xg1VphSnevxWiBbFO0=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a h1:eCna/q/PuZVqtmOMBqytw9yzZwMNKpao4au0OJDvesI=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375 h1:4lYWWH3SPnVrCmDmqUpQlXy65uFUZZCjH6gS9899iJc=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
|
|
|
@ -897,8 +897,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
|||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 h1:v2gpjWKyI+vZZugjjhPDqIhg6uNrGLusHh3ilvbv8/Y=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574/go.mod h1:Fa1uJjMz9MpfZc2tC5xdN9q90xg1VphSnevxWiBbFO0=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a h1:eCna/q/PuZVqtmOMBqytw9yzZwMNKpao4au0OJDvesI=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375 h1:4lYWWH3SPnVrCmDmqUpQlXy65uFUZZCjH6gS9899iJc=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
|
|
|
@ -46,7 +46,7 @@ func main() {
|
|||
filterNodeFlag := flag.String("filternode", "", "multiaddr of peer to to request content filtering of messages")
|
||||
lightPushFlag := flag.Bool("lightpush", false, "enable lightpush protocol")
|
||||
lightPushNodeFlag := flag.String("lightpushnode", "", "Multiaddr of peer to to request lightpush of published messages")
|
||||
keepAliveFlag := flag.Int64("keep-alive", 300, "interval in seconds for pinging peers to keep the connection alive.")
|
||||
keepAliveFlag := flag.Int64("keep-alive", 20, "interval in seconds for pinging peers to keep the connection alive.")
|
||||
|
||||
dnsDiscoveryFlag := flag.Bool("dns-discovery", false, "enable dns discovery")
|
||||
dnsDiscoveryUrlFlag := flag.String("dns-discovery-url", "", "URL for DNS node list in format 'enrtree://<key>@<fqdn>'")
|
||||
|
|
|
@ -878,8 +878,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
|||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 h1:v2gpjWKyI+vZZugjjhPDqIhg6uNrGLusHh3ilvbv8/Y=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574/go.mod h1:Fa1uJjMz9MpfZc2tC5xdN9q90xg1VphSnevxWiBbFO0=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a h1:eCna/q/PuZVqtmOMBqytw9yzZwMNKpao4au0OJDvesI=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375 h1:4lYWWH3SPnVrCmDmqUpQlXy65uFUZZCjH6gS9899iJc=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
|
|
|
@ -58,6 +58,11 @@ func main() {
|
|||
node.WithWakuFilter(),
|
||||
)
|
||||
|
||||
err = fullNode.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
lightNode, err := node.New(ctx,
|
||||
node.WithPrivateKey(prvKey2),
|
||||
node.WithHostAddress([]net.Addr{hostAddr2}),
|
||||
|
|
|
@ -24,7 +24,6 @@ cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM7
|
|||
cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
|
@ -101,7 +100,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
|
||||
|
@ -135,20 +133,15 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
|
|||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ=
|
||||
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d h1:bE1UyBQ5aE6FjhNY4lbPtMqh7VDldoVkvZMtFEbd+CE=
|
||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d/go.mod h1:HAe1wsCrwH2uFnFaCC2vlcyEohnxs8KeShAFqGIHvmM=
|
||||
|
@ -230,7 +223,6 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGw
|
|||
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
@ -309,16 +301,12 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
|
|||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
|
||||
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
|
@ -452,7 +440,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
|||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ=
|
||||
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
|
@ -652,8 +639,6 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b
|
|||
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
|
||||
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
|
@ -692,7 +677,6 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
|
|||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
|
@ -802,7 +786,6 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI
|
|||
github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
|
||||
github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
||||
|
@ -814,14 +797,12 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
|||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||
github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
|
||||
github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4=
|
||||
|
@ -836,7 +817,6 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
|
|||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||
|
@ -848,7 +828,6 @@ github.com/prometheus/common v0.28.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+
|
|||
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
|
@ -889,25 +868,18 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO
|
|||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/afero v1.5.1/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||
github.com/status-im/go-libp2p-rendezvous v0.0.0-20210930154620-020ef08b264a h1:/37EOjcoN5Lr8/ZQawuhKfNKF723myJUdlOTDVTciu4=
|
||||
github.com/status-im/go-libp2p-rendezvous v0.0.0-20210930154620-020ef08b264a/go.mod h1:Q/GA4TCj4QLJCO02GN4O1CgkuTkn8oKbQSn1+yratvE=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a h1:eCna/q/PuZVqtmOMBqytw9yzZwMNKpao4au0OJDvesI=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 h1:v2gpjWKyI+vZZugjjhPDqIhg6uNrGLusHh3ilvbv8/Y=
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574/go.mod h1:Fa1uJjMz9MpfZc2tC5xdN9q90xg1VphSnevxWiBbFO0=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375 h1:4lYWWH3SPnVrCmDmqUpQlXy65uFUZZCjH6gS9899iJc=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
|
@ -922,7 +894,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
|||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
|
||||
|
@ -930,7 +901,6 @@ github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW
|
|||
github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
|
||||
github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
|
@ -954,7 +924,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
|
@ -1002,7 +971,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
|
@ -1215,7 +1183,6 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn
|
|||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
@ -1359,8 +1326,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS
|
|||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
|
||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
|
||||
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
|
|
4
go.mod
4
go.mod
|
@ -4,6 +4,8 @@ go 1.15
|
|||
|
||||
replace github.com/ethereum/go-ethereum v1.10.4 => github.com/status-im/go-ethereum v1.10.4-status.2
|
||||
|
||||
replace github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 => ../go-libp2p-rendezvous
|
||||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.3.0
|
||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d
|
||||
|
@ -24,7 +26,7 @@ require (
|
|||
github.com/prometheus/common v0.29.0 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
|
||||
go.opencensus.io v0.23.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -908,6 +908,8 @@ github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574 h1:v2
|
|||
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574/go.mod h1:Fa1uJjMz9MpfZc2tC5xdN9q90xg1VphSnevxWiBbFO0=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a h1:eCna/q/PuZVqtmOMBqytw9yzZwMNKpao4au0OJDvesI=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20210729162817-adc68830282a/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375 h1:4lYWWH3SPnVrCmDmqUpQlXy65uFUZZCjH6gS9899iJc=
|
||||
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375/go.mod h1:LSCVYR7mnBBsxVJghrGpQ3yJAAATEe6XeQQqGCZhwrE=
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||
github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
|
|
|
@ -52,7 +52,7 @@ type Options struct {
|
|||
GenerateKey bool `long:"generate-key" description:"Generate private key file at path specified in --key-file"`
|
||||
Overwrite bool `long:"overwrite" description:"When generating a keyfile, overwrite the nodekey file if it already exists"`
|
||||
StaticNodes []string `long:"staticnodes" description:"Multiaddr of peer to directly connect with. Argument may be repeated"`
|
||||
KeepAlive int `long:"keep-alive" default:"300" description:"Interval in seconds for pinging peers to keep the connection alive."`
|
||||
KeepAlive int `long:"keep-alive" default:"20" description:"Interval in seconds for pinging peers to keep the connection alive."`
|
||||
UseDB bool `long:"use-db" description:"Use SQLiteDB to persist information"`
|
||||
DBPath string `long:"dbpath" default:"./store.db" description:"Path to DB file"`
|
||||
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
"github.com/status-im/go-waku/waku/v2/protocol/filter"
|
||||
"github.com/status-im/go-waku/waku/v2/protocol/lightpush"
|
||||
"github.com/status-im/go-waku/waku/v2/protocol/store"
|
||||
wakurelay "github.com/status-im/go-wakurelay-pubsub"
|
||||
)
|
||||
|
||||
// A map of peer IDs to supported protocols
|
||||
type PeerStats map[peer.ID][]string
|
||||
|
||||
type ConnStatus struct {
|
||||
IsOnline bool
|
||||
HasHistory bool
|
||||
Peers PeerStats
|
||||
}
|
||||
|
||||
type ConnectionNotifier struct {
|
||||
h host.Host
|
||||
DisconnectChan chan peer.ID
|
||||
quit chan struct{}
|
||||
}
|
||||
|
||||
func NewConnectionNotifier(h host.Host) ConnectionNotifier {
|
||||
return ConnectionNotifier{
|
||||
h: h,
|
||||
DisconnectChan: make(chan peer.ID, 100),
|
||||
quit: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) Listen(n network.Network, m ma.Multiaddr) {
|
||||
// called when network starts listening on an addr
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) ListenClose(n network.Network, m ma.Multiaddr) {
|
||||
// called when network stops listening on an addr
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) Connected(n network.Network, cc network.Conn) {
|
||||
// called when a connection opened
|
||||
log.Info(fmt.Sprintf("Peer %s connected", cc.RemotePeer()))
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) Disconnected(n network.Network, cc network.Conn) {
|
||||
// called when a connection closed
|
||||
log.Info(fmt.Sprintf("Peer %s disconnected", cc.RemotePeer()))
|
||||
c.DisconnectChan <- cc.RemotePeer()
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) OpenedStream(n network.Network, s network.Stream) {
|
||||
// called when a stream opened
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) ClosedStream(n network.Network, s network.Stream) {
|
||||
// called when a stream closed
|
||||
}
|
||||
|
||||
func (c ConnectionNotifier) Close() {
|
||||
close(c.quit)
|
||||
}
|
||||
|
||||
func (w *WakuNode) sendConnStatus() {
|
||||
isOnline, hasHistory := w.Status()
|
||||
if w.connStatusChan != nil {
|
||||
connStatus := ConnStatus{IsOnline: isOnline, HasHistory: hasHistory, Peers: w.Peers()}
|
||||
w.connStatusChan <- connStatus
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (w *WakuNode) connectednessListener() {
|
||||
for {
|
||||
select {
|
||||
case <-w.quit:
|
||||
return
|
||||
case <-w.protocolEventSub.Out():
|
||||
case <-w.identificationEventSub.Out():
|
||||
case p := <-w.connectionNotif.DisconnectChan:
|
||||
// Notify filter of disconnection
|
||||
w.filter.DisconnectChan <- p
|
||||
}
|
||||
w.sendConnStatus()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WakuNode) Status() (isOnline bool, hasHistory bool) {
|
||||
hasRelay := false
|
||||
hasLightPush := false
|
||||
hasStore := false
|
||||
hasFilter := false
|
||||
|
||||
for _, peer := range w.host.Network().Peers() {
|
||||
protocols, err := w.host.Peerstore().GetProtocols(peer)
|
||||
if err != nil {
|
||||
log.Warn(fmt.Errorf("could not read peer %s protocols", peer))
|
||||
}
|
||||
|
||||
for _, protocol := range protocols {
|
||||
if !hasRelay && protocol == string(wakurelay.WakuRelayID_v200) {
|
||||
hasRelay = true
|
||||
}
|
||||
if !hasLightPush && protocol == string(lightpush.LightPushID_v20beta1) {
|
||||
hasLightPush = true
|
||||
}
|
||||
if !hasStore && protocol == string(store.StoreID_v20beta3) {
|
||||
hasStore = true
|
||||
}
|
||||
if !hasFilter && protocol == string(filter.FilterID_v20beta1) {
|
||||
hasFilter = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hasStore {
|
||||
hasHistory = true
|
||||
}
|
||||
|
||||
if hasRelay || hasLightPush && (hasStore || hasFilter) {
|
||||
isOnline = true
|
||||
}
|
||||
|
||||
return
|
||||
}
|
|
@ -4,20 +4,15 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
//"log/syslog"
|
||||
//"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
logging "github.com/ipfs/go-log"
|
||||
"github.com/libp2p/go-libp2p"
|
||||
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/event"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/peerstore"
|
||||
p2pproto "github.com/libp2p/go-libp2p-core/protocol"
|
||||
|
@ -39,31 +34,17 @@ import (
|
|||
|
||||
var log = logging.Logger("wakunode")
|
||||
|
||||
//var logwriter, _ = syslog.New(syslog.LOG_ERR|syslog.LOG_LOCAL0, "WAKU")
|
||||
|
||||
type Message []byte
|
||||
|
||||
// A map of peer IDs to supported protocols
|
||||
type PeerStats map[peer.ID][]string
|
||||
|
||||
type ConnStatus struct {
|
||||
IsOnline bool
|
||||
HasHistory bool
|
||||
Peers PeerStats
|
||||
}
|
||||
|
||||
type WakuNode struct {
|
||||
host host.Host
|
||||
idService *identify.IDService
|
||||
opts *WakuNodeParameters
|
||||
|
||||
relay *relay.WakuRelay
|
||||
filter *filter.WakuFilter
|
||||
lightPush *lightpush.WakuLightPush
|
||||
host host.Host
|
||||
opts *WakuNodeParameters
|
||||
|
||||
relay *relay.WakuRelay
|
||||
filter *filter.WakuFilter
|
||||
lightPush *lightpush.WakuLightPush
|
||||
rendezvous *rendezvous.RendezvousService
|
||||
|
||||
ping *ping.PingService
|
||||
ping *ping.PingService
|
||||
|
||||
subscriptions map[relay.Topic][]*Subscription
|
||||
subscriptionsMutex sync.Mutex
|
||||
|
@ -72,7 +53,7 @@ type WakuNode struct {
|
|||
|
||||
filters filter.Filters
|
||||
|
||||
connectednessEventSub event.Subscription
|
||||
connectionNotif ConnectionNotifier
|
||||
protocolEventSub event.Subscription
|
||||
identificationEventSub event.Subscription
|
||||
|
||||
|
@ -80,120 +61,9 @@ type WakuNode struct {
|
|||
cancel context.CancelFunc
|
||||
quit chan struct{}
|
||||
|
||||
// Map of peers and their supported protocols
|
||||
peers PeerStats
|
||||
peersMutex sync.Mutex
|
||||
|
||||
// Internal protocol implementations that wish
|
||||
// to listen to peer added/removed events (e.g. Filter)
|
||||
peerListeners []chan *event.EvtPeerConnectednessChanged
|
||||
// Channel passed to WakuNode constructor
|
||||
// receiving connection status notifications
|
||||
connStatusChan chan ConnStatus
|
||||
pingEventsChan chan interface{}
|
||||
}
|
||||
|
||||
func (w *WakuNode) handleConnectednessChanged(ev event.EvtPeerConnectednessChanged) {
|
||||
log.Debug("### EvtPeerConnectednessChanged ", w.Host().ID(), " to ", ev.Peer, " : ", ev.Connectedness)
|
||||
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
|
||||
if ev.Connectedness == network.Connected {
|
||||
_, ok := w.peers[ev.Peer]
|
||||
if !ok {
|
||||
peerProtocols, _ := w.host.Peerstore().GetProtocols(ev.Peer)
|
||||
log.Debug("protocols found for peer: ", ev.Peer, ", protocols: ", peerProtocols)
|
||||
w.peers[ev.Peer] = peerProtocols
|
||||
} else {
|
||||
log.Debug("### Peer already exists")
|
||||
}
|
||||
} else if ev.Connectedness == network.NotConnected {
|
||||
log.Debug("Peer down: ", ev.Peer)
|
||||
delete(w.peers, ev.Peer)
|
||||
// for _, pl := range w.peerListeners {
|
||||
// pl <- &ev
|
||||
// }
|
||||
// TODO
|
||||
// There seems to be no proper way to
|
||||
// remove a dropped peer from Host's Peerstore
|
||||
// https://github.com/libp2p/go-libp2p-host/issues/13
|
||||
//w.Host().Network().ClosePeer(ev.Peer)
|
||||
}
|
||||
|
||||
}
|
||||
func (w *WakuNode) handleProtocolsUpdated(ev event.EvtPeerProtocolsUpdated) {
|
||||
log.Debug("### EvtPeerProtocolsUpdated ", w.Host().ID(), " to ", ev.Peer, " added: ", ev.Added, ", removed: ", ev.Removed)
|
||||
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
|
||||
_, ok := w.peers[ev.Peer]
|
||||
if ok {
|
||||
peerProtocols, _ := w.host.Peerstore().GetProtocols(ev.Peer)
|
||||
log.Debug("updated protocols found for peer: ", ev.Peer, ", protocols: ", peerProtocols)
|
||||
w.peers[ev.Peer] = peerProtocols
|
||||
}
|
||||
|
||||
}
|
||||
func (w *WakuNode) handlePeerIdentificationCompleted(ev event.EvtPeerIdentificationCompleted) {
|
||||
log.Debug("### EvtPeerIdentificationCompleted ", w.Host().ID(), " to ", ev.Peer)
|
||||
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
|
||||
peerProtocols, _ := w.host.Peerstore().GetProtocols(ev.Peer)
|
||||
log.Debug("identified protocols found for peer: ", ev.Peer, ", protocols: ", peerProtocols)
|
||||
w.peers[ev.Peer] = peerProtocols
|
||||
}
|
||||
func (w *WakuNode) processHostEvent(e interface{}) {
|
||||
if e == nil {
|
||||
log.Debug("processHostEvent nil event")
|
||||
return
|
||||
}
|
||||
isOnline := w.IsOnline()
|
||||
hasHistory := w.HasHistory()
|
||||
switch e := e.(type) {
|
||||
case event.EvtPeerConnectednessChanged:
|
||||
w.handleConnectednessChanged(e)
|
||||
case event.EvtPeerProtocolsUpdated:
|
||||
w.handleProtocolsUpdated(e)
|
||||
case event.EvtPeerIdentificationCompleted:
|
||||
w.handlePeerIdentificationCompleted(e)
|
||||
}
|
||||
|
||||
log.Debug("###processHostEvent before isOnline()")
|
||||
newIsOnline := w.IsOnline()
|
||||
log.Debug("###processHostEvent before hasHistory()")
|
||||
newHasHistory := w.HasHistory()
|
||||
log.Debug("###ConnStatus isOnline: ", isOnline, "/", newIsOnline, " hasHistory: ",
|
||||
hasHistory, "/", newHasHistory)
|
||||
if w.connStatusChan != nil {
|
||||
connStatus := ConnStatus{IsOnline: newIsOnline, HasHistory: newHasHistory, Peers: w.Peers()}
|
||||
log.Debug("New ConnStatus: ", connStatus)
|
||||
w.connStatusChan <- connStatus
|
||||
}
|
||||
|
||||
}
|
||||
func (w *WakuNode) connectednessListener() {
|
||||
for {
|
||||
var e interface{}
|
||||
log.Debug("connectednessListener before select")
|
||||
select {
|
||||
case e = <-w.connectednessEventSub.Out():
|
||||
log.Debug("connectednessListener connectednessEvent")
|
||||
case e = <-w.protocolEventSub.Out():
|
||||
log.Debug("connectednessListener protocolEvent")
|
||||
case e = <-w.identificationEventSub.Out():
|
||||
log.Debug("connectednessListener identificationEvent")
|
||||
case e = <-w.pingEventsChan:
|
||||
log.Debug("connectednessListener pingEvent")
|
||||
}
|
||||
log.Debug("connectednessListener after select")
|
||||
|
||||
w.processHostEvent(e)
|
||||
log.Debug("connectednessListener after processHostEvent")
|
||||
}
|
||||
}
|
||||
|
||||
func New(ctx context.Context, opts ...WakuNodeOption) (*WakuNode, error) {
|
||||
|
@ -228,28 +98,26 @@ func New(ctx context.Context, opts ...WakuNodeOption) (*WakuNode, error) {
|
|||
w := new(WakuNode)
|
||||
w.bcaster = NewBroadcaster(1024)
|
||||
w.host = host
|
||||
w.idService = identify.NewIDService(host)
|
||||
w.cancel = cancel
|
||||
w.ctx = ctx
|
||||
w.subscriptions = make(map[relay.Topic][]*Subscription)
|
||||
w.opts = params
|
||||
w.quit = make(chan struct{})
|
||||
w.peers = make(PeerStats)
|
||||
|
||||
// Subscribe to Connectedness events
|
||||
connectednessEventSub, _ := host.EventBus().Subscribe(new(event.EvtPeerConnectednessChanged))
|
||||
w.connectednessEventSub = connectednessEventSub
|
||||
if w.protocolEventSub, err = host.EventBus().Subscribe(new(event.EvtPeerProtocolsUpdated)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
protocolEventSub, _ := host.EventBus().Subscribe(new(event.EvtPeerProtocolsUpdated))
|
||||
w.protocolEventSub = protocolEventSub
|
||||
|
||||
identificationEventSub, _ := host.EventBus().Subscribe(new(event.EvtPeerIdentificationCompleted))
|
||||
w.identificationEventSub = identificationEventSub
|
||||
if w.identificationEventSub, err = host.EventBus().Subscribe(new(event.EvtPeerIdentificationCompleted)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if params.connStatusChan != nil {
|
||||
w.connStatusChan = params.connStatusChan
|
||||
}
|
||||
w.pingEventsChan = make(chan interface{})
|
||||
|
||||
w.connectionNotif = NewConnectionNotifier(host)
|
||||
w.host.Network().Notify(w.connectionNotif)
|
||||
go w.connectednessListener()
|
||||
|
||||
if w.opts.keepAliveInterval > time.Duration(0) {
|
||||
|
@ -307,7 +175,7 @@ func (w *WakuNode) Stop() {
|
|||
|
||||
close(w.quit)
|
||||
|
||||
defer w.connectednessEventSub.Close()
|
||||
defer w.connectionNotif.Close()
|
||||
defer w.protocolEventSub.Close()
|
||||
defer w.identificationEventSub.Close()
|
||||
|
||||
|
@ -334,51 +202,6 @@ func (w *WakuNode) ID() string {
|
|||
return w.host.ID().Pretty()
|
||||
}
|
||||
|
||||
func (w *WakuNode) IsOnline() bool {
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
|
||||
hasRelay := false
|
||||
hasLightPush := false
|
||||
hasStore := false
|
||||
hasFilter := false
|
||||
for _, v := range w.peers {
|
||||
for _, protocol := range v {
|
||||
if !hasRelay && protocol == string(wakurelay.WakuRelayID_v200) {
|
||||
hasRelay = true
|
||||
}
|
||||
if !hasLightPush && protocol == string(lightpush.LightPushID_v20beta1) {
|
||||
hasLightPush = true
|
||||
}
|
||||
if !hasStore && protocol == string(store.StoreID_v20beta3) {
|
||||
hasStore = true
|
||||
}
|
||||
if !hasFilter && protocol == string(filter.FilterID_v20beta1) {
|
||||
hasFilter = true
|
||||
}
|
||||
if hasRelay || hasLightPush && (hasStore || hasFilter) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *WakuNode) HasHistory() bool {
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
|
||||
for _, v := range w.peers {
|
||||
for _, protocol := range v {
|
||||
if protocol == string(store.StoreID_v20beta3) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *WakuNode) ListenAddresses() []ma.Multiaddr {
|
||||
hostInfo, _ := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s", w.host.ID().Pretty()))
|
||||
var result []ma.Multiaddr
|
||||
|
@ -418,12 +241,10 @@ func (w *WakuNode) mountFilter() error {
|
|||
w.filters.Notify(message, requestId) // Trigger filter handlers on a light node
|
||||
}
|
||||
}
|
||||
peerChan := make(chan *event.EvtPeerConnectednessChanged)
|
||||
w.filter = filter.NewWakuFilter(w.ctx, w.host, filterHandler, peerChan)
|
||||
w.peerListeners = append(w.peerListeners, peerChan)
|
||||
|
||||
w.filter = filter.NewWakuFilter(w.ctx, w.host, filterHandler)
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (w *WakuNode) mountLightPush() {
|
||||
|
@ -442,9 +263,7 @@ func (w *WakuNode) mountRendezvous() error {
|
|||
}
|
||||
|
||||
func (w *WakuNode) startStore() {
|
||||
peerChan := make(chan *event.EvtPeerConnectednessChanged)
|
||||
w.opts.store.Start(w.ctx, w.host, peerChan)
|
||||
w.peerListeners = append(w.peerListeners, peerChan)
|
||||
w.opts.store.Start(w.ctx, w.host)
|
||||
|
||||
if w.opts.shouldResume {
|
||||
if _, err := w.opts.store.Resume(string(relay.GetTopic(nil)), nil); err != nil {
|
||||
|
@ -740,12 +559,6 @@ func (w *WakuNode) connect(ctx context.Context, info peer.AddrInfo) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w.processHostEvent(event.EvtPeerConnectednessChanged{
|
||||
Peer: info.ID,
|
||||
Connectedness: network.Connected,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -774,120 +587,37 @@ func (w *WakuNode) ClosePeerById(id peer.ID) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w.processHostEvent(event.EvtPeerConnectednessChanged{
|
||||
Peer: id,
|
||||
Connectedness: network.NotConnected,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *WakuNode) PeerCount() int {
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
return len(w.peers)
|
||||
return len(w.host.Network().Peers())
|
||||
}
|
||||
|
||||
func (w *WakuNode) Peers() PeerStats {
|
||||
w.peersMutex.Lock()
|
||||
defer w.peersMutex.Unlock()
|
||||
p := make(PeerStats)
|
||||
for k, v := range w.peers {
|
||||
p[k] = v
|
||||
for _, peerID := range w.host.Network().Peers() {
|
||||
protocols, err := w.host.Peerstore().GetProtocols(peerID)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
p[peerID] = protocols
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (w *WakuNode) startKeepAlive(t time.Duration) {
|
||||
|
||||
log.Info("Setting up ping protocol with duration of ", t)
|
||||
|
||||
w.ping = ping.NewPingService(w.host)
|
||||
ticker := time.NewTicker(t)
|
||||
go func() {
|
||||
// This map contains peers that we're
|
||||
// waiting for the ping response from
|
||||
peerMap := make(map[peer.ID]<-chan ping.Result)
|
||||
var mu sync.Mutex
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
for _, p := range w.host.Peerstore().Peers() {
|
||||
if p == w.host.ID() {
|
||||
log.Info("###PING skip ", p)
|
||||
continue
|
||||
}
|
||||
mu.Lock()
|
||||
_, ok := peerMap[p]
|
||||
mu.Unlock()
|
||||
|
||||
var s = p.Pretty()
|
||||
s = s[len(s)-4:]
|
||||
if !ok {
|
||||
log.Info("###PING ", s)
|
||||
result := w.ping.Ping(w.ctx, p)
|
||||
mu.Lock()
|
||||
peerMap[p] = result
|
||||
mu.Unlock()
|
||||
|
||||
go func(peerID peer.ID) {
|
||||
peerFound := false
|
||||
w.peersMutex.Lock()
|
||||
for p := range w.peers {
|
||||
if p == peerID {
|
||||
peerFound = true
|
||||
break
|
||||
}
|
||||
}
|
||||
defer w.peersMutex.Unlock()
|
||||
log.Debug("###PING before fetching result")
|
||||
|
||||
pingTicker := time.NewTicker(time.Duration(1) * time.Second)
|
||||
isError := false
|
||||
select {
|
||||
case resVal := <-result:
|
||||
isError = resVal.Error != nil
|
||||
case <-pingTicker.C:
|
||||
isError = true
|
||||
}
|
||||
pingTicker.Stop()
|
||||
if !peerFound && !isError {
|
||||
//EventBus Emitter doesn't seem to work when there's no connection
|
||||
w.pingEventsChan <- event.EvtPeerConnectednessChanged{
|
||||
Peer: peerID,
|
||||
Connectedness: network.Connected,
|
||||
}
|
||||
peerConns := w.host.Network().ConnsToPeer(peerID)
|
||||
if len(peerConns) > 0 {
|
||||
// log.Info("###PING " + s + " IdentifyWait")
|
||||
// logwriter.Write([]byte("###PING " + s + " IdentifyWait"))
|
||||
//w.idService.IdentifyWait(peerConns[0])
|
||||
} else {
|
||||
go func(peerID peer.ID) {
|
||||
ctx, cancel := context.WithTimeout(w.ctx, time.Duration(5)*time.Second)
|
||||
defer cancel()
|
||||
if err := w.DialPeerByID(ctx, peerID); err != nil {
|
||||
log.Warn("could not dial peer ", peerID)
|
||||
}
|
||||
}(peerID)
|
||||
}
|
||||
} else if peerFound && isError {
|
||||
w.pingEventsChan <- event.EvtPeerConnectednessChanged{
|
||||
Peer: peerID,
|
||||
Connectedness: network.NotConnected,
|
||||
}
|
||||
}
|
||||
|
||||
mu.Lock()
|
||||
delete(peerMap, peerID)
|
||||
mu.Unlock()
|
||||
}(p)
|
||||
} else {
|
||||
log.Info("###PING " + s + " already pinged")
|
||||
// logwriter.Write([]byte("###PING " + s + " already pinged"))
|
||||
}
|
||||
for _, peer := range w.host.Network().Peers() {
|
||||
log.Debug("Pinging", peer)
|
||||
w.ping.Ping(w.ctx, peer)
|
||||
}
|
||||
case <-w.quit:
|
||||
ticker.Stop()
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
|
||||
logging "github.com/ipfs/go-log"
|
||||
"github.com/libp2p/go-libp2p-core/event"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
@ -34,7 +33,7 @@ type (
|
|||
Filters map[string]Filter
|
||||
|
||||
Subscriber struct {
|
||||
peer string
|
||||
peer peer.ID
|
||||
requestId string
|
||||
filter pb.FilterRequest // @TODO MAKE THIS A SEQUENCE AGAIN?
|
||||
}
|
||||
|
@ -47,7 +46,8 @@ type (
|
|||
subscribers []Subscriber
|
||||
pushHandler MessagePushHandler
|
||||
MsgC chan *protocol.Envelope
|
||||
peerChan chan *event.EvtPeerConnectednessChanged
|
||||
|
||||
DisconnectChan chan peer.ID
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -107,16 +107,16 @@ func (wf *WakuFilter) onRequest(s network.Stream) {
|
|||
// We're on a full node.
|
||||
// This is a filter request coming from a light node.
|
||||
if filterRPCRequest.Request.Subscribe {
|
||||
subscriber := Subscriber{peer: string(s.Conn().RemotePeer()), requestId: filterRPCRequest.RequestId, filter: *filterRPCRequest.Request}
|
||||
subscriber := Subscriber{peer: s.Conn().RemotePeer(), requestId: filterRPCRequest.RequestId, filter: *filterRPCRequest.Request}
|
||||
wf.subscribers = append(wf.subscribers, subscriber)
|
||||
log.Info("filter full node, add a filter subscriber: ", subscriber.peer)
|
||||
|
||||
stats.Record(wf.ctx, metrics.FilterSubscriptions.M(int64(len(wf.subscribers))))
|
||||
} else {
|
||||
peerId := string(s.Conn().RemotePeer())
|
||||
log.Info("filter full node, remove a filter subscriber: ", peerId)
|
||||
peerId := s.Conn().RemotePeer()
|
||||
log.Info("filter full node, remove a filter subscriber: ", peerId.Pretty())
|
||||
contentFilters := filterRPCRequest.Request.ContentFilters
|
||||
var peerIdsToRemove []string
|
||||
var peerIdsToRemove []peer.ID
|
||||
for _, subscriber := range wf.subscribers {
|
||||
if subscriber.peer != peerId {
|
||||
continue
|
||||
|
@ -159,25 +159,24 @@ func (wf *WakuFilter) onRequest(s network.Stream) {
|
|||
}
|
||||
|
||||
func (wf *WakuFilter) peerListener() {
|
||||
for e := range wf.peerChan {
|
||||
if e.Connectedness == network.NotConnected {
|
||||
log.Info("filter Notification received ", e.Peer)
|
||||
i := 0
|
||||
// Delete subscribers matching deleted peer
|
||||
for _, s := range wf.subscribers {
|
||||
if s.peer != string(e.Peer) {
|
||||
wf.subscribers[i] = s
|
||||
i++
|
||||
}
|
||||
for peerID := range wf.DisconnectChan {
|
||||
log.Info("filter Notification received ", peerID)
|
||||
i := 0
|
||||
// Delete subscribers matching deleted peer
|
||||
for _, s := range wf.subscribers {
|
||||
if s.peer != peerID {
|
||||
wf.subscribers[i] = s
|
||||
i++
|
||||
}
|
||||
|
||||
log.Info("filter, deleted subscribers: ", len(wf.subscribers)-i)
|
||||
wf.subscribers = wf.subscribers[:i]
|
||||
}
|
||||
|
||||
log.Info("filter, deleted subscribers: ", len(wf.subscribers)-i)
|
||||
wf.subscribers = wf.subscribers[:i]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func NewWakuFilter(ctx context.Context, host host.Host, handler MessagePushHandler, peerChan chan *event.EvtPeerConnectednessChanged) *WakuFilter {
|
||||
func NewWakuFilter(ctx context.Context, host host.Host, handler MessagePushHandler) *WakuFilter {
|
||||
ctx, err := tag.New(ctx, tag.Insert(metrics.KeyType, "filter"))
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
@ -188,7 +187,7 @@ func NewWakuFilter(ctx context.Context, host host.Host, handler MessagePushHandl
|
|||
wf.MsgC = make(chan *protocol.Envelope)
|
||||
wf.h = host
|
||||
wf.pushHandler = handler
|
||||
wf.peerChan = peerChan
|
||||
wf.DisconnectChan = make(chan peer.ID)
|
||||
|
||||
wf.h.SetStreamHandlerMatch(FilterID_v20beta1, protocol.PrefixTextMatch(string(FilterID_v20beta1)), wf.onRequest)
|
||||
go wf.FilterListener()
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"time"
|
||||
|
||||
logging "github.com/ipfs/go-log"
|
||||
"github.com/libp2p/go-libp2p-core/event"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
@ -211,8 +210,6 @@ type WakuStore struct {
|
|||
storeMsgs bool
|
||||
msgProvider MessageProvider
|
||||
h host.Host
|
||||
|
||||
peerChan chan *event.EvtPeerConnectednessChanged
|
||||
}
|
||||
|
||||
func NewWakuStore(shouldStoreMessages bool, p MessageProvider) *WakuStore {
|
||||
|
@ -229,18 +226,9 @@ func (store *WakuStore) SetMsgProvider(p MessageProvider) {
|
|||
store.msgProvider = p
|
||||
}
|
||||
|
||||
func (store *WakuStore) peerListener() {
|
||||
for e := range store.peerChan {
|
||||
if e.Connectedness == network.NotConnected {
|
||||
log.Info("Notification received ", e.Peer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (store *WakuStore) Start(ctx context.Context, h host.Host, peerChan chan *event.EvtPeerConnectednessChanged) {
|
||||
func (store *WakuStore) Start(ctx context.Context, h host.Host) {
|
||||
store.h = h
|
||||
store.ctx = ctx
|
||||
store.peerChan = peerChan
|
||||
|
||||
if !store.storeMsgs {
|
||||
log.Info("Store protocol started (messages aren't stored)")
|
||||
|
@ -279,8 +267,6 @@ func (store *WakuStore) Start(ctx context.Context, h host.Host, peerChan chan *e
|
|||
}
|
||||
}
|
||||
|
||||
go store.peerListener()
|
||||
|
||||
log.Info("Store protocol started")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue