Commit Graph

563 Commits

Author SHA1 Message Date
vyzo 4727d5b849 don't preallocate result array, we don't know how long it will be 2019-04-20 01:40:29 +03:00
vyzo c09717275b compute relay address set dynamically 2019-04-20 00:54:44 +03:00
vyzo f4f924e1d4 don't track relay addrs, use the peerstore 2019-04-20 00:04:26 +03:00
vyzo bd22c49b0d remove redundant private addr check when constructing our relay address set
findRelays cleans up address sets now for addrsplosion, and this removes private
addrs as well.
2019-04-19 20:49:54 +03:00
vyzo f17a4a8667 preallocate map in sameAddrs 2019-04-19 20:03:53 +03:00
vyzo ebc5d16f5d use a map in sameAddrs to avoid quadratic behaviour 2019-04-19 20:03:53 +03:00
vyzo 3697552406 handle misbehaving peers in identify push 2019-04-19 20:03:53 +03:00
vyzo c73f68bdb4 explicit Start method for basic host 2019-04-19 20:03:53 +03:00
vyzo c9b2f468ba reduce peer count in TestFuzzManyPeers when running under the race detector 2019-04-19 20:03:53 +03:00
vyzo 5845909754 add initialization delay in basic host background task 2019-04-19 20:03:53 +03:00
vyzo 7502fc44c9 add a background task in basic host that periodically pushes identify if needed 2019-04-19 20:03:53 +03:00
vyzo 8fa257cdf0 track context given in identify constructor and use it to gate identify push 2019-04-19 20:03:53 +03:00
vyzo bf651ca7c7 use a single, NoDial context in identify push 2019-04-19 20:03:53 +03:00
vyzo 9b2731e5bb used named constants for dns address protocols 2019-04-19 19:48:28 +03:00
vyzo a8d14f9b02 use addresses from the peerstore if available 2019-04-19 14:09:56 +03:00
vyzo ff4b98a6fc some more addrsplosion tests 2019-04-19 13:58:45 +03:00
vyzo 21c4e1d298 test for privately bound port first when cleaning up addrsplosion 2019-04-19 13:58:10 +03:00
vyzo 528c473840 filter relay addrs in address set cleanup 2019-04-19 13:53:27 +03:00
vyzo 9d7f6b83e5 rewrite isDNSAddr to use ma.SplitFirst 2019-04-19 13:48:18 +03:00
vyzo e82eabe130 cover the case where we can't select a default port in addrsplosion clean up 2019-04-18 14:49:42 +03:00
vyzo a331f99b65 addrsplosion test 2019-04-18 14:42:31 +03:00
vyzo 433a0c0908 extract cleanupAddrSet and implement better heuristic 2019-04-18 14:42:06 +03:00
vyzo 4a4b14819a add comment about eliding the lock on addrs read 2019-04-18 11:42:20 +03:00
vyzo a88ae79f6f use transientTTL for invalidated addrs instead of 0 2019-04-16 21:09:15 +03:00
vyzo 06391d4f2f replace peer addresses in identify 2019-04-16 11:49:32 +03:00
vyzo 27f465ee35 some better logging 2019-04-14 21:30:59 +03:00
vyzo 0830634938 limit number of FindPeer queries in relay selection 2019-04-14 21:19:19 +03:00
vyzo 0c69da9409 move the address invalidation check outside the lock 2019-04-14 17:50:22 +03:00
vyzo 8d5c11c072 fix private->public->private transition issues with address set 2019-04-14 17:40:16 +03:00
vyzo e8e2ab1930 limit relay selection to 20 2019-04-14 17:01:17 +03:00
vyzo c8b8014fd0 gate retry wait with the context 2019-04-14 16:36:52 +03:00
vyzo 376379b5b8 retry to find relays if we fail to connect to any 2019-04-14 16:34:11 +03:00
vyzo 4a6e767da2 log and ignore relay peers with empty address sets 2019-04-14 16:03:58 +03:00
vyzo 081bb0f7ed small tweak in autorelay test 2019-04-14 15:55:45 +03:00
vyzo 8c7da83b55 also check private addresses when looking for 4001 2019-04-14 15:47:46 +03:00
vyzo da65fd74a6 fix and reinstate autorelay test 2019-04-14 15:37:20 +03:00
vyzo 45d2888617 don't drop ephemeral ports in address set clean up 2019-04-14 15:37:01 +03:00
vyzo c9f627e221 increase FindPeer timeout to 30s 2019-04-14 15:06:15 +03:00
vyzo 31dfaf6029 increase relay advertising boot delay to 15min 2019-04-14 14:53:30 +03:00
vyzo 1138fb6040 only determine default port if it is in a public addr 2019-04-14 14:37:33 +03:00
vyzo becb89a245 shuffle relay set before queries 2019-04-14 14:32:31 +03:00
vyzo 39f2b7ad45 fix selectRelays to return promptly when there are query errors 2019-04-14 14:25:30 +03:00
vyzo 765ed0e1a6 select 50 relays 2019-04-14 14:13:36 +03:00
vyzo 9863e22d4a rework relay selection logic 2019-04-14 14:06:13 +03:00
vyzo aa03a9b839 clean up relay address sets to curtail addrsplosion 2019-04-14 12:58:41 +03:00
vyzo a1ebc4d852 reduce relay find peer and connect timeout to 30s 2019-04-13 23:46:41 +03:00
vyzo ffd4981247 increase autorelay discovery limit to 1k 2019-04-13 22:36:29 +03:00
vyzo 1e48e15da7 respect NoDial option in routed host 2019-04-10 23:12:14 +03: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 f4af8d493d fix identify tests 2019-04-09 13:20:38 +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
Steven Allen aebe405680 test: disable TestAddAddrsProfile when the race detector is enabled 2019-04-08 18:30:59 -07:00
whyrusleeping a7eb2efe4b move things outside of the lock in obsaddr 2019-04-08 16:14:05 -07:00
Steven Allen 9fbcf243f9
Merge pull request #577 from libp2p/fix/only-reported-addrs
identify: be more careful about the addresses we store
2019-04-08 10:20:09 -07:00
Steven Allen bcbf7a59c1 identify: only record observed addresses that match an address we're announcing
This is should prevent us from, e.g., announcing relay addresses _just_ because
a peer tells us we're reachable through a relay.
2019-04-08 10:15:42 -07:00
Steven Allen 7093262620 relay: update documentation 2019-04-06 08:12:29 -07:00
vyzo 45df977d57 bump relay record limit to 50 2019-04-06 12:22:12 +03:00
Steven Allen 5b665643c7 relay: only stop advertising relay addresses if we fully disconnect 2019-04-05 19:54:31 -07:00
Steven Allen 80ada8a7d6 relay: no more wrapping
We don't need the host wrappers, we can just replace the filter AddrsFactory.

Also, always filter out relay addresses.
2019-04-05 19:54:26 -07:00
Steven Allen 544c412193 identify: only store _reported_ multiaddrs
We still tell the remote host about the observed addr but we don't store it.
That way, we give them a chance to decide if they want to actually use and
advertise it.

Ideally, we'd distinguish between local information and signed routing
information but we don't do that yet.

This should reduce the address explosion issue where peers learn about
multiple (bad) observed addresses for the same peer. It should also give peers
more control over how they can be dialed.
2019-04-05 13:57:50 -07:00
vyzo 62531f9a10 reduce autorelay boot delay to 20s 2019-04-03 17:27:03 +03:00
vyzo bace7d4ceb autorelay: correctly handle private->public transition 2019-04-03 12:02:49 +03:00
vyzo c3b5ece119 reduce autorelay discovery timeout to 30s 2019-04-03 11:51:26 +03:00
vyzo e2412502a6 reduce autorelay boot delay to 30s 2019-04-03 11:44:16 +03:00
Steven Allen 16a60f9751 reduce nat error level 2019-03-28 02:20:06 +00:00
vyzo 9a5a437772
Merge pull request #563 from libp2p/fix/simplify-unspecific-relay
relay: simplify declaration of multiaddr var
2019-03-18 15:43:59 +02:00
Lars Gierth 7741442478 relay: simplify declaration of multiaddr var 2019-03-18 13:29:00 +01:00
lnykww 5da711dc6c Fix UDP listen on a Unspecified Address and Dial from the Unspecified Address
LocalMultiaddr May return the Unspecified Address, if so, we need to
check if we listen on the Unspecified address and they were equal.
2019-03-14 10:57:19 +08:00
Leonhard Markert 2a7478131a
Fix typos in p2p/net/README.md
"Requet" -> "Request", "tls" -> "TLS"
2019-03-07 03:23:01 +00:00
Steven Allen 5c51323aa2 mock: increase tolerance for latency tests
These were exceeding their tolerances when run under the race detector on CI.
2019-03-06 12:01:08 -08:00
Steven Allen 5b643cde2d mock: reduce peer count in FuzzManyPeers when the race detector is enabled 2019-03-06 11:27:28 -08:00
Steven Allen e96aefc3b3 autorelay: disable consistantly failing auto-relay test 2019-03-06 11:21:25 -08:00
Steven Allen 58f40b9d11 mocknet: fix data race 2019-03-06 11:08:14 -08:00
Steven Allen 8c8f08e36f natmgr: rename refresh to sync 2019-03-06 10:56:49 -08: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
Jakub Sztandera 533d9866c6 gx publish 6.0.34 2019-02-18 16:01:43 +01:00
Matt Joiner 3b8d83ffdc
Resolve addrs with P2P instead of IPFS (#539) 2019-02-16 12:43:11 +11:00
iulianpascalau b8e47c5dea mock package:
- changed GetStreams function from mock_conn.go to call allStreams which has the same functionality but is concurrent safe
- changed protocol field from mock_stream to be concurrent safe. Taken the implementation from swarm_stream.go
2019-02-14 20:19:03 +02:00
vyzo 7fa37513fd increase initial relay advertisement delay to 30s 2019-02-14 19:26:13 +02:00
vyzo 3a993345d0 use PeerRouting in autorelay to find relay peer addresses 2019-02-12 10:56:54 +02:00
vyzo c5f50f9c2d don't advertise the raw public address in autorelay 2018-12-21 11:20:09 +02:00
Steven Allen 758b516603 mock: export ratelimiter as RateLimiter
Technically a breaking change because I changed the constructor casing but
nobody's using this outside of libp2p (yet), mostly because the type hasn't been
exported.
2018-12-18 21:22:17 -08:00
vyzo a4827ae9dd
Merge pull request #500 from libp2p/feat/autorelay-option
explicit option to enable autorelay
2018-12-05 17:36:47 +02:00
vyzo e0429051e6
Merge pull request #495 from libp2p/fix/advertise-relay
Add delay in initial relay advertisement to allow the dht time to bootstrap
2018-12-05 17:36:16 +02:00
vyzo 5d0a6e23ce use select for initial advertisement delay 2018-12-05 10:02:56 +02:00
vyzo a1b5b9ed53 explicit option to enable autorelay 2018-12-04 12:09:52 +02:00
Abhishek Upperwal 36a2645306 removing redundant if condition 2018-12-02 01:00:46 +05:30
Abhishek Upperwal 3ae2d75e46 added comments for clarity 2018-12-02 00:56:46 +05:30
Abhishek Upperwal 88d98287ff suppressing error msg for NoSecurity option 2018-11-30 16:54:25 +05:30
vyzo 31eb77d446 add delay in initial relay advertisement to allow the dht time to bootstrap 2018-11-29 12:24:40 +02:00
Steven Allen 053f59e053
Merge pull request #480 from libp2p/fix/mock-connect
mocknet: fix NewStream and self dials
2018-11-09 09:26:16 -08:00
Steven Allen 79ba610d21 mocknet: create a connection on NewStream if we need one
That's what the Swarm does and that's what the function's documentation says it
does.
2018-11-08 13:10:16 -08:00
Steven Allen a8e25bf270 mocknet: refuse to connect to self
The swarm does this as well and most of our services will fail if we don't have
this.
2018-11-08 13:10:07 -08:00
Steven Allen 00ba6a165a deflake identify test
This was probably failing (rarely) due to the fact that we're shrinking the
timeout asynchronously (I think?).
2018-11-08 10:49:57 -08:00
Steven Allen f4229470cb mocknet: use peer ID in peer address
RandLocalTCPAddress is mostly useful when we *actually* want to listen on a real
address. Unfortunately, when running a bunch of tests, we can actually run
out.

With this change, a collision means we have a duplicate peer ID so yeah...

fixes #473
2018-11-07 15:42:29 -08:00
vyzo a309f09606 Add note to relay docs about internal interface instability 2018-11-06 09:50:25 +02:00
vyzo 5a1c09c4af use advertised addrs for autonat dial back, not all addrs 2018-11-04 10:52:29 +02:00
vyzo 5d8988f3ee add comment about the unstable nature of BasicHost.PushIdentify 2018-11-04 10:52:29 +02:00
vyzo 69144bd78b extend autorelay test to verify pushing of relay addrs
also check that we don't initially advertise any.
2018-11-04 10:52:29 +02:00
vyzo 0dfca3ba5d increase test AutoNATIdentifyDelay to 100ms
macosx seems to fail intermittently, and that race is the likely culprit.
2018-11-04 10:52:29 +02:00
vyzo 7b324b14b5 remove BasicRouting interface; use PeerRouting and upcast for discovery 2018-11-04 10:52:29 +02:00
vyzo c2d846a7c3 fix go vet issue 2018-11-04 10:52:29 +02:00
vyzo fdfa224699 document doUpdateAddrs 2018-11-04 10:52:29 +02:00
vyzo 4be7ada37b tag relay connections 2018-11-04 10:52:29 +02:00
vyzo e96605d1a3 use /p2p multiaddr 2018-11-04 10:52:29 +02:00
vyzo 84400e22f2 fix typo 2018-11-04 10:52:29 +02:00
vyzo 4f90393629 add a comment 2018-11-04 10:52:29 +02:00
vyzo 67aba4d501 move relay selection strategy out of line 2018-11-04 10:52:29 +02:00
vyzo cc2dd22028 make randezvous key a constant 2018-11-04 10:52:29 +02:00
vyzo 2993fd9a68 add autorelay documentation 2018-11-04 10:52:29 +02:00
vyzo a7e1bf0f15 call the routing interface BasicRouting, alias to top level type 2018-11-04 10:52:29 +02:00
vyzo 89aef893e6 don't adveretise unspecific relay addrs in RelayHost 2018-11-04 10:52:29 +02:00
vyzo dcb8fd2813 fix inverted address selection logic in test 2018-11-04 10:52:29 +02:00
vyzo ee69383c2c extend autorelay test to verify connectivity 2018-11-04 10:52:29 +02:00
vyzo b62c83bd5c better limit adjustment for relay discovery 2018-11-04 10:52:29 +02:00
vyzo f6c38c9d91 filter unspecific relay address 2018-11-04 10:52:29 +02:00
vyzo c6d1eebf15 autorelay test 2018-11-04 10:52:29 +02:00
vyzo 7fabe39290 parallel identify push 2018-11-04 10:52:29 +02:00
vyzo 477c19aac1 reduce boot delay to 60s 2018-11-04 10:52:29 +02:00
vyzo 0ff7393349 fix announced relay address 2018-11-04 10:52:29 +02:00
vyzo 6bdfcac0b4 use AllAddrs as the address factory in autonat 2018-11-04 10:52:29 +02:00
vyzo 5c623f269f name the autorelay logger as such 2018-11-04 10:52:29 +02:00
vyzo 9795a01ba3 configurable boot delay for autorelay 2018-11-04 10:52:29 +02:00
vyzo a5858912d6 autorelay hosts 2018-11-04 10:52:29 +02:00
vyzo a89e74a155 basic host: export AddrsFactory, provide method to push identify 2018-11-04 10:52:29 +02:00
vyzo 4ea04c23b3 identify: implement identify push protocol 2018-11-04 10:52:29 +02:00
Steven Allen 80c5998236 *really* fix the race in mock 2018-10-24 12:58:51 -07:00
Steven Allen 841a6272c6 fix a data-race in the mock net
This was causing https://github.com/ipfs/go-ipfs/pull/5637#issuecomment-432792969
2018-10-24 12:41:12 -07:00
Steven Allen 63256192d7 fix buggy addr equal in test 2018-10-24 08:44:26 -07:00
Steven Allen 7eaeeaa9fe
Merge pull request #461 from libp2p/fix/remove-protocol-version-check
don't disconnect on protocol version mismatch
2018-10-24 07:35:23 -07:00
Steven Allen dd7868a1a7 don't disconnect on protocol version mismatch
Sending a protocol version is nice. However, this "disconnect if our versions
are different" logic makes the version entirely useless (because we can't change
it).

Really, each indevidual protocol is versioned so let's just leave it at that. If
we make a breaking change that requires a protocol bump, we can do that and
then switch on the other side's version. However, we'll have to wait for the
entire network to upgrade for that to work.
2018-10-24 07:00:42 -07:00
vyzo 48e0effd6a resolve import cycle in ping test 2018-10-19 12:47:08 +03:00
vyzo 0fa1c25479 ping service in basic host 2018-10-19 12:28:58 +03:00
vyzo a768598c50 free standing Ping function 2018-10-19 12:22:13 +03:00
vyzo 1536433f6b use TempAddrTTL for relay addrs 2018-10-18 18:37:35 +03:00
vyzo c52f45235d simplify routed relay addr check
the first component must be P_P2P, or else we have a specific address to dial
2018-10-08 15:04:43 +03:00
vyzo dd9b96f702 check for old-style relay addrs 2018-10-06 09:40:24 +03:00
vyzo f3c4a0c48b fix relay-specific address dialing in routed host 2018-10-05 23:01:22 +03:00
Steven Allen 27f502e525
Merge pull request #443 from libp2p/fix/log-spam
downgrade protocol mux failure log to debug
2018-10-04 17:41:02 -07:00
vyzo e7fc8861f9 downgrade protocol mux failure log to debug 2018-10-01 10:34:39 +03: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 b4e4d496ea Fix test 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
QYuan 38abbc9128
Delete extra comments 2018-09-21 10:33:15 +08:00
vyzo 1959dde238
Merge pull request #423 from KerwinKoo/master
Just repair spelling mistake
2018-09-14 12:09:26 +03:00
gukq 2ea753ece0 Just repair spelling mistake
Signed-off-by: gukq <gukaiqiang@gmail.com>
2018-09-14 17:03:39 +08:00
Steven Allen 8f826ec266
Merge pull request #412 from cannium/deduplicate-addrs
Deduplicate addresses of host output
2018-09-13 23:04:09 +00:00
Can ZHANG e6b1e07f11 Updates due to code review 2018-09-13 11:38:16 +08:00
Steven Allen e436bcc391 always remove connection from identify service map
fixes #419

Also call FullClose in a goroutine; no need to block this.

(not happy with that but I'm starting to think we need to rethink stream
closing, again...)
2018-09-10 15:51:09 -07:00
Steven Allen c46e8d6e36 gx: update go-libp2p-peerstore 2018-09-07 22:11:23 -07:00
Can ZHANG ef51fdbe09 Deduplicate addresses of host output 2018-09-07 16:06:16 +08:00
Steven Allen bb971794b7 disable mdns logging from init
(avoids the race condition)
2018-09-02 14:31:46 -07:00
Marten Seemann 0d38750db8 use the new DisableLogging mdns option, don't turn off logging globally 2018-08-31 12:08:18 +07:00
Cole Brown 5a704d2daa Add Stat to mock net conns and streams 2018-08-27 17:30:51 -07:00
Steven Allen 7d6f9521c2
Merge pull request #380 from libp2p/fix/reset-ping-stream
always reset ping streams when done
2018-08-21 05:22:22 +00:00
Steven Allen 6f0dcfa108
Merge pull request #389 from libp2p/fix/mock-streams
mock stream fixes
2018-08-16 17:44:22 +00:00
Steven Allen f0eba35c6e
Merge pull request #388 from libp2p/fix/id-reset
reset when we fail in identify
2018-08-16 17:43:59 +00:00
Steven Allen c83318bf08 Revert "Merge pull request #386 from libp2p/fix/correct-external-addr"
This reverts commit aca83b9b63, reversing
changes made to 86b8929d4d.

This was is not the correct fix. We already expose these addresses via the
host's AllAddrs method. The real problem is probably that we just don't ever
tell anyone about them (unless we disconnect and reconnect to our nearby DHT
nodes).

We need an address gossip protocol.
2018-08-13 16:52:49 -07:00
Steven Allen f6ad991bb5 update gogo protobuf
and regenerate protobuf files
2018-08-08 18:08:13 -07:00
Steven Allen 784ff9c5a5 fix closing of mock streams in test 2018-08-08 13:37:29 -07:00
Steven Allen f56473fb01 make sure reset works on half-closed streams 2018-08-08 13:36:01 -07:00
Steven Allen 2e13245085 reset when we fail in identify 2018-08-08 11:48:45 -07:00
Steven Allen 7133f4124f when we do a nat port mapping, explicitly remember the mapped address
related to #383

I won't call this *fixed* yet but it should help.
2018-08-02 14:18:47 -07:00
Steven Allen 72df25af76 always reset ping streams when done
Currently, we leak a stream. We could use FullClose but, IMO, it's not worth it.
We might as well just reset and walk away.
2018-07-27 10:54:34 -07:00
Steven Allen b4428fda58 reduce error to warning and log the error
This happens all the time in tests where we intentionally use fake keys for
performance.

Anyways, users probably don't want their logs spammed with errors they can't do
anything about.
2018-06-15 14:27:22 -07:00
Steven Allen 74486ec970
Merge pull request #352 from libp2p/nit/optimize
check for connectedness using Connectedness
2018-06-14 18:44:06 +00:00
Łukasz Kurowski 39791b176c
function cannot be formatted as string 2018-06-12 21:39:29 +02:00
Steven Allen a361bf0394 check for connectedness using Connectedness
(counting open connections requires copying)
2018-06-09 10:23:09 -07:00
Steven Allen 1257b87aab
Merge pull request #346 from libp2p/bugs/mock-stream-latency
Add test which demonstrates how Mocknet latency works
2018-06-07 04:54:40 +00:00
Erin Swenson-Healey 2f001009f2 loosen tolerance in latency test 2018-06-06 07:49:29 -07:00
Erin Swenson-Healey bb9d55ac08 add test which demonstrates how Mocknet latency works 2018-06-05 17:35:18 -07:00
Steven Allen 41c6834850 refactor for transport changes
Also, make the libp2p constructor fully useful. There should now be no need to
manually construct a swarm/host.
2018-06-04 21:22:24 -07:00
Jakub Sztandera b6ae1d152a misc: downgrade a warning to info
It is source of most warning noise in Warning channel and we would like
to enable warning channel some time in future by default
2018-03-27 20:46:27 +02:00
Hector Sanjuan cc1c2af4b7 Update go-detect-race to latest packaged version and location
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2018-02-16 11:26:39 +01:00
Łukasz Magiera 498c841eb9 Skip TestMdnsDiscovery 2018-02-14 16:04:14 +01:00
Steven Allen 5f75373b53 make the identify test less racy 2018-01-27 21:14:08 -08:00
Alexey Kholupko 7c7bd31d3e mDNS discovery starts announcing right away: does not wait for first interval to elapse.
Closes #256
2018-01-27 16:32:58 +07:00
Steven Allen d7c4c0a202 add test for forgetting address records 2018-01-19 22:37:14 -08:00
Steven Allen ea95a94e78 register identify service netNotify
This way, we actually process disconnect notifications (and reduce the lifetime
on peer addr records).
2018-01-19 22:36:33 -08:00
Steven Allen 096a2c8303 fix peerstore apocalypse redux
This commit prevents us from repeatedly extending the lifetimes of all observed
addresses if a peer keeps on reconnecting.

It also fixes two race conditions:

1. We may end up processing a disconnect after a re-connect and may
accidentally give the addresses associated with that peer a
RecentlyConnectedAddrTTL instead of a ConnectedAddrTTL.

2. We may end up processing a connect after the associated disconnect storing
the associated peer addresses indefinitely.
2018-01-19 21:52:22 -08:00
Steven Allen 62f92f7e73 always make the host context cancelable
There's really no reason to *only* do this if we have relays enabled. Doing it
this way makes `go vet` happier and reduces conditional logic.
2017-11-16 17:34:48 -08:00
Kevin Atkinson af895a81d5 Fix most "go vet" errors. 2017-11-16 20:05:22 -05:00
Jeromy 85d0247d16 use connmgr interface instead of connmgr directly 2017-10-06 04:39:17 -07:00
Eric Harris-Braun 9d3b90d67e allow tag to be passed into NewMdnsService 2017-09-24 17:59:28 +02:00
Jakub Sztandera 0bef0c7426 Merge pull request #232 from libp2p/fix/log-message
basic_host: fix warning message
2017-09-21 13:27:35 +02:00
vyzo ecb14089a7 basic_host: fix warning message 2017-09-21 12:10:37 +03:00
Steven Allen 860d278469 make sure to not drop writes on close
Before, on close, we:

1. Weren't completing the write.
2. Flushing the buffer without waiting the latency delay.

This fixes that by using two separate channels for close/reset and ignoring the
close channel in deliverOrWait.
2017-09-13 23:05:17 -07:00
Steven Allen 17354d7768 get rid of debugging code 2017-09-13 16:14:45 -07:00
Steven Allen 34421451f5 reset on error in reconnect test 2017-09-13 15:57:12 -07:00
Steven Allen 925ac42502 Reset on error in ping. 2017-09-13 15:50:23 -07:00
Steven Allen 7cdd4bc984 Reset on error in basic_host 2017-09-13 15:49:53 -07:00
Steven Allen 1b9aa7789c update go-stream-muxer
* Fix the tests to work with separate reset/close methods.
* Ensure we interrupt writes on reset.
* Always delay the proper time even if we're sending short messages.
* Copy buffers as we send them. `Write` is not allowed to hang onto buffers. If
  we run into performance issues, we can always add a buffer pool.
2017-09-13 15:18:38 -07:00
Lars Gierth 3a57e7080d Merge pull request #211 from libp2p/fix/notify-tests
tests: update test cases to act like go-peerstream 1.7.0
2017-08-07 05:19:53 +02:00
Lars Gierth e0c5c22dbc Avoid unneccessary multiaddr resolutions 2017-08-07 05:08:01 +02:00
Lars Gierth 0c23c9684c Resolve /dns4, /dns6, /dnsaddr multiaddrs 2017-08-07 05:07:58 +02:00
Gurinder Singh 8f9170f6e2 Made the image render inline 2017-08-04 16:27:39 +05:30
vyzo 6be81d34c1 basic_host: take base context as parameter in NewHost 2017-08-02 11:04:59 +03:00
vyzo fd23cf6fa5 basic_host: add the relay after the host construction is complete 2017-08-02 10:58:28 +03:00
vyzo 7f1ffcbd4e basic_host: NewHost: don't panic on relay errors, return an error instead
The legacy interface stays unchanged with a panic though.
2017-08-01 19:36:09 +03:00
vyzo 3b6d61122f basic_host: integrate circuit relay as a transport with an option 2017-08-01 19:36:09 +03:00
Steven Allen 112866c35a tests: update test cases to act like go-peerstream 1.7.0 2017-07-27 14:35:29 -07:00
vyzo 3b2f464171 RoutedHost: use Connect directly in NewStream 2017-07-22 11:55:24 +03:00
vyzo daaf97b416 RoutedHost: NewStram ensures we have the means to connect to the peer 2017-07-21 13:22:53 +03:00
Jeromy 665234f694 WIP: add ConnManager interface method 2017-07-11 23:20:27 -07:00
Jeromy dfaa021cd7 gx publish 4.4.1 2017-07-11 16:08:52 -07:00
Enzo Haussecker e9c24fdc2d Create interface for NAT manager 2017-06-04 21:33:27 -07:00
Enzo Haussecker e571f8a3fb Publicize NAT manager struct 2017-06-03 04:32:47 -07:00
Lars Gierth f0453a2458 basichost: refactor BasicHost construction
There were previously 4 different ways of passing various options
into BasicHost construction.

1. Function parameters to New
2. Option parameters to New
3. Global variables, e.g. NegotiateTimeout
4. Options struct, in the calling code in go-ipfs

This changeset deprecated all of these, and introduces the HostOpts
struct to replace them. It also introduces a new constructor called
NewHost, which accepts a *HostOpts.

The old New constructor continues to work the same way,
but is from now on deprecated too.
2017-05-31 02:30:29 +02:00
Lars Gierth 6cbb93905b basichost: allow overriding Addrs() 2017-05-30 20:39:08 +02: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
Lars Gierth 12f881c55a Remove unused and unfit relay protocol 2017-03-12 03:37:01 +01:00
Jeromy 31557da822 fix multistream import paths 2017-01-10 07:22:30 -08:00
Jeromy 104c97ed57 update go-multistream and use negotiateLazy to allow for readonly streams 2017-01-05 08:10:26 -08:00
Jeromy 26adf7395b identify: make agent version mutable 2016-12-26 02:52:49 -08:00
Jeromy f4ea270ccb use set protos in identify protocol knowledge gathering 2016-11-18 15:09:18 -08:00
Jeromy f61f242f69 Extract netutil to its own package 2016-11-17 10:58:15 -08:00
Jeromy Johnson 9183b8afcf Merge pull request #150 from libp2p/feat/negotiate-timeouts
add negotiate timeout option to basichost
2016-11-10 17:05:44 -08:00
Jeromy 6bccc8c1f5 fix dial log 2016-11-10 16:01:42 -08:00
Jeromy 4f17a651d1 add negotiate timeout option to basichost 2016-11-10 12:40:38 -08:00
Jeromy 077aae473b make bandwidth metrics optional 2016-11-09 16:26:19 -08:00
Jeromy 6f804db71e update dependencies and add deadline methods to streams 2016-11-08 13:11:02 -08:00
Jeromy 232864175d make sure to always close streams when youre done with them 2016-11-05 15:26:07 -07:00
Jeromy 1bad77c7db update packages to add support for getStreams 2016-11-03 18:06:26 -07:00
Jeromy 0e7e451d69 extract NAT traversal code to its own lib 2016-10-24 17:18:49 -07:00
Jeromy 7aced371c7 extract libp2p-swarm 2016-10-05 10:34:57 -07:00
Jeromy 70872ff663 update deps 2016-10-04 21:18:07 -07:00
Jeromy 1a53ad77b9 extract host interface 2016-10-04 16:16:24 -07:00
Jeromy 9910e6a7cf switching to separated conn and interface-conn packages 2016-10-04 15:39:24 -07:00
Jeromy cea1fe131f extract net interface and metrics 2016-10-04 13:56:20 -07:00
Jeromy 0f3ffb2d07 extract conn, addr-util, and testutil 2016-10-04 13:03:14 -07:00
Jeromy 1085a07654 extract protocol and maddr-filter 2016-10-03 21:47:08 -07:00
Jeromy 4dd30d824b switch to using stdlib context package 2016-10-03 11:00:00 -07:00
Jeromy Johnson 87b0e20041 Merge pull request #121 from libp2p/fix/mdns-race
update mdns to version with fixed race condition
2016-09-29 17:28:00 -07:00
Jakub Sztandera 4172857109
fix locking issue introduced in 90eeff42fc 2016-09-29 15:32:27 +02:00
Jeromy 5b6ab8c326 update mdns to version with fixed race condition 2016-09-28 17:57:12 -07:00
Jeromy 2eef5a702e split tcp transports out of the base package 2016-09-25 04:51:27 -07:00
Jeromy Johnson 494ade379b Merge pull request #115 from libp2p/feat/improve-mdns
don't block on DiscoverHandler
2016-09-20 08:08:35 -07:00
Jeromy e6a5c5c241 don't block on DiscoverHandler 2016-09-20 00:28:58 -07:00
Jeromy 9441754369 swarm: add deadline for connection setup 2016-09-18 03:17:22 -07:00
Jeromy Johnson 4ae3510f1a Merge pull request #107 from libp2p/feat/better-dialsync
Improve swarm dial sync code
2016-09-16 15:12:07 -04:00
Jeromy Johnson d3f70d185e Merge pull request #114 from libp2p/feat/context-dial
conn/dial: implement contextDial up the stack
2016-09-16 15:11:27 -04:00