Commit Graph

32 Commits

Author SHA1 Message Date
YenForYang a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
Matt Joiner c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner 2d6888cb97 Add iplist/cmd/iplist 2018-07-22 19:51:30 +10:00
Matt Joiner 3a7152ca21 Fix iplist.Range.String, and a comment 2018-07-22 12:59:02 +10:00
Matt Joiner 8d1995c4d4 Support IPv6 blocklists
Existing packed blocklists need to be regenerated.
2018-02-11 15:11:26 +11:00
Matt Joiner 1f81f57b9c There was no error for missing file, and no way to close the mmap returned from iplist.MmapPacked
The function is also renamed due to the changed behaviour.
2018-02-08 23:57:35 +11:00
Matt Joiner cecc70f4cc More megacheck 2017-11-08 00:12:34 +11:00
Matt Joiner 582d749f69 iplist: Add TODO to allow unmapping 2017-06-11 20:09:40 +10:00
Matt Joiner 75b959099f iplist: Begin adding support for parsing CIDR lists 2016-12-01 15:41:52 +11:00
Matt Joiner 0231beeac7 iplist/cmd/pack-blocklist use tagflag 2016-05-16 18:45:23 +10:00
Seth Hoenig 9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner 792feae8f9 iplist: Add helper to mmap in a packed blocklist 2016-04-04 16:23:05 +10: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 d077fed72d Some utils moved to missinggo 2015-08-04 00:29:01 +10:00
Matt Joiner 99a06e3f50 Move IP blocklist loading into iplist package 2015-06-22 19:44:59 +10:00
Matt Joiner 4084cad34b iplist: Fail invalid IPs, they were always passing 2015-03-28 02:54:17 +11:00
Matt Joiner 842a32ae0c Rewrite import paths for migration from Bitbucket 2015-03-20 16:37:44 +11:00
Matt Joiner a583c4a914 TODO 2015-03-09 17:36:07 +11:00
Matt Joiner 1663a8a2f5 iplist: Fix ranges that contain extra colons, and minimize memory use for IP 2015-03-08 17:43:44 +11:00
Matt Joiner ad6ac3f2cd More cleaning of public interface 2015-03-08 17:28:14 +11:00
Matt Joiner 881458d079 iplist: Check for matches against IPv4 and IPv6 addresses 2015-03-07 17:09:39 +11:00
Matt Joiner 1c5bd1855a Improvements to P2P blocklist scanning errors 2015-03-07 17:09:18 +11:00
Matt Joiner 61adeee308 Make IPBlockList accessible from Client 2015-02-25 11:25:22 +11:00
Matt Joiner c6cc38c9cf iplist: Make range descriptions copies of substring, saves 8MB heap on level1 blocklist! 2015-01-31 01:53:01 +11:00
Matt Joiner b1ac38a617 iplist: Double performance of parsing line 2014-12-02 14:55:06 -06:00
Matt Joiner 9d66a837eb iplist: Benchmark parsing lines 2014-12-02 14:54:37 -06:00
Matt Joiner 30c6ce1bd0 iplist: Reuse the p2p line regexp 2014-12-01 23:49:21 -06:00
Matt Joiner d39caca48e Print iplist.Range nicely 2014-11-29 20:30:04 -06:00
Matt Joiner 88d570291c Implement iplist package, for block lists 2014-11-28 12:04:15 -06:00