aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* initial commit of p2p packagezelig2014-10-2319-0/+3015