Commit Graph

46 Commits

Author SHA1 Message Date
Marten Seemann 99e8873fd4 identify: also match observed against listening addresses 2021-12-04 14:18:33 +04:00
Marten Seemann 9342776c9c allow concurrent calls to Close and SetTTL in the ObservedAddrManager 2021-09-07 13:48:07 +01:00
Marten Seemann 2cf1c457d5 don't use a context for closing the ObservedAddrManager 2021-09-05 18:30:11 +01:00
Cory Schwartz 04a93f4080 static check fixes 2021-04-29 14:08:24 -07:00
Aarsh Shah 69916ed465
Emit event for User's NAT Type i.e. Hard NAT or Easy NAT (#1042)
* emit NAT device type
2021-02-19 15:14:03 +05:30
Steven Allen 7a98f28856 feat: update to go-libp2p-core 0.7.0 interface changes
This patch updates go-libp2p for the stream interface changes in go-libp2p-core
0.7.0. This is a _significant_ breaking change to streams and all users should
read https://github.com/libp2p/go-libp2p-core/releases/tag/v0.7.0. In practice,
this change should remove a significant footgun.

TL;DR:

* `Stream.Close` now behaves like `net.TCPConn.Close`.
* There is a new `Stream.CloseWrite` (send an EOF) and `Stream.CloseRead` (close
  for reading), behaving like their counterparts in `net.TCPConn`.
2020-11-11 09:35:37 -08:00
Steven Allen 5ae0888629 fix(id): document observation struct 2020-06-04 14:57:07 -07:00
Steven Allen a03403fa64 fix: optimize numInbound count
We call this _very_ frequently when computing our local addresses.
2020-06-04 14:55:17 -07:00
Steven Allen 1dd7a8c4d4 fix: count observations with at least one inbound connection as inbound
We prefer addresses from inbound connections. We don't want outbound connections
to hide these perfectly good addresses.
2020-06-04 14:55:13 -07:00
Steven Allen a0813d7292 fix: make address observation types private
We don't use and/or expose these anyways. Making them private makes it easier to
reason about their state.
2020-06-04 14:55:10 -07:00
Steven Allen 6ef5f5dacf fix: group observations by zeroing port
In #917, we started dropping additional address observations if we had multiple
for the same transport set. However, on further consideration, this isn't quite
correct. We _want_ to keep additional observations for multiple IP addresses.
The real issue is many observations for different ports.

So this patch simply changes the key with which we group observations from
"address protocols" to "address without the port" (well, with the port set to
0).
2020-05-20 12:13:25 -07:00
Aarsh Shah 79ead33e32
Filter observed addresses (#917)
* filter observed addrs
2020-05-20 11:39:45 +05:30
Steven Allen 84b923c7bf fix: address code review 2020-04-24 23:54:07 -07:00
Steven Allen 06d9fc7987 fix: keep observed addrs alive as long as their associated connections are alive
Otherwise, if we're not creating new connections, we'll eventually forget them.

Up until now, this wasn't _too_ much of an issue because our peers would still
remember our addresses. However, we now _tell_ our connected peers when our
addresses change. That means we'll tell our peers to forget where we are,
preventing anyone from finding us.
2020-04-24 22:55:16 -07:00
Hector Sanjuan 7e49c66219 Identify: Make activation threshold configurable
Also: fix the comments and try to explain how the activation/aliveness of
addresses happen (and write the correct defaults).
2019-11-05 12:18:55 +01:00
Raúl Kripalani d87f89314c
Consolidate abstractions and core types into go-libp2p-core (#601) 2019-05-26 22:55:46 +01:00
vyzo a4776e6174 fix panic in observed address activation check
The activated check cleans up, which leads to panics with concurrent reads.
This moves the seenBy set clean up into gc, where it belongs
2019-04-09 21:52:40 +03:00
vyzo efdc140264 raise activation channel capacity to 16 2019-04-09 20:35:36 +03:00
vyzo fe7ba05e38 delete empty address sets on observed address set gc 2019-04-09 14:00:03 +03:00
vyzo 17001b24dd use a read/write lock for observed address set 2019-04-09 13:40:46 +03:00
vyzo 9b8192b7d2 initialize ttl in ObservedAddrSet 2019-04-09 13:19:54 +03:00
vyzo b8a152f593 use a background worker for updating/gcing the observed address set 2019-04-09 12:44:13 +03:00
vyzo e76c8a9c38 don't eagerly update the observed address set in Addrs
allocates and eats a lot of cpu time under the lock;
let a background worker gc periodically.
2019-04-09 12:13:30 +03:00
Steven Allen 316f0867f6 identify: avoid parsing/printing multiaddrs 2019-04-08 18:43:11 -07:00
whyrusleeping a7eb2efe4b move things outside of the lock in obsaddr 2019-04-08 16:14:05 -07:00
Steven Allen 3617750071 better nat mapping
1. Update to work with https://github.com/libp2p/go-libp2p-nat/pull/14.
2. Avoid observed addrs when our NAT tells us about external addrs.
3. Ignore bad addrs reported by our NAT. Substitute with observed addrs.
4. Fix https://github.com/libp2p/go-libp2p/issues/428.
2019-03-06 10:56:49 -08:00
Can ZHANG 92ec4b2d18 Updates due to code review 2018-09-29 20:16:09 +08:00
Can ZHANG 96df62bd5b Changes on discussion
- map internal -> []{external -> { observer -> [time, direction] } }
- some cleaning
2018-09-26 16:52:46 +08:00
Can ZHANG d859fb0dd7 Track more info for observed addresses 2018-09-26 16:52:46 +08:00
Jakub Sztandera ed98e37176
Extend time of observation by the factor of ActivationThresh 2017-04-24 20:26:15 +02:00
Jakub Sztandera 955ebe34a7
Fix obsaddr_test compare function 2017-04-24 20:26:15 +02:00
Jakub Sztandera 356f5ab17d
Modify ObservedAddrSet to better detect our active addrs 2017-04-24 20:26:10 +02:00
Jeromy 70872ff663 update deps 2016-10-04 21:18:07 -07:00
Jeromy 916bc557c3 split peerstore from peer package 2016-05-31 16:24:11 -07:00
Jeromy b0ad207270 rewrite all package paths to dvcs 2016-04-27 12:59:04 -07:00
Jeromy 15b28dc0ce recursive dependency update of utp lib 2016-04-27 10:12:51 -07:00
Jeromy 4f82ae5e62 move some deps out as gx packages 2016-04-11 23:24:32 -07:00
Jeromy 7b48e5bc4d update version of go-multiaddr 2016-03-03 13:03:24 -08:00
Jeromy ada8212cac path rewrites 2016-01-04 05:45:58 -08:00
Jeromy d91b419ecf WIP 2015-12-06 23:11:16 -08:00
Jeromy 9d40a0af19 migrate to gx namespace 2015-11-18 16:11:24 -08:00
Jeromy d4b42f8e45 fixes for sha3 2015-11-15 18:28:35 -08:00
Jeromy 216db146ca more vendoring 2015-11-15 11:56:01 -08:00
Jeromy 51fd99e363 extract from 0.4.0 2015-11-11 16:19:51 -08:00
Juan Batiz-Benet 2392434b6d rewrote imports to p2p 2015-09-30 19:24:00 -04:00
Juan Batiz-Benet 885d86219e move to p2p dir 2015-09-30 18:42:55 -04:00