Commit Graph

1079 Commits

Author SHA1 Message Date
Tanguy 60f953629d
Remove ConnManager from Upgrade (#959) 2023-10-13 12:08:17 +00:00
diegomrsantos 459f6851e7
Add a flag if a peer should be disconnected when above rate limit (#954) 2023-10-05 14:51:27 +02:00
diegomrsantos 75871817ee
Split msgs in iwant response if bigger than limit (#944) 2023-10-02 11:39:28 +02:00
diegomrsantos 61929aed6c
Improve rdv advertise (#951)
Co-authored-by: Ludovic Chenut <ludovic@status.im>
2023-09-27 15:52:22 +02:00
diegomrsantos 56599f5b9d
GossipSub Traffic scoring (#920) 2023-09-22 16:45:08 +02:00
Tanguy b2eac7ecbd
GS: Relay messages to direct peers (#949) 2023-09-15 17:22:02 +02:00
Tanguy ff77d52851
IDontWant metrics (#946) 2023-09-06 16:05:59 +00:00
Jacek Sieka b76bac752f
avoid importing `ecnist` when not needed (#942) 2023-08-30 11:39:48 +02:00
diegomrsantos c6aa085e98
Prevent concurrent IWANT of the same message (#943) 2023-08-21 16:34:24 +02:00
Ludovic Chenut e03547ea3e
Perf protocol (#925) 2023-08-14 17:25:55 +02:00
diegomrsantos f80ce3133c
Bandwidth estimate as a parameter (#941) 2023-08-14 17:03:46 +02:00
Tanguy d6263bf751
nim-websock new version compatibility (#939) 2023-08-02 17:10:31 +02:00
Tanguy 7a369dd1bf
GossipSub: Limit flood publishing (#911)
Co-authored-by: Diego <diego@status.im>
2023-07-31 11:13:51 +02:00
Tanguy b784167805
GossipSub: IDontWant (#934) 2023-07-28 10:58:05 +02:00
Tanguy 440461b24b
GS: improve handleIHave (#922) 2023-07-11 12:17:50 +02:00
Jacek Sieka fab1340020
avoid a few zeroMem (#932) 2023-07-11 12:17:28 +02:00
Tanguy 1721f078c7
Fix crash on empty write (#930) 2023-07-10 13:52:08 +00:00
Ivan Folgueira Bande 74c402ed9d
wstransport.nim: avoid re-raising 'TransportOsError' to avoid stopping `switch.accept` (#929) 2023-07-07 11:32:20 +02:00
diegomrsantos c45f9705ab
Gossipsub scoring improvements (#909) 2023-07-04 00:27:45 +02:00
Etan Kissling 81b861b34e
avoid `ProveField` warning in `crypto.init` (#915) 2023-06-29 15:28:25 +02:00
diegomrsantos f85d0f75ea
Handling Opt[PeerId] in logging (#923) 2023-06-28 17:00:33 +02:00
Tanguy 66f9dc9167
Remove all `Result.get()`s & `Option` -> `Opt` (#902)
Co-authored-by: Ludovic Chenut <ludovic@status.im>
Co-authored-by: Diego <diego@status.im>
2023-06-28 16:44:58 +02:00
Tanguy 1c4d0832ce
Add GossipSub ping (#912) 2023-06-21 10:40:10 +02:00
Tanguy 224f92e172
Fix #916 regression causing accept loop lockup (#919) 2023-06-20 14:18:49 +00:00
Tanguy 5efa089196
TCP transport: handle getObservedAddr errors (#918) 2023-06-20 10:25:29 +02:00
Tanguy 49dfa84c6f
Transports: handle TransportAbortedError properly (#916) 2023-06-14 15:55:56 +00:00
Tanguy a65b7b028f
GossipSub: remove peer if we can't establish sendConn (#886) 2023-06-14 17:23:39 +02:00
diegomrsantos 67711478ce
Consider dns as public address (#913) 2023-06-13 17:58:41 +02:00
Tanguy c28d8bb353
WS Transport: handle 'tls/ws' (#914) 2023-06-12 15:45:53 +00:00
Vaclav Pavlin 3725f6a95b
chore: add basic metrics for rendezvous (#905) 2023-06-07 15:45:06 +02:00
diegomrsantos 3640b4dd89
Autonat and HP changes (#899) 2023-06-07 15:26:58 +02:00
Tanguy 32085ca88a
Allow to override TCP connection timeouts (#903) 2023-06-07 14:27:32 +02:00
Tanguy c76d1e18ef
Remove nim 1.2 support (#907) 2023-06-07 11:12:49 +00:00
diegomrsantos 67102873ba
Fail only if all addresses in PeerRecord are invalid (#898)
Fixes https://github.com/waku-org/nwaku/issues/1768
2023-05-31 08:59:50 +02:00
diegomrsantos d40d324160
fix missing import (#897) 2023-05-26 10:36:39 +02:00
diegomrsantos a677b06273
Try a direct connection only if there isn't one already (#891) 2023-05-25 15:48:22 +02:00
diegomrsantos 6050cdef7e
Refinement of Hole Punching Service (#892) 2023-05-25 15:47:00 +02:00
Tanguy 225accd11b
Less warnings (#813)
Co-authored-by: Diego <diego@status.im>
2023-05-18 10:24:17 +02:00
diegomrsantos 7d6bc545e0
Handle dns addrs in HP service (#890) 2023-05-16 14:59:02 +02:00
Tanguy a1eb53b181
Fix gossipsub dOut handling (#883) 2023-04-26 13:44:45 +02:00
Tanguy db629dca25
Fix network protocol metrics typo (#874) 2023-04-26 09:52:06 +02:00
diegomrsantos a5666789b0
Hole Punching (#806)
Co-authored-by: Tanguy <tanguy@status.im>
2023-04-18 12:50:21 +02:00
diegomrsantos b7726bf68f
Dcutr (#824)
Co-authored-by: Tanguy <tanguy@status.im>
2023-04-14 16:23:19 +02:00
diegomrsantos 0221affe98
Invalid MA is ignored (#881) 2023-04-14 12:05:32 +00:00
diegomrsantos 80cca0ecac
Does not allow an empty MA (#877) 2023-04-06 14:19:01 +00:00
diegomrsantos 0041ed4cf8
Transport hole punching (#873)
Co-authored-by: Tanguy <tanguy@status.im>
2023-04-06 15:23:35 +02:00
Tanguy 95e98e8c51
Fix traffic metrics (#879) 2023-04-03 12:37:23 +00:00
Tanguy 4aa615c44c
GossipSub: TimedEntry & shortAgent fixes (#858) 2023-04-03 11:05:01 +02:00
Tanguy 6b61ce8c91
GossipSub: Better IWANT handling (#875) 2023-04-03 10:56:20 +02:00
Alvaro Revuelta 53b060f8f0
Add getters for conns and streams (#878) 2023-03-31 00:16:39 +02:00
diegomrsantos af5299f26c
Create an ObservedAddrManager and add an AddressMapper in AutonatService and AutoRelayService (#871)
Co-authored-by: Tanguy <tanguy@status.im>
2023-03-24 15:42:49 +00:00
Tanguy bac754e2ad
Various gossipsub fixes (#827) 2023-03-21 17:13:25 +01:00
Tanguy 8d5ea43e2b
Upgrade flow refactoring (#807) 2023-03-08 12:30:19 +01:00
Jacek Sieka e573238705
reexport public types (#872) 2023-03-06 15:36:10 +00:00
diegomrsantos ddeb7b3bd4
Handle when peers ask each other at the same time (#865) 2023-02-21 17:49:41 +01:00
Tanguy 408dcf12bd
Fix backward compatibility of #822 (#862) 2023-02-15 17:18:29 +01:00
Tanguy f7f1e89669
TCP Transport: enable NO_DELAY for clients (#822) 2023-02-14 10:35:44 +01:00
diegomrsantos 444b837923
Autonat doesn't ask an incoming peer (#857) 2023-02-09 17:40:04 +01:00
diegomrsantos f89bd0c77c
Autonat dials dns addrs (#856) 2023-02-09 16:53:46 +01:00
diegomrsantos e68186373b
Dialing addrs concurrently in autonat (#855) 2023-02-07 18:51:17 +01:00
diegomrsantos 266c7b117a
Add anyCompleted proc (#853) 2023-02-07 18:50:42 +01:00
Ludovic Chenut 0e28d3b828
Add the peerId to the transport.dial (#842) 2023-01-31 12:46:10 +01:00
diegomrsantos 4ace70d53b
Connect is able to force a new connection (#849) 2023-01-25 11:19:03 +01:00
Tanguy ca19f8fdbf
Autonat service: handle connections limits (#846)
Co-authored-by: diegomrsantos <diego@status.im>
2023-01-24 17:04:42 +01:00
Tanguy 351bda2b56
Add expected connections to connmngr (#845)
Co-authored-by: diegomrsantos <diego@status.im>
2023-01-23 22:28:39 +00:00
Tanguy c11772c94e
Happy new year! (#847) 2023-01-20 15:47:40 +01:00
Ludovic Chenut 489c115132
Autorelay service (#819) 2023-01-17 16:18:38 +01:00
Tanguy 166c0d1c87
Fix PubSub subscribe on connection race condition (#809) 2023-01-10 13:33:14 +01:00
Etan Kissling ba451196e8
Avoid closing connection on channel EOF (#816) 2023-01-06 15:18:16 +01:00
diegomrsantos 9f658c151e
Autonat refactoring (#834) 2023-01-06 11:14:38 +01:00
diegomrsantos e304ad0f7e
Remove unnecessary async (#836) 2023-01-05 15:02:52 +01:00
diegomrsantos 9532bff983
Ignore unknown answers (#831)
Co-authored-by: Tanguy <tanguy@status.im>
2022-12-23 16:49:25 +01:00
diegomrsantos 676786b00e
Add Autonat timeout (#829)
Co-authored-by: Ludovic Chenut <ludovic@status.im>
2022-12-22 19:29:31 +00:00
diegomrsantos d521c57b82
Handle dial error correctly (#830) 2022-12-22 17:33:59 +01:00
Tanguy 63e1872516
Fix yamux simultaneous closing (#823) 2022-12-16 18:14:40 +01:00
diegomrsantos 67ef25fae0
Autonat service (#814)
Co-authored-by: Tanguy <tanguy@status.im>
2022-12-16 11:32:00 +00:00
Ludovic Chenut a17cad710c
Fix devel 32bits (#818) 2022-12-09 17:23:33 +01:00
Tanguy 3863a4cd21
Allow connect with known PeerId in MA (#817) 2022-12-08 16:11:55 +00:00
Tanguy 64cbbe1e0a
Limit number of streams per protocol per peer (#811) 2022-12-01 12:20:40 +01:00
diegomrsantos b3d9360dfc
Starting switch two times does not crash (#810) 2022-11-29 15:21:51 +00:00
Tanguy 1711c204ea
Fix: big messages in pubsub (#808) 2022-11-24 16:43:45 +00:00
Tanguy c43aacdc81
WS: add timeout to handleRequest (#796) 2022-11-22 10:44:08 +01:00
Alvaro Revuelta 192cac6254
Store missing pubkey in PeerStore [KeyBook] (#804) 2022-11-21 10:55:25 +01:00
Dmitriy Ryajov 8c2eca18dc
Allow passing max message size (#800)
Co-authored-by: Tanguy <tanguy@status.im>
2022-11-15 14:01:14 +01:00
diegomrsantos 6ab6ab48ef
Fix after gcsafe requirements change and other issues on devel (#795) 2022-11-05 02:04:05 +01:00
diegomrsantos d9305bda84
Add Tor Transport support (#765) 2022-11-04 19:20:23 +01:00
Lorenzo Delgado f95eda8bf6
Add libp2p label to chronicles log topics (#794) 2022-11-04 11:19:27 +01:00
Tanguy c9c2f6acdb
Tron example (#775)
Co-authored-by: lchenut <ludovic@status.im>
2022-10-30 08:49:02 +01:00
Tanguy c39c1cbf68
Fix daily CI (#790) 2022-10-29 23:26:44 +02:00
lchenut b4f96721af
Add a tutorial for the discovery manager (#787)
Co-authored-by: Tanguy <tanguy@status.im>
2022-10-29 10:12:12 +00:00
Tanguy dc13ff81d3
Revert "Temporarily remove failing test (#788)" & fix tests (#789)
Co-authored-by: Ludovic Chenut <ludovic@status.im>
2022-10-26 11:07:31 +02:00
Tanguy 4b105c6abd
GossipSub tutorial (#784) 2022-10-21 17:00:36 +02:00
Tanguy a086fcba72
Remove shallow copies (#782) 2022-10-20 14:52:02 +02:00
Tanguy 7b103e02f2
Allow public address mapping (#767) 2022-10-20 12:22:28 +02:00
lchenut 32233d36c8
Discovery interface (#783)
Co-authored-by: Tanguy <tanguy@status.im>
2022-10-03 22:00:00 +00:00
lchenut 1c99aca054
RendezVous Protocol (#751) 2022-09-30 10:41:04 +02:00
diegomrsantos 4f18dd30e9
Handle trying to write empty byte seq (#780) 2022-09-29 20:02:10 +02:00
Tanguy 0cd3554ce4
Bump deps (#779) 2022-09-29 10:29:51 +02:00
Tanguy fa5d102370
Better dnsaddr resolving (#753) 2022-09-26 11:03:24 +02:00
diegomrsantos a56c3bc296
Make observedAddr optional (#772)
Co-authored-by: Tanguy <tanguy@status.im>
2022-09-22 21:55:59 +02:00
Tanguy 5e7e009445
Move relay & autonat to connectivity folder (#769) 2022-09-15 09:43:40 +02:00
Tanguy 72abe822c0
Fix switch failed start (#770) 2022-09-15 07:06:32 +00:00
lchenut 4d8b50d24c
Specify EOF error (#759) 2022-09-14 10:58:41 +02:00
Tanguy ef594e1e02
Only log multiple missed heartbeats as info (#763) 2022-09-12 17:09:10 +02:00
diegomrsantos d8a9e93ff7
Add onion3 multiaddr support (#764) 2022-09-08 17:10:11 +02:00
Tanguy abbeaab684
Keep connection alive when peer doesn't support pubsub (#754) 2022-09-06 13:20:42 +02:00
Jacek Sieka dfbfbe6eb6
allow connection to a peer with unknown PeerId (#756)
Co-authored-by: Tanguy <tanguy@status.im>
2022-09-05 14:31:14 +02:00
lchenut 1de7508b64
Fix typos (#761) 2022-09-02 18:40:14 +00:00
Tanguy 3ffc03ed16
Gossipsub: Rebalance mesh immediately when peer sub/unsub (#719) 2022-09-02 10:24:54 +02:00
lchenut 2332813873
Autonat protocol (#739) 2022-08-23 17:49:07 +02:00
Tanguy 2d864633ea
ConnManager connection tracking refacto (#749) 2022-08-03 16:48:19 +02:00
Miran 2fbe82bf9d
make it more Nim 1.4+ compatible (#742) 2022-08-03 13:33:19 +02:00
lchenut a9a7e7eb15
Yamux metrics and limits (#740)
* Add yamux channel gauge
* Add limit to channel
* Add recv/send queue length metrics
* Add yamux stream tracking
* Add timeout to YamuxChannel

Co-authored-by: Tanguy <tanguy@status.im>
2022-08-01 12:52:42 +00:00
lchenut 34c2fb8787
Circuit relay v2 (#717) 2022-08-01 14:31:22 +02:00
tersec 1e598a0239
topicIDs -> topicIds; PubsubPeerEvent -> PubSubPeerEvent; messageIDs -> messageIds (#748) 2022-07-27 17:14:05 +00:00
tersec 4ca1c2d7ed
--styleCheck:error (#743)
* --styleCheck:error

* PeerID -> PeerId

* other libp2p styleCheck changes

* MessageID -> messageId; topicID -> topicId
2022-07-27 11:47:50 +00:00
lchenut 912873f8b3
Replace table by seq for storing muxers (#741)
Replace table by seq for stocking muxers
2022-07-22 12:54:09 +02:00
Tanguy 533e39ef94
Yamux (#704)
Co-authored-by: Ludovic Chenut <ludovic@status.im>
2022-07-04 15:19:21 +02:00
Tanguy d0523fdc9d
Documentation (#716) 2022-07-01 20:19:57 +02:00
lchenut 0ece5eaf12
Start/stop protocols (#730)
Starting/stopping a switch now starts/stops all protocols mounted on that switch
2022-06-30 11:21:33 +02:00
Jacek Sieka e6440c43c2
lower log level of no-peers message (#735)
the number of peers sent to is returned from the function - the caller
can log this, if need be
2022-06-30 09:57:07 +02:00
Jacek Sieka 597abddba7
don't increase seqno when anonymizing (#734) 2022-06-30 09:56:49 +02:00
Tanguy 5d7024f2e0
Handle more cancellations (#733)
* Mplex: handle write cancellation
* LpChannel: Don't close connection on EOF
2022-06-24 11:11:23 +02:00
Tanguy a7e335e1bb
Remove Br prefix from BearSSL (#728)
ref status-im/nim-bearssl#27
2022-06-16 10:08:52 +02:00
lchenut 36f3132d9a
Fix compilation error on nim 1.4 (#723) 2022-05-27 12:51:56 +02:00
Tanguy ca3f4e8701
builder: Expose MaxChanCount (#722) 2022-05-25 15:59:42 +00:00
Tanguy 7323ecc9c4
Optimize rebalanceMesh (#708) 2022-05-25 12:59:33 +02:00
Tanguy 60becadcf9
Peer store refacto (#700)
There is now a global PeerStore structure (instead of having one for libp2p, one for waku, etc)

The user can create custom books for new types easily

Also add a pruning system to remove dead peers
2022-05-25 12:12:57 +02:00
Tanguy 1696d0c707
Set activity flag in WS (#721) 2022-05-24 19:41:05 +00:00
Tanguy d4ff1c88e9
Less warnings (#710) 2022-05-24 15:10:57 +02:00
lchenut 13503f3799
Circuit relay v1 (#670)
Circuit relay v1
2022-05-18 10:19:37 +02:00
Tanguy 991549f391
Gossipsub scoring fixes (#709)
* Use decayInterval as a scoring heartbeat period
* Take mesh delivery window into account
2022-05-11 10:38:43 +02:00
lchenut 32ca1898d9
Gossipsub: Put Peer Exchange behind a flag (#715)
Add a flag to enable Peer Exchange in Gossipsub (disabled by default)
2022-05-10 10:39:43 +02:00
Tanguy 9ba5c069c8
Update SPR when the PeerInfo changes (#711) 2022-04-13 09:35:28 +02:00
Tanguy c97befb387
Add tests for gossipsub direct peers (#707) 2022-04-12 14:03:31 +00:00
tersec fc6b8f46f1
encrypt and decrypt empty sequences (#713)
* encrypt and decrypt empty sequences

* use assign in curve25519
2022-04-12 10:41:48 +00:00
Csaba Kiraly 9973b9466d
expose more libp2p performance and queuing metrics (#678)
* gossipsub: adding duplicate arrival metrics

Adding counters for received deduplicated messages and for
duplicates recognized by the seen cache. Note that duplicates that
are not recognized (arrive after seenTTL) are not counted as
duplicates here either.

* gossipsub: adding mcache (message cache for responding IWANT) stats

It is generally assumed that IWANT messages arrive when mcache still
has the message. These stats are to verify this assumption.

* libp2p: adding internal TX queuing stats

Messages are queued in TX before getting written on the stream,
but we have no statistics about these queues. This patch adds
some queue length and queuing time related statistics.

* adding Grafana libp2p dashboard

Adding Grafana dashboard with newly exposed metrics.

* enable libp2p_mplex_metrics in nimble test

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-04-06 16:00:24 +02:00
Tanguy eaa72dcdbe
WS Accept timeout (#699)
* Add timeout to WS accept
* Handle more WS errors
2022-03-17 10:16:48 +01:00
Tanguy c7504d2446
Gossipsub peer exchange (#647)
* Signed envelopes and routing records
* Send signed peer record as part of identify (#649)
* Add SPR from identify to new peer book (#657)
* Send & receive gossipsub PX
* Add Signed Payload

Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com>
2022-03-14 09:39:30 +01:00
Eric Mastro 44a7260f07
fixes from #688 (#697)
* tests: invert message logic on expect from #688
* fix: export pubsub_errors for backward compatibility
2022-02-24 17:32:20 +01:00
Tanguy c09d032133
Allow force dial (#696) 2022-02-24 17:31:47 +01:00
Tanguy fd59cbc7a9
Fix shuffle of #638 2022-02-21 17:00:18 +01:00
Tanguy bc318084f4
GS: Publish to fanout when mesh unhealthy (#638)
* Send to fanout when mesh unhealthy

* don't use fanout when floodPublish
2022-02-21 16:22:08 +01:00
Eric Mastro 3b718baa97
feat: allow msgIdProvider to fail (#688)
* feat: allow msgIdProvider to fail

Closes: #642.

Changes the return type of the msgIdProvider to `Result[MessageID, string]` so that message id generation can fail.

String error type was chosen as this `msgIdProvider` mainly because the failed message id generation drops the message and logs the error provided. Because `msgIdProvider` can be externally provided by library consumers, an enum didn’t make sense and a object seemed to be overkill. Exceptions could have been used as well, however, in this case, Result ergonomics were warranted and prevented wrapping quite a large block of code in try/except.

The `defaultMsgIdProvider` function previously allowed message id generation to fail silently for use in the tests: when seqno or source peerid were not valid, the message id generated was based on a hash of the message data and topic ids. The silent failing was moved to the `defaultMsgIdProvider` used only in the tests so that it could not fail silently in applications.

Unit tests were added for the `defaultMsgIdProvider`.

* Change MsgIdProvider error type to ValidationResult
2022-02-21 16:04:17 +01:00
Tanguy 00e1f9342f
Fix identify log for json_sink (#690) 2022-02-01 18:35:48 +01:00
Tanguy 07da14a7a7
Fix websocket EOF reading exception (#689) 2022-01-28 18:05:07 +00:00
Tanguy c18830ad33
Score correctly on mesh peer unsub (#644)
* Score correctly on mesh peer unsub
* remove from mesh before removing from gossipsub
2022-01-15 12:47:41 +01:00
Tanguy 1a97d0a2f5
Validate pubsub subscriptions (#627)
* Check topic before subscribing
* Block subscribe to invalid topics
2022-01-14 12:40:30 -06:00
Tanguy f3dee6865c
Chronos strict exception tracking (#652)
* Enable chronos strict exception tracking ( -d:chronosStrictException )
2022-01-05 16:27:33 +01:00
Dmitriy Ryajov dffe4bed45
mitigate high traffic - drop faulty peers (#460)
Only allow 1 connection per peer

Co-authored-by: Tanguy <tanguy@status.im>
2022-01-04 11:21:24 +00:00