Commit graph

125 commits

Author SHA1 Message Date
Leo Balduf
9c1168746a hotfix: initialized scrape map 2016-04-02 20:23:42 -04:00
Leo Balduf
c6a3830c4b tracker: made (Scrape|Announce)Chain exported 2016-04-02 18:45:23 -04:00
Leo Balduf
230e0573c0 tracker: added a way for middleware constructors to fail 2016-03-24 15:29:57 +01:00
Leo Balduf
2974519e5c middleware: made middleware configurable 2016-03-16 18:20:59 +01:00
Jimmy Zelinskie
0dfc26caea remove config package 2016-03-02 21:05:33 -05:00
Jimmy Zelinskie
82b4395b11 errors: remove errors package 2016-03-02 21:05:32 -05:00
Justin Li
75b4a20e56 Bring in more old behaviour, use types for peer_id and infohash 2016-03-02 21:05:31 -05:00
Justin Li
05b7b955a1 Address minor comments 2016-03-02 21:05:30 -05:00
Jimmy Zelinskie
bd33c0c66b initial middleware refactor 2016-03-02 21:05:30 -05:00
Jimmy Zelinskie
5c27c960f0 clean the slate! 2016-03-02 21:05:30 -05:00
Jimmy Zelinskie
e37f453b34 Merge pull request #129 from chihaya/jwt
add support for jwt validation of infohashes
2016-02-25 14:37:57 -05:00
Jimmy Zelinskie
5af24b728a remove last use of "&*"
This no longer works as a terse way of copying heap allocated objects.

Fixes #93.
2016-01-21 11:37:37 -05:00
Jimmy Zelinskie
29c206611e replace time.NewTicker().C with time.After
They are synonymous and time.After is much easier to read.
2016-01-13 16:14:54 -05:00
Jimmy Zelinskie
82459297a4 add support for jwt validation of infohashes 2016-01-13 16:14:54 -05:00
Jimmy Zelinskie
9862a57b73 remove all private tracker logic
There are no consumers of any of this logic nor is it complete. We're
better off without it in the meantime until we have a use case and a
more cohesive model for expressing it.
2016-01-04 18:26:29 -05:00
Jimmy Zelinskie
f70be94911 explicitly copy values out of Storage
The previously implementation was using `&*` which is now getting
optimized by the Go compiler and no longer making a copy.
2016-01-04 16:31:24 -05:00
Jimmy Zelinskie
85e08f986e small doc fixes
[skip ci]
2015-10-31 16:56:59 -04:00
Leo Balduf
b12867dcf2 tracker: update reslicing to use implicit slice bounds 2015-10-28 19:56:04 +01:00
Jimmy Zelinskie
133450944c normalize all JSON to camelCase
Fixes #104.
2015-10-25 17:25:02 -04:00
Jimmy Zelinskie
b6929a7632 remove unused Server type 2015-10-25 16:31:46 -04:00
Jimmy Zelinskie
3532f39690 decrement storage size when purging torrents
Fixes #96.
2015-10-25 15:31:29 -04:00
Jimmy Zelinskie
c0c3eda290 config: make reaping configurable
This allows for configurable reaping rates and changes the default to
what many public trackers use in the wild.
2015-09-18 01:27:27 -04:00
Jimmy Zelinskie
dfd59e8823 tracker: fix logic recording complete events
520a357 inadvertently changed the logic on how many times
leecherFinished was being called and recording completion events to the
stats. This commit makes this that clearer and avoids over incrementing
the number of Seeders in our stats.
2015-08-26 16:59:25 -04:00
Jimmy Zelinskie
520a357e37 tracker: remove last "bad request"
A peer can join a swarm immediately as completed if they already have
the file before they ever announce. If we don't have them in our
leechers, we were previously failing to add them as a seeder.
2015-06-27 00:09:57 -04:00
Jimmy Zelinskie
744313d253 tracker: rm badrequest when state is unknown
This assumption was just totally wrong. If there is any kind of packet
loss or the tracker starts up to a pre-existing swarm, all the peers
will get bad request responses.
2015-06-26 22:49:09 -04:00
Jimmy Zelinskie
938542ac74 models: Announce field for AnnounceResponse 2015-04-04 15:42:28 -04:00
Jimmy Zelinskie
222415f467 udp: Implement draft of BEP45; Endpoint type added
Because of the requirement of storing multiple ports, Announce.Port has
been abolished and Announce.IPv4/IPv6 have been replaced with the
Endpoint type. HTTP has been updated to support this model. UDP has been
updated to support the latest draft of BEP45 and most of the
optional-types described in BEP41.
2015-03-29 03:03:19 -04:00
Jimmy Zelinskie
f25464a02b Merge branch 'master' into udp 2015-03-27 22:05:48 -04:00
Jimmy Zelinskie
b93cc26b98 models: properly format port into peerkey string 2015-03-26 22:11:13 -04:00
Jimmy Zelinskie
1bf788a99b tracker: fix reference to config 2015-03-23 20:43:33 -04:00
Jimmy Zelinskie
80c068c97a config: add create_on_announce option
This option allows the user to specify whether or not to create a new
swarm for torrents that do not previously exist within the tracker's
storage.
2015-03-23 20:02:13 -04:00
Jimmy Zelinskie
6188d52de0 models: Port method for PeerKey
This also adds some more docs for related stuff in the models package.
2015-03-22 19:41:57 -04:00
Jimmy Zelinskie
92866cfacd models: include port in peerkey 2015-03-22 18:44:09 -04:00
Justin Li
da46ef8c8a tracker: Return announcing peer if there are no others to avoid an empty peers field 2015-02-28 00:56:45 -05:00
Jimmy Zelinskie
ac2fcade1e tracker: record announce/scrape stats in handlers
This deduplicates code tracking the stats code tracking announces and
scrapes for each protocol. The down side is that it isn't aware of any
failures writing responses, but it was already being called before the
write to a response for HTTP.
2015-02-26 09:03:52 -05:00
Justin Li
7512f50731 udp: Add basic UDP tests 2015-02-21 14:35:21 -05:00
Justin Li
669128c83a tracker: Pass listen address into tracker.Server.Serve() 2015-02-21 13:16:21 -05:00
Justin Li
b6c1b3838b tracker: Remove impossible code for 'completed' event 2015-02-21 13:00:23 -05:00
Justin Li
afb22c3df6 udp: Add basic logging and more comments 2015-02-20 14:08:46 -05:00
Justin Li
92f3c62456 tracker: Add common interface to start and stop servers 2015-02-20 13:39:19 -05:00
Justin Li
e3aff35532 models: Use a uint16 for port numbers 2015-02-20 02:06:44 -05:00
Justin Li
d9a7611eee http: Unexport announce/scrape creation functions 2015-02-20 01:36:49 -05:00
Jimmy Zelinskie
e02f1dd0ea tracker: stop exporting shard methods 2015-02-08 17:14:05 -05:00
Justin Li
87c68f1973 2015 2015-01-01 12:02:25 -05:00
Jimmy Zelinskie
ddd10d9732 Begin refactor to better encapsulate configuration
This also updates the example_config.json which did not previously work.
Config.Config is now composed of embedded structs of other configs that
can later be used to clearly have a separation of concerns.
2014-11-01 20:12:40 -04:00
Jimmy Zelinskie
d754b5b376 Return PeerMap by reference.
In accordance with `go vet`, locks should only be returned by reference.
2014-10-28 12:28:51 -04:00
Jimmy Zelinskie
d46beb0f7d Remove unkeyed composite literals.
This was done to keep in accordance with `go vet`.
2014-10-28 12:26:37 -04:00
Jimmy Zelinskie
deb44da5f0 add missing json struct tag 2014-09-29 15:14:46 -04:00
Paul Saab
be2ddb7e4d Fix IPv4 stats
net.ParseIP() will return a v4mapped address which makes len(ip) ==
IPv6len and breaks stats for IPv4 requests.
2014-09-29 11:55:18 -07:00
Paul Saab
2b8dec07fe Use atomics to track peermap size 2014-09-24 16:24:36 -07:00