aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
Commit message (Collapse)AuthorAgeFilesLines
* p2p/discover: attempt to deflake TestUDP_responseTimeoutsFelix Lange2015-12-181-1/+2
| | | | | The test expected the timeout to fire after a matcher for the response was added, but the timeout is random and fired sooner sometimes.
* p2p: resolve incomplete dial targetsFelix Lange2015-12-182-63/+175
| | | | | | This change makes it possible to add peers without providing their IP address. The endpoint of the target node is resolved using the discovery protocol.
* p2p, p2p/discover: track bootstrap state in p2p/discoverFelix Lange2015-12-186-91/+110
| | | | | | This change simplifies the dial scheduling logic because it no longer needs to track whether the discovery table has been bootstrapped.
* p2p/discover: support incomplete node URLs, add ResolveFelix Lange2015-12-187-54/+158
|
* p2p: always allow dynamic dials if network not disabledPéter Szilágyi2015-12-031-1/+1
|
* crypto, crypto/ecies, crypto/secp256k1: libsecp256k1 scalar multGustav Simonsson2015-11-303-3/+5
| | | | thanks to Felix Lange (fjl) for help with design & impl
* node: customizable protocol and service stacksPéter Szilágyi2015-11-274-13/+20
|
* Merge pull request #1934 from karalabe/polish-protocol-infosJeffrey Wilcke2015-11-043-1/+123
|\ | | | | eth, p2p, rpc/api: polish protocol info gathering
| * eth, p2p, rpc/api: polish protocol info gatheringPéter Szilágyi2015-10-283-1/+123
| |
* | p2p/nat: add docs for discoverFelix Lange2015-10-301-0/+3
| |
* | Godeps: upgrade github.com/huin/goupnp to 90f71cb5Felix Lange2015-10-301-1/+6
|/
* p2p/discover: ignore packet version numbersFelix Lange2015-09-302-5/+0
| | | | The strict matching can get in the way of protocol upgrades.
* p2p/discover: remove unused lastLookup fieldFelix Lange2015-09-301-6/+1
|
* p2p/discover: fix race involving the seed node iteratorFelix Lange2015-09-305-172/+198
| | | | | | | | | | | | | | | | | | | nodeDB.querySeeds was not safe for concurrent use but could be called concurrenty on multiple goroutines in the following case: - the table was empty - a timed refresh started - a lookup was started and initiated refresh These conditions are unlikely to coincide during normal use, but are much more likely to occur all at once when the user's machine just woke from sleep. The root cause of the issue is that querySeeds reused the same leveldb iterator until it was exhausted. This commit moves the refresh scheduling logic into its own goroutine (so only one refresh is ever active) and changes querySeeds to not use a persistent iterator. The seed node selection is now more random and ignores nodes that have not been contacted in the last 5 days.
* eth, metrics, p2p: prepare metrics and net packets to eth/62Péter Szilágyi2015-08-211-1/+7
|
* Merge pull request #1694 from obscuren/hide-fdtrackJeffrey Wilcke2015-08-204-11/+5
|\ | | | | fdtrack: hide message
| * Revert "fdtrack: temporary hack for tracking file descriptor usage"Jeffrey Wilcke2015-08-204-11/+5
| | | | | | | | This reverts commit 5c949d3b3ba81ea0563575b19a7b148aeac4bf61.
* | p2p/discover: don't attempt to replace nodes that are being replacedFelix Lange2015-08-192-4/+15
| | | | | | | | | | | | | | | | PR #1621 changed Table locking so the mutex is not held while a contested node is being pinged. If multiple nodes ping the local node during this time window, multiple ping packets will be sent to the contested node. The changes in this commit prevent multiple packets by tracking whether the node is being replaced.
* | p2p: continue listening after temporary errorsFelix Lange2015-08-191-6/+25
| |
* | p2p/discover: continue reading after temporary errorsFelix Lange2015-08-191-1/+11
|/ | | | Might solve #1579
* Merge pull request #1470 from ebuchman/encHandshakeFelix Lange2015-08-131-4/+12
|\ | | | | p2p: validate recovered ephemeral pubkey
| * p2p: validate recovered ephemeral pubkey against checksum in decodeAuthMsgEthan Buchman2015-07-141-4/+12
| |
* | p2p: fix value of DiscSubprotocolErrorFelix Lange2015-08-121-1/+1
| | | | | | | | We had the wrong value (12) since forever.
* | p2p/discover: fix UDP reply packet timeout handlingFelix Lange2015-08-112-31/+120
| | | | | | | | | | | | | | | | | | | | | | | | If the timeout fired (even just nanoseconds) before the deadline of the next pending reply, the timer was not rescheduled. The timer would've been rescheduled anyway once the next packet was sent, but there were cases where no next packet could ever be sent due to the locking issue fixed in the previous commit. As timing-related bugs go, this issue had been present for a long time and I could never reproduce it. The test added in this commit did reproduce the issue on about one out of 15 runs.
* | p2p/discover: unlock the table during ping replacementFelix Lange2015-08-113-52/+77
| | | | | | | | | | | | Table.mutex was being held while waiting for a reply packet, which effectively made many parts of the whole stack block on that packet, including the net_peerCount RPC call.
* | p2p/nat: disable UPnP test on windowsFelix Lange2015-08-061-0/+5
| |
* | p2p/discover: close Table during testingFelix Lange2015-08-062-4/+8
| | | | | | | | Not closing the table used to be fine, but now the table has a database.
* | fdtrack: temporary hack for tracking file descriptor usageFelix Lange2015-08-044-5/+11
| | | | | | | | | | Package fdtrack logs statistics about open file descriptors. This should help identify the source of #1549.
* | all: fix license headers one more timeFelix Lange2015-07-2426-26/+26
| | | | | | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* | all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-2326-104/+104
|/ | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: add some godoc synopsis commentsFelix Lange2015-07-072-1/+2
|
* all: update license informationFelix Lange2015-07-0726-0/+416
|
* cmd, core, eth, metrics, p2p: require enabling metricsPéter Szilágyi2015-06-301-5/+5
|
* p2p: fix local/remote cap/protocol mixupPéter Szilágyi2015-06-271-23/+23
|
* p2p: support protocol version negotiationPéter Szilágyi2015-06-263-6/+110
|
* p2p: instrument P2P networking layerPéter Szilágyi2015-06-243-3/+56
|
* p2p: throttle all discovery lookupsFelix Lange2015-06-222-15/+16
| | | | | | | | | | | | | | Lookup calls would spin out of control when network connectivity was lost. The throttling that was in place only took effect when the table returned zero results, which doesn't happen very often. The new throttling should not have a negative impact when the host is online. Lookups against the network take some time and dials for all results must complete or hit the cache before a new one is started. This usually takes longer than four seconds, leaving online lookups unaffected. Fixes #1296
* p2p: improve disconnect loggingFelix Lange2015-06-152-6/+7
|
* p2p: track write errors and prevent writes during shutdownFelix Lange2015-06-151-25/+57
| | | | | | | As of this commit, we no longer rely on the protocol handler to report write errors in a timely fashion. When a write fails, shutdown is initiated immediately and no new writes can start. This will also prevent new writes from starting after Server.Stop has been called.
* p2p/discover: use separate rand.Source instances in testsFelix Lange2015-06-102-15/+19
| | | | rand.Source isn't safe for concurrent use.
* p2p/discover: deflake TestUDP_successfulPingFelix Lange2015-06-102-33/+30
|
* p2p: fix a close race in the dial testPéter Szilágyi2015-06-101-1/+2
|
* p2p: bump global write timeout to 20sFelix Lange2015-06-091-1/+1
| | | | | The previous value of 5 seconds causes timeouts for legitimate messages if large messages are sent.
* p2p: fix close data racePéter Szilágyi2015-06-091-0/+1
|
* p2p/nat: add timeout for UPnP SOAP requestsFelix Lange2015-06-051-0/+3
|
* p2p/nat: bump timeout in TestAutoDiscRaceFelix Lange2015-05-281-1/+1
|
* p2p/discover: bond with seed nodes too (runs only if findnode failed)Péter Szilágyi2015-05-271-7/+4
|
* p2p/discovery: fix a cornercase loop if no seeds or bootnodes are knownPéter Szilágyi2015-05-271-5/+9
|
* p2p/discover: force refresh if the table is emptyPéter Szilágyi2015-05-271-13/+41
|
* p2p/discover: permit temporary bond failures for previously known nodesPéter Szilágyi2015-05-271-12/+15
|
* p2p/discover: watch find failures, evacuate on too many, rebond if failedPéter Szilágyi2015-05-271-8/+47
|
* p2p/discover: add support for counting findnode failuresPéter Szilágyi2015-05-272-3/+25
|
* p2p: fix Self() panic if listening is disabledPéter Szilágyi2015-05-271-0/+9
|
* cmd/geth, cmd/utils, eth, p2p: pass and honor a no discovery flagPéter Szilágyi2015-05-271-8/+29
|
* eth, p2p: start the p2p server even if maxpeers == 0Péter Szilágyi2015-05-261-3/+0
|
* p2p: decrease frameReadTimeout to 30sFelix Lange2015-05-251-4/+5
| | | | | This detects hanging connections sooner. We send a ping every 15s and other implementation have similar limits.
* p2p: new dialer, peer management without locksFelix Lange2015-05-2511-1329/+2118
| | | | | | | | | | | | | | | | | | The most visible change is event-based dialing, which should be an improvement over the timer-based system that we have at the moment. The dialer gets a chance to compute new tasks whenever peers change or dials complete. This is better than checking peers on a timer because dials happen faster. The dialer can now make more precise decisions about whom to dial based on the peer set and we can test those decisions without actually opening any sockets. Peer management is easier to test because the tests can inject connections at checkpoints (after enc handshake, after protocol handshake). Most of the handshake stuff is now part of the RLPx code. It could be exported or move to its own package because it is no longer entangled with Server logic.
* p2p/discover: add ReadRandomNodesFelix Lange2015-05-252-1/+83
|
* p2p: decrease maximum message size for devp2p to 1kBFelix Lange2015-05-251-1/+1
| | | | | | The previous limit was 10MB which is unacceptable for all kinds of reasons, the most important one being that we don't want to allow the remote side to make us allocate 10MB at handshake time.
* p2p: delete Server.BroadcastFelix Lange2015-05-254-136/+0
|
* p2p/discover: fix #838, evacuate self entries from the node dbPéter Szilágyi2015-05-223-25/+99
|
* p2p/discover: fix database presistency test folderPéter Szilágyi2015-05-221-3/+3
|
* Merge pull request #971 from fjl/p2p-limit-tweaksJeffrey Wilcke2015-05-147-64/+16
|\ | | | | p2p: tweak connection limits
| * p2p/discover: limit open files for node databaseFelix Lange2015-05-141-2/+3
| |
| * p2p: remove testlogFelix Lange2015-05-143-51/+0
| |
| * p2p/discover: bump maxBondingPingPongs to 16Felix Lange2015-05-141-1/+1
| | | | | | | | | | This should increase the speed a bit because all findnode results (up to 16) can be verified at the same time.
| * p2p: log remote reason when disconnect is requestedFelix Lange2015-05-142-8/+10
| | | | | | | | | | | | The returned reason is currently not used except for the log message. This change makes the log messages a bit more useful. The handshake code also returns the remote reason.
| * p2p: bump maxAcceptConns and defaultDialTimoutFelix Lange2015-05-141-2/+2
| | | | | | | | | | On the test network, we've seen that it becomes harder to connect if the queues are so short.
* | p2p/nat: tweak port mapping log messages and levelsFelix Lange2015-05-141-7/+6
| | | | | | | | | | | | People stil get confused about the messages. This commit changes the levels so that the only thing printed at the default level (info) is a successful mapping.
* | p2p/nat: add test for UPnP auto discovery via SSDPFelix Lange2015-05-141-0/+223
| | | | | | | | | | | | | | | | | | The test listens for multicast UDP packets on the default interface because I couldn't get it to work reliably on loopback without massive changes to goupnp. This means that the test might fail when there is a UPnP-enabled router attached on that interface. I checked that locally by looping the test and it passes reliably because the local SSDP server always responds faster.
* | p2p/nat: fix concurrent access to autodisc InterfaceFelix Lange2015-05-142-17/+63
|/ | | | | | | | | | | | Concurrent calls to Interface methods on autodisc could return a "not discovered" error if the discovery did not finish before the call. autodisc.wait expected the done channel to carry the found Interface but it was closed instead. The fix is to use sync.Once for now, which is easier to get right. And there is a test. Finally. This will have to change again when we introduce re-discovery.
* p2p/discover: fix out-of-bounds slicing for chunked neighbors packetsFelix Lange2015-05-142-32/+49
| | | | | The code assumed that Table.closest always returns at least 13 nodes. This is not true for small tables (e.g. during bootstrap).
* fix test.subtly2015-05-141-1/+1
|
* Manual send of multiple neighbours packets. Test receiving multiple ↵subtly2015-05-142-3/+19
| | | | neighbours packets.
* UDP Interop. Limit datagrams to 1280bytes.subtly2015-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't have a UDP which specifies any messages that will be 4KB. Aside from being implemented for months and a necessity for encryption and piggy-backing packets, 1280bytes is ideal, and, means this TODO can be completed! Why 1280 bytes? * It's less than the default MTU for most WAN/LAN networks. That means fewer fragmented datagrams (esp on well-connected networks). * Fragmented datagrams and dropped packets suck and add latency while OS waits for a dropped fragment to never arrive (blocking readLoop()) * Most of our packets are < 1280 bytes. * 1280 bytes is minimum datagram size and MTU for IPv6 -- on IPv6, a datagram < 1280bytes will *never* be fragmented. UDP datagrams are dropped. A lot! And fragmented datagrams are worse. If a datagram has a 30% chance of being dropped, then a fragmented datagram has a 60% chance of being dropped. More importantly, we have signed packets and can't do anything with a packet unless we receive the entire datagram because the signature can't be verified. The same is true when we have encrypted packets. So the solution here to picking an ideal buffer size for receiving datagrams is a number under 1400bytes. And the lower-bound value for IPv6 of 1280 bytes make's it a non-decision. On IPv4 most ISPs and 3g/4g/let networks have an MTU just over 1400 -- and *never* over 1500. Never -- that means packets over 1500 (in reality: ~1450) bytes are fragmented. And probably dropped a lot. Just to prove the point, here are pings sending non-fragmented packets over wifi/ISP, and a second set of pings via cell-phone tethering. It's important to note that, if *any* router between my system and the EC2 node has a lower MTU, the message would not go through: On wifi w/normal ISP: localhost:Debug $ ping -D -s 1450 52.6.250.242 PING 52.6.250.242 (52.6.250.242): 1450 data bytes 1458 bytes from 52.6.250.242: icmp_seq=0 ttl=42 time=104.831 ms 1458 bytes from 52.6.250.242: icmp_seq=1 ttl=42 time=119.004 ms ^C --- 52.6.250.242 ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 104.831/111.918/119.004/7.087 ms localhost:Debug $ ping -D -s 1480 52.6.250.242 PING 52.6.250.242 (52.6.250.242): 1480 data bytes ping: sendto: Message too long ping: sendto: Message too long Request timeout for icmp_seq 0 ping: sendto: Message too long Request timeout for icmp_seq 1 Tethering to O2: localhost:Debug $ ping -D -s 1480 52.6.250.242 PING 52.6.250.242 (52.6.250.242): 1480 data bytes ping: sendto: Message too long ping: sendto: Message too long Request timeout for icmp_seq 0 ^C --- 52.6.250.242 ping statistics --- 2 packets transmitted, 0 packets received, 100.0% packet loss localhost:Debug $ ping -D -s 1450 52.6.250.242 PING 52.6.250.242 (52.6.250.242): 1450 data bytes 1458 bytes from 52.6.250.242: icmp_seq=0 ttl=42 time=107.844 ms 1458 bytes from 52.6.250.242: icmp_seq=1 ttl=42 time=105.127 ms 1458 bytes from 52.6.250.242: icmp_seq=2 ttl=42 time=120.483 ms 1458 bytes from 52.6.250.242: icmp_seq=3 ttl=42 time=102.136 ms
* removed redundant newlines in import blockBas van Kervel2015-05-121-1/+1
|
* replaced several path.* with filepath.* which is platform independentBas van Kervel2015-05-121-2/+2
|
* p2p: drop connections with no matching protocolsFelix Lange2015-05-082-4/+21
|
* p2p: use maxDialingConns instead of maxAcceptConns as dial limitFelix Lange2015-05-081-1/+1
|
* p2p: fix disconnect at capacityFelix Lange2015-05-084-33/+46
| | | | | | | With the introduction of static/trusted nodes, the peer count can go above MaxPeers. Update the capacity check to handle this. While here, decouple the trusted nodes check from the handshake by passing a function instead.
* p2p: increase the handshake timeout in the testsPéter Szilágyi2015-05-071-2/+2
|
* cmd, eth, p2p: introduce pending peer cli arg, add testsPéter Szilágyi2015-05-072-7/+148
|
* p2p: reduce the concurrent handshakes to 10/10 in/outPéter Szilágyi2015-05-071-2/+2
|
* p2p: fix dial throttling race conditionPéter Szilágyi2015-05-071-1/+1
|
* p2p: fix a dialing race in the throttlerPéter Szilágyi2015-05-071-1/+1
|
* p2p: limit the outbound dialing tooPéter Szilágyi2015-05-071-1/+11
|
* Merge pull request #866 from fjl/p2p-last-minuteJeffrey Wilcke2015-05-074-19/+16
|\ | | | | Last minute p2p fixes
| * p2p: stop dialing at half the maximum peer countFelix Lange2015-05-071-1/+1
| |
| * p2p, whisper: use glog for peer-level loggingFelix Lange2015-05-071-13/+8
| |
| * p2p/discover: bump packet timeouts to 500msFelix Lange2015-05-071-2/+2
| |
| * p2p/nat: less confusing error loggingFelix Lange2015-05-071-3/+5
| |
* | fixed merge issueobscuren2015-05-074-30/+263
|\ \ | |/ |/|
| * eth, p2p: add trusted node list beside static listPéter Szilágyi2015-05-044-39/+47
| |
| * p2p: add static node dialing testPéter Szilágyi2015-05-042-13/+108
| |
| * p2p: correct a leftover trusted -> staticPéter Szilágyi2015-05-011-4/+4
| |
| * eth, p2p: rename trusted nodes to static, drop inbound extra slotsPéter Szilágyi2015-05-014-46/+48
| |
| * cmd, eth, p2p: fix review issues enumerated by FelixPéter Szilágyi2015-04-302-21/+12
| |
| * p2p: add trust check to handshake, test privileged connectivityPéter Szilágyi2015-04-304-15/+88
| | | | | | | | | | Conflicts: p2p/server_test.go
| * p2p: reduce the severity of a debug logPéter Szilágyi2015-04-301-1/+1
| |
| * cmd/geth, cmd/mist, cmd/utils, eth, p2p: support trusted peersPéter Szilágyi2015-04-302-14/+78
| |
* | p2p/discover: new distance metric based on sha3(id)Felix Lange2015-05-066-106/+354
| | | | | | | | | | | | | | The previous metric was pubkey1^pubkey2, as specified in the Kademlia paper. We missed that EC public keys are not uniformly distributed. Using the hash of the public keys addresses that. It also makes it a bit harder to generate node IDs that are close to a particular node.
* | p2p/discover: track sha3(ID) in NodeFelix Lange2015-04-308-99/+166
| |
* | p2p, p2p/discover: protocol version 4Felix Lange2015-04-302-2/+2
| |
* | p2p/discover: new endpoint formatFelix Lange2015-04-3010-127/+158
|/ | | | | | This commit changes the discovery protocol to use the new "v4" endpoint format, which allows for separate UDP and TCP ports and makes it possible to discover the UDP address after NAT.
* p2p: added received at to peer messageobscuren2015-04-302-3/+5
| | | | | p2p.Msg.ReceivedAt can be used for determining block propagation from begining to end.
* p2p/discover: fix api issues caused by leveldb updatePéter Szilágyi2015-04-281-4/+6
|
* p2p/discover: fix goroutine leak due to blocking on sync.OncePéter Szilágyi2015-04-282-13/+24
|
* p2p/discover: add node expirer and related testsPéter Szilágyi2015-04-273-4/+116
|
* p2p/discover: parametrize nodedb version, add persistency testsPéter Szilágyi2015-04-273-11/+62
|
* p2p/discover: drop a superfluous warningPéter Szilágyi2015-04-271-1/+1
|
* p2p/discover: wrap the pinger to update the node db tooPéter Szilágyi2015-04-271-4/+15
|
* p2p/discover: use iterator based seeding, drop old protocol testPéter Szilágyi2015-04-272-45/+118
|
* p2p/discover: write the basic tests, catch RLP bugPéter Szilágyi2015-04-273-8/+150
|
* p2p/discovery: fix issues raised in the nodeDb PRPéter Szilágyi2015-04-272-36/+32
|
* cmd/bootnode, eth, p2p, p2p/discover: use a fancier db designPéter Szilágyi2015-04-247-160/+277
|
* cmd/bootnode, eth, p2p, p2p/discover: clean up the seeder and mesh into eth.Péter Szilágyi2015-04-247-140/+157
|
* p2p/discovery: fix broken tests due to API updatePéter Szilágyi2015-04-242-4/+4
|
* p2p/discovery: use the seed table for finding nodes, auto drop stale onesPéter Szilágyi2015-04-242-5/+38
|
* cmd, eth, p2p, p2p/discover: init and clean up the seed cachePéter Szilágyi2015-04-244-8/+26
|
* p2p/discover: store nodes in leveldbFelix Lange2015-04-242-13/+73
|
* p2p: return zero node from Self if the server is not runningFelix Lange2015-04-221-1/+6
| | | | This helps with fixing the tests for cmd/geth to run without networking.
* p2p: make DiscReason bigger than byteFelix Lange2015-04-171-1/+1
| | | | | We decode into [1]DiscReason in a few places. That doesn't work anymore because package rlp no longer accepts RLP lists for byte arrays.
* p2p/discover: use rlp.DecodeBytesFelix Lange2015-04-171-1/+1
|
* cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limitFelix Lange2015-04-171-1/+2
|
* p2p: fix the dial timerFelix Lange2015-04-171-3/+8
| | | | | The dial timer was not reset properly when the peer count reached MaxPeers.
* p2p: added limiter function to limit package broadcastingobscuren2015-04-141-0/+13
|
* p2p/discover: improve timer handling for reply timeoutsFelix Lange2015-04-141-2/+3
|
* p2p/discover: remove unused field Node.activeStampFelix Lange2015-04-132-16/+0
|
* p2p: fix unsynchronized map access during Server shutdownFelix Lange2015-04-131-0/+2
| | | | removePeer can be called even after listenLoop and dialLoop have returned.
* p2p: fix yet another disconnect hangFelix Lange2015-04-131-22/+8
| | | | | | | | | Peer.readLoop will only terminate if the connection is closed. Fix the hang by closing the connection before waiting for readLoop to terminate. This also removes the british disconnect procedure where we're waiting for the remote end to close the connection. I have confirmed with @subtly that cpp-ethereum doesn't adhere to it either.
* p2p: fix goroutine leak when handshake read failsFelix Lange2015-04-131-1/+1
| | | | This regression was introduced in b3c058a9e4e9.
* p2p: limit number of lingering inbound pre-handshake connectionsFelix Lange2015-04-101-1/+19
| | | | | | | This is supposed to apply some back pressure so Server is not accepting more connections than it can actually handle. The current limit is 50. This doesn't really need to be configurable, but we'll see how it behaves in our test nodes and adjust accordingly.
* p2p: use RLock instead of Lock for pre-dial checksFelix Lange2015-04-101-10/+12
|
* p2p: improve disconnect signaling at handshake timeFelix Lange2015-04-104-35/+111
| | | | | | | As of this commit, p2p will disconnect nodes directly after the encryption handshake if too many peer connections are active. Errors in the protocol handshake packet are now handled more politely by sending a disconnect packet before closing the connection.
* p2p: don't mess with the socket deadline in Peer.readLoopFelix Lange2015-04-101-1/+0
| | | | netWrapper already sets a read deadline in ReadMsg.
* p2p: properly decrement peer wait group counter for setup errorsFelix Lange2015-04-101-0/+11
|
* p2p: fix Peer shutdown deadlocksFelix Lange2015-04-104-78/+139
| | | | | | | | | | There were multiple synchronization issues in the disconnect handling, all caused by the odd special-casing of Peer.readLoop errors. Remove the special handling of read errors and make readLoop part of the Peer WaitGroup. Thanks to @Gustav-Simonsson for pointing at arrows in a diagram and playing rubber-duck.
* p2p: improve peer selection logicFelix Lange2015-04-101-56/+61
| | | | | | | This commit introduces a new (temporary) peer selection strategy based on random lookups. While we're here, also implement the TODOs in dialLoop.
* p2p/discover: don't log packet contentFelix Lange2015-04-101-3/+4
|
* p2p/discover: make packet processing less concurrentFelix Lange2015-04-101-6/+4
|
* Updated loggingobscuren2015-04-073-29/+27
|
* p2p/discover: fix off by one error causing buckets to contain duplicatesFelix Lange2015-04-012-1/+43
|
* p2p/discover: implement node bondingFelix Lange2015-04-015-383/+649
| | | | | | | | | | | | | | | | This a fix for an attack vector where the discovery protocol could be used to amplify traffic in a DDOS attack. A malicious actor would send a findnode request with the IP address and UDP port of the target as the source address. The recipient of the findnode packet would then send a neighbors packet (which is 16x the size of findnode) to the victim. Our solution is to require a 'bond' with the sender of findnode. If no bond exists, the findnode packet is not processed. A bond between nodes α and β is created when α replies to a ping from β. This (initial) version of the bonding implementation might still be vulnerable against replay attacks during the expiration time window. We will add stricter source address validation later.
* p2p/discover: add version number to ping packetFelix Lange2015-04-011-0/+8
| | | | | | The primary motivation for doing this right now is that old PoC 8 nodes and newer PoC 9 nodes keep discovering each other, causing handshake failures.
* fix p2p/testlog_testzelig2015-03-241-5/+2
|
* Merge branch 'develop' into conversionobscuren2015-03-212-3/+3
|\
| * %#x => %xobscuren2015-03-202-3/+3
| |
* | p2p: interrupt MsgPipe payload read/writeFelix Lange2015-03-191-3/+6
| | | | | | | | | | | | This is better because protocols might not actually read the payload for some errors (msg too big, etc.) which can be a pain to test with the old behaviour.
* | p2p: log disconnect requestsFelix Lange2015-03-191-0/+1
| | | | | | | | This helps a lot with debugging.
* | p2p: use package rlp to encode messagesFelix Lange2015-03-198-68/+64
| | | | | | | | | | | | | | | | | | | | Message encoding functions have been renamed to catch any uses. The switch to the new encoder can cause subtle incompatibilities. If there are any users outside of our tree, they will at least be alerted that there was a change. NewMsg no longer exists. The replacements for EncodeMsg are called Send and SendItems.
* | p2p: export ExpectMsg (for eth protocol testing)Felix Lange2015-03-192-32/+32
|/
* Merge branch 'frontier/js' into frontier/nodeadmin.jszelig2015-03-162-5/+5
|\
| * Moved ethutil => commonobscuren2015-03-162-5/+5
| |
* | p2p: server>discover table Self=Node exportedzelig2015-03-152-8/+12
|/
* Move MakeName to ethutilTaylor Gerring2015-03-121-9/+1
|
* eth, p2p: delete p2p.BlacklistFelix Lange2015-03-041-59/+0
| | | | | It is unused and untested right now. We can bring it back later if required.
* p2p: reject messages that cannot be written as simple RLPx framesFelix Lange2015-03-041-0/+5
| | | | | Until chunked frames are implemented we cannot send messages with a size overflowing uint24.
* p2p: restore read/write timeoutsFelix Lange2015-03-045-37/+37
| | | | They got lost in the transition to rlpxFrameRW.
* p2p: msg.Payload contains list dataFelix Lange2015-03-047-75/+25
| | | | | | | | | With RLPx frames, the message code is contained in the frame and is no longer part of the encoded data. EncodeMsg, Msg.Decode have been updated to match. Code that decodes RLP directly from Msg.Payload will need to change.
* p2p: verify protocol handshake node IDFelix Lange2015-03-041-0/+3
|
* p2p: make encryption handshake code easier to followFelix Lange2015-03-042-302/+272
| | | | | | | | | This mostly changes how information is passed around. Instead of using many function parameters and return values, put the entire state in a struct and pass that. This also adds back derivation of ecdhe-shared-secret. I deleted it by accident in a previous refactoring.
* p2p/discover: add NodeID.PubkeyFelix Lange2015-03-042-0/+33
|
* p2p: make RLPx frame MAC 16 bytes as defined in the specFelix Lange2015-03-042-13/+19
|
* p2p: delete frameRWFelix Lange2015-03-042-184/+0
|
* p2p: use RLPx frames for messagingFelix Lange2015-03-046-50/+73
|
* p2p: encrypted and authenticated RLPx frame I/OFelix Lange2015-03-044-172/+197
|
* p2p: add basic RLPx frame I/OFelix Lange2015-03-042-0/+252
|
* p2p: emit JSON connect/disconnect eventsFelix Lange2015-02-201-0/+13
|
* p2p: initialize Server.ourHandshake before accepting connectionsFelix Lange2015-02-201-8/+9
|
* p2p: enable devp2p pingFelix Lange2015-02-191-11/+26
| | | | This should prevent connection drops.
* p2p: disable encryption handshakeFelix Lange2015-02-197-313/+273
| | | | | | The diff is a bit bigger than expected because the protocol handshake logic has moved out of Peer. This is necessary because the protocol handshake will have custom framing in the final protocol.
* Merge pull request #325 from fjl/deps-cleanupJeffrey Wilcke2015-02-182-4/+4
|\ | | | | Cleanup imports
| * p2p/nat: switch to github.com/huin/goupnpFelix Lange2015-02-171-3/+3
| | | | | | | | My temporary fix was merged upstream.
| * p2p: fix ecies dependency in testsFelix Lange2015-02-171-1/+1
| | | | | | | | | | We forgot to update this reference when moving ecies into the go-ethereum repo.
* | p2p/discover: fix pending replies iterationFelix Lange2015-02-171-1/+2
|/ | | | | | Range expressions capture the length of the slice once before the first iteration. A range expression cannot be used here since the loop modifies the slice variable (including length changes).
* Use a mutex write-lock for a write operationobscuren2015-02-151-4/+4
|
* Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into developobscuren2015-02-141-0/+6
|\
| * p2p: print Cap as name/versionFelix Lange2015-02-141-0/+6
| |
* | Moved ECIES to repo & added secondary title for webviewobscuren2015-02-141-1/+1
|/ | | | | * ECIES moved from obscuren to ethereum * Added html META[name=badge] to reflect menuItem.secondaryTitle
* p2p: bump devp2p protcol version to 3Felix Lange2015-02-131-1/+1
| | | | For compatibility with cpp-ethereum
* p2p: handle disconnect before protocol handshakeFelix Lange2015-02-131-0/+7
|
* p2p/discover: fix race in ListenUDPFelix Lange2015-02-131-24/+17
| | | | | udp.Table was assigned after the readLoop started, so packets could arrive and be processed before the Table was there.
* p2p: ensure we don't dial ourselfFelix Lange2015-02-131-1/+4
| | | | | addPeer doesn't allow self connects, but we can avoid opening connections in the first place.
* p2p: add I/O timeout for encrytion handshakeFelix Lange2015-02-131-1/+3
|
* p2p: fix goroutine leak for invalid peersFelix Lange2015-02-131-6/+5
| | | | | The deflect logic called Disconnect on the peer, but the peer never ran and wouldn't process the disconnect request.
* p2p: improve read deadlinesFelix Lange2015-02-132-15/+27
| | | | | | | | There are now two deadlines, frameReadTimeout and payloadReadTimeout. The frame timeout is longer and allows for connections that are idle. The message timeout is still short and ensures that we don't get stuck in the middle of a message.
* p2p/discover: map listening port using configured mechanismFelix Lange2015-02-133-15/+25
|
* p2p/discover: code review fixesFelix Lange2015-02-133-7/+9
|
* cmd/ethereum, cmd/mist, eth, p2p: use package p2p/natFelix Lange2015-02-134-478/+11
| | | | This deletes the old NAT implementation.
* p2p/nat: new package for port mapping stuffFelix Lange2015-02-133-0/+499
| | | | | | I have verified that UPnP and NAT-PMP work against an older version of the MiniUPnP daemon running on pfSense. This code is kind of hard to test automatically.
* p2p/discover: deflake UDP testsFelix Lange2015-02-094-59/+123
|
* cmd/ethereum, cmd/mist: add flag for discovery bootstrap nodesFelix Lange2015-02-072-3/+3
|
* cmd/mist, eth, javascript, p2p: use Node URLs for peer suggestionsFelix Lange2015-02-072-3/+3
|
* p2p: fixes for actual connectionsFelix Lange2015-02-076-29/+38
| | | | The unit test hooks were turned on 'in production'.
* p2p/discover: add node URL functions, distinguish TCP/UDP portsFelix Lange2015-02-078-326/+532
| | | | | The discovery RPC protocol does not yet distinguish TCP and UDP ports. But it can't hurt to do so in our internal model.
* p2p: integrate p2p/discoverFelix Lange2015-02-0615-1659/+1056
| | | | | | | | | | | | Overview of changes: - ClientIdentity has been removed, use discover.NodeID - Server now requires a private key to be set (instead of public key) - Server performs the encryption handshake before launching Peer - Dial logic takes peers from discover table - Encryption handshake code has been cleaned up a bit - baseProtocol is gone because we don't exchange peers anymore - Some parts of baseProtocol have moved into Peer instead
* p2p/discover: add some helper functionsFelix Lange2015-02-064-20/+41
|
* p2p/discover: new package implementing the Node Discovery ProtocolFelix Lange2015-02-064-0/+1428
|
* key generation abstracted out, for testing with deterministic keyszelig2015-02-062-12/+92
|
* fix clientidentity test after privkey removedzelig2015-02-061-6/+2
|
* get rid of Private Key in ClientIdentityzelig2015-02-061-5/+3
|
* make crypto handshake calls package level, store privateKey on peer + tests okzelig2015-02-063-87/+52
|
* apply handshake related improvements from p2p.crypto branchzelig2015-02-063-29/+31
|
* add temporary forced session token generationzelig2015-02-062-0/+8
|
* peer-level integration test for crypto handshakezelig2015-02-063-15/+71
| | | | | | | | | - add const length params for handshake messages - add length check to fail early - add debug logs to help interop testing (!ABSOLUTELY SHOULD BE DELETED LATER) - wrap connection read/writes in error check - add cryptoReady channel in peer to signal when secure session setup is finished - wait for cryptoReady or timeout in TestPeersHandshake
* chop first byte when cryptoid.PubKeyS is set from identity.Pubkey() since ↵zelig2015-02-061-1/+11
| | | | this is directly copied in the auth message
* add initial peer level test (failing)zelig2015-02-061-1/+52
|
* add code documentationzelig2015-02-061-15/+47
|
* changes that fix it all:zelig2015-02-062-57/+146
| | | | | | | | | | | - set proper public key serialisation length in pubLen = 64 - reset all sizes and offsets - rename from DER to S (we are not using DER encoding) - add remoteInitRandomPubKey as return value to respondToHandshake - add ImportPublicKey with error return to read both EC golang.elliptic style 65 byte encoding and 64 byte one - add ExportPublicKey falling back to go-ethereum/crypto.FromECDSAPub() chopping off the first byte - add Import - Export tests - all tests pass
* important fix for peer pubkey. when taken from identity, chop first format byte!zelig2015-02-061-1/+1
|
* add equality check for nonce and remote noncezelig2015-02-061-0/+6
|
* add minor comments to the testzelig2015-02-061-0/+4
|
* first stab at integrating crypto in our p2pzelig2015-02-063-44/+79
| | | | | | | - abstract the entire handshake logic in cryptoId.Run() taking session-relevant parameters - changes in peer to accomodate how the encryption layer would be switched on - modify arguments of handshake components - fixed test getting the wrong pubkey but it till crashes on DH in newSession()
* integrate cryptoId into peer and connection lifecyclezelig2015-02-062-3/+33
|
* completed the test. FAIL now. it crashes at diffie-hellman. ECIES -> ↵zelig2015-02-062-43/+57
| | | | secp256k1-go panics
* handshake test to cryptozelig2015-02-061-1/+1
|
* handshake test to cryptozelig2015-02-062-2/+54
|
* fix crashzelig2015-02-061-22/+29
| | | | | | - add session token check and fallback to shared secret in responder call too - use explicit length for the types of new messages - fix typo resp[resLen-1] = tokenFlag
* rewrite to comply with latest speczelig2015-02-061-53/+138
| | | | | | | | - correct sizes for the blocks : sec signature 65, ecies sklen 16, keylength 32 - added allocation to Xor (should be optimized later) - no pubkey reader needed, just do with copy - restructuring now into INITIATE, RESPOND, COMPLETE -> newSession initialises the encryption/authentication layer - crypto identity can be part of client identity, some initialisation when server created
* add crypto auth logic to p2pzelig2015-02-061-0/+174
|
* fix protocol to accomodate privkeyzelig2015-02-062-1/+14
|
* add privkey to clientIdentity + testszelig2015-02-062-5/+21
|
* initial hook for crypto handshake (void, off by default)zelig2015-02-061-0/+26
|
* Moved `obscuren` secp256k1-goobscuren2015-01-221-1/+1
|
* Moved connection errors to DebugDetail levelobscuren2015-01-191-2/+2
|
* p2p: improve test for peers messageFelix Lange2015-01-061-21/+43
| | | | | The test now checks that the number of of addresses is correct and terminates cleanly.
* p2p: move peerList back into baseProtocolFelix Lange2015-01-062-23/+23
| | | | It had been moved to Peer, probably for debugging.
* eth, p2p: remove EncodeMsg from p2p.MsgWriterFelix Lange2015-01-065-23/+21
| | | | | | | | | | | | ...and make it a top-level function instead. The original idea behind having EncodeMsg in the interface was that implementations might be able to encode RLP data to their underlying writer directly instead of buffering the encoded data. The encoder will buffer anyway, so that doesn't matter anymore. Given the recent problems with EncodeMsg (copy-pasted implementation bug) I'd rather implement once, correctly.
* Mergeobscuren2015-01-068-54/+144
|
* Cleaned up some of that utilobscuren2015-01-042-2/+25
|
* p2p: fix call to Server.removePeer (might help with #209)Felix Lange2014-12-161-7/+2
|
* made mist in a compilable, workable state using the new refactored packagesobscuren2014-12-151-0/+1
|
* Merge pull request #204 from fjl/fix-p2p-disconnectJeffrey Wilcke2014-12-157-8/+277
|\ | | | | p2p: fix decoding of disconnect reason
| * p2p: add test for base protocol disconnectFelix Lange2014-12-151-0/+58
| |
| * p2p: use an error type for disconnect requestsFelix Lange2014-12-152-2/+10
| | | | | | | | Test-tastic.
| * p2p: add MsgPipe for protocol testingFelix Lange2014-12-152-0/+140
| |
| * p2p: improve and test eofSignalFelix Lange2014-12-122-5/+68
| |
| * p2p: fix decoding of disconnect reason (fixes #200)Felix Lange2014-12-121-2/+2
| |
* | Fixed testsobscuren2014-12-101-1/+1
|/
* p2p: add test for NewPeerFelix Lange2014-11-271-0/+15
|
* p2p: make Disconnect not hang for peers created with NewPeerFelix Lange2014-11-271-0/+1
|
* p2p: remove Msg.Value and MsgLoopFelix Lange2014-11-253-49/+19
|
* p2p: use package rlp for baseProtocolFelix Lange2014-11-254-58/+71
|
* p2p: use package rlpFelix Lange2014-11-253-67/+31
|
* p2p: API cleanup and PoC 7 compatibilityFelix Lange2014-11-2217-1902/+1665
| | | | | Whoa, one more big commit. I didn't manage to untangle the changes while working towards compatibility.
* p2p: disable failing Server tests for nowFelix Lange2014-11-221-0/+3
|
* p2p: fix issues found during reviewFelix Lange2014-11-224-53/+96
|
* p2p: rework protocol APIFelix Lange2014-11-2214-1282/+1017
|
* Implemented new miner w/ ui interface for merged mining. Closes #177obscuren2014-11-073-3/+4
| | | | | | | | * Miner has been rewritten * Added new miner pane * Added option for local txs * Added option to read from MergeMining contract and list them for merged mining
* all: fix rename breakageFelix Lange2014-11-011-2/+2
|