Commit Graph

139 Commits

Author SHA1 Message Date
Seth Hoenig 9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner f83771b660 Apply ineffassign linter 2016-04-04 15:39:26 +10:00
Matt Joiner 811b460f1d dht: Use missinggo.Event for closing 2016-02-26 22:11:48 +11:00
Matt Joiner 2fa233345e dht: Rename newDHTAddr->NewAddr, and clean up the interface 2016-02-24 02:02:33 +11:00
Matt Joiner 7b0b0f9bf9 dht: Rename dHTAddr to Addr 2016-02-24 01:50:15 +11:00
Matt Joiner 621ec7bac4 dht: Misc trivial improvements 2016-02-23 23:52:30 +11:00
Matt Joiner 0e85ff190d go vet 2016-02-02 00:44:29 +11:00
Matt Joiner df07d93330 dht: Start timer under transaction lock
Satisfies race detector
2016-01-19 00:34:40 +11:00
Matt Joiner 9697a9371a Fix #47
Forgot to remove a non-deferred sync.Mutex.Unlock
2015-12-23 03:31:39 +11:00
Matt Joiner 4015031420 dht: announce_peer should not occur to insecure nodes
Additionally, we now announce even if a token wasn't provided. Why not.
2015-12-18 00:50:22 +11:00
Matt Joiner e8ff870994 dht: Except local network addresses from security checks 2015-12-17 23:51:50 +11:00
Matt Joiner 127fad47dd dht: Move security tests into separate file 2015-12-17 23:36:57 +11:00
Matt Joiner f09c0cd2ec dht: Move security functions into new file 2015-12-17 23:22:39 +11:00
Matt Joiner 565fb20139 Add OnQuery hook, thanks to Cathal Garvey 2015-12-16 15:20:37 +11:00
Matt Joiner 6d8310d2df Test improvements 2015-12-16 15:16:53 +11:00
Matt Joiner 44ec4d9bdb Add NodeIdHex config option 2015-12-16 15:15:59 +11:00
Matt Joiner 4798907da4 Add NoDefaultBootstrap and use it and testify in a few tests 2015-12-16 15:13:32 +11:00
Matt Joiner 86b0c02eac Use testify for some tests 2015-12-16 15:06:23 +11:00
Dmitry Borzov 353e0d90ff Fix package-docstring for dht package 2015-12-08 00:14:13 +11:00
Matt Joiner 54853c11cc sortimports 2015-12-07 23:11:39 +11:00
Matt Joiner ff835db955 Actually fix #41 properly; and several big changes
bencode:
 * Handle omitempty on non-trivial types.
cmd/dht-ping:
 * Handle timeouts in ping transactions.
dht:
 * Propagate failed transaction responses properly.
 * Msg related tests are moved into their own file.
 * In some places, IPs in binary form are shorted to 4 bytes if IPv4.
2015-12-07 03:28:28 +11:00
Matt Joiner b86253c80d Fix #41 2015-12-07 02:39:00 +11:00
Dmitry Borzov 87c9697a26 Move dht.Server defs to a separate file 2015-12-06 17:56:46 +03:00
Dmitry Borzov 1adae8cb47 Move Transaction & nodeInfo defs to dedicated files 2015-12-06 00:34:46 +03:00
Dmitry Borzov 3f228d9f3b Fix godoc strings for dht package 2015-12-05 23:40:41 +03:00
Matt Joiner fdf46e00b7 dht: Don't log KRPC unmarshal errors, there's a expvar for this 2015-11-13 22:34:29 +11:00
Matt Joiner 61798cd94c dht: Handle bad responses to get_peers 2015-10-30 01:18:29 +11:00
Matt Joiner 99a0813d88 dht: Make Msg a struct with bencode tags 2015-10-23 12:41:45 +11:00
Matt Joiner 9c200c0037 Missed in last commit 2015-10-19 00:02:42 +11:00
Matt Joiner a4049e179c Avoid allocation in iplist.Ranger.Lookup
It was very expensive for DHT packets.
2015-10-19 00:00:26 +11:00
Matt Joiner 22428da0e3 Add packed IP list
This saves a lot of memory by allowing the IP blocklist to be mmap()ed in. In production with the latest level1 blocklist it's 35MB per process.
2015-09-23 18:25:22 +10:00
Matt Joiner 87bd9b5d17 dht: Use new Msg.Args helper method 2015-08-18 02:12:52 +10:00
Matt Joiner 288abb1c6b dht: Remove redundant code which caused rare crash 2015-08-18 02:12:27 +10:00
Matt Joiner 74d3598656 dht: Use passive from server config 2015-08-18 02:11:48 +10:00
Matt Joiner 3204e276f2 dht: Improve on on Msg methods 2015-08-18 02:11:09 +10:00
Matt Joiner b536975580 dht: BEP43 2015-08-18 02:09:10 +10:00
Matt Joiner 89f024a76b dht: Revive the UnmarshalGetPeersResponse test 2015-08-18 02:08:08 +10:00
Matt Joiner 1db00a54f0 Redo the compact peer types 2015-08-17 19:52:47 +10:00
Matt Joiner 31acbac207 Several bad KRPC message are crying wolf 2015-08-06 09:02:50 +10:00
Matt Joiner a7c374cff7 dht: Short circuit non-DHT traffic 2015-08-06 08:59:30 +10:00
Matt Joiner a0cdda16a4 dht: Expose SecureNodeId and NodeIdSecure 2015-08-05 02:37:43 +10:00
Matt Joiner 5a73f73d97 dht: Count announce errors, don't log them 2015-08-04 01:20:44 +10:00
Matt Joiner 54339a30e3 Drop connections that contributed to pieces that failed to hash
There are peers out there that seem to intentionally spam bad data, and the same pieces will often fail continuously. This really puts a bee in their bonnet.
2015-08-04 01:12:09 +10:00
Matt Joiner 6afaa816bf dht: Add PublicIP to config to secure node ID 2015-08-04 00:37:16 +10:00
Matt Joiner 68e3b9f666 dht: Block bad nodes, start by banning those that send port=0 2015-08-04 00:31:53 +10:00
Matt Joiner d077fed72d Some utils moved to missinggo 2015-08-04 00:29:01 +10:00
Matt Joiner c41aa941f3 dht: Export some useful variables 2015-06-29 19:36:08 +10:00
Matt Joiner 4a8ba4faaf dht: Suppress error during bootstrapping because Server already closed 2015-06-29 19:34:42 +10:00
Matt Joiner 4f293ca75b Several trivial fixes 2015-06-28 16:39:04 +10:00
Matt Joiner a6b5ac60ad Fix rare crash due to bad DHT node IDs 2015-06-08 18:16:29 +10:00