Feross Aboukhadijeh
ba4a52d2d1
Fixes for PR #125
2016-03-15 20:06:39 -07:00
Yoann Ciabaud
39507bf8be
Scrape implementation for websocket. Issue #116
2016-03-14 00:36:51 +01:00
Yoann Ciabaud
60f03b9529
Provide IP and HTTP headers in both HTTP and Websocket server
2016-03-03 11:10:54 +01:00
Alex
4142e8cf20
Remove info_hash from failure reason
2016-03-01 19:22:31 +01:00
Feross Aboukhadijeh
5dcdf9c4c1
ws tracker: don't crash with filter function
2016-02-29 17:35:04 -08:00
Feross Aboukhadijeh
0150982b9e
:: is already the default for node's http
2016-02-23 12:51:28 -08:00
Feross Aboukhadijeh
b5096e91c3
Support async createSwarm() and getSwarm()
...
Fix #95 .
Make server.getSwarm() and server.createSwarm() into async functions
that take a callback.
2016-01-03 19:50:23 +01:00
Feross Aboukhadijeh
b5de10156d
http server: fix bug in how peer ids are returned
2016-01-02 23:36:10 +01:00
Feross Aboukhadijeh
4816eb7a41
send 404 response when req headers are not sent
2015-12-17 00:41:07 +13:00
Feross Aboukhadijeh
5953841466
allow user to intercept 'request' event for http tracker
2015-12-17 00:40:46 +13:00
Feross Aboukhadijeh
714e876777
Give user chance to specify their own default http request handler
2015-12-16 12:37:53 +13:00
Feross Aboukhadijeh
c0555f4e1d
style
2015-12-16 12:19:44 +13:00
Feross Aboukhadijeh
f56ca3031b
WebSocket tracker should have a shorter interval – default: 2 minutes
2015-12-05 00:18:52 -08:00
Feross Aboukhadijeh
b4ec6fcbc4
fix huge websocket tracker interval
2015-12-05 00:02:57 -08:00
Feross Aboukhadijeh
d29367a4a0
if server.close() is called, end http response object
2015-08-24 00:11:21 +02:00
Linus Unnebäck
4ef0426b90
adhere to padded-blocks
2015-08-14 22:31:22 +02:00
Feross Aboukhadijeh
6935841d56
better debug log
2015-07-29 05:19:57 -07:00
Feross Aboukhadijeh
9db28c2fad
massive cleanup
2015-07-29 01:47:09 -07:00
Feross Aboukhadijeh
3746c05d79
restructure folders
2015-07-29 00:26:44 -07:00
Feross Aboukhadijeh
c4ee7aae36
fix thrown exception when websocket connection is aborted
...
alternative to https://github.com/feross/bittorrent-tracker/pull/89
2015-07-22 16:30:52 -07:00
Feross Aboukhadijeh
82aea33dfa
add server.ws.address() function
2015-07-16 18:31:13 -07:00
Feross Aboukhadijeh
89b3fb3086
support custom filter error messages
...
In addition to returning a boolean (`true` for allowed, `false` for
disallowed), you can return an `Error` object to disallow and provide a
custom reason.
Fixes #85
2015-07-08 10:13:52 -07:00
Feross Aboukhadijeh
f13accfc42
server: Enable WebSocket server by default
2015-07-08 09:44:00 -07:00
Feross Aboukhadijeh
834bf1db5e
server: http reqs 404 when only ws server is used
2015-07-08 09:43:47 -07:00
Feross Aboukhadijeh
bf5b9f289a
BREAKING: opts.filter function is async; add createSwarm
...
- The expected signature for opts.filter is now:
function myFilterFn (infoHash, params, cb) {
cb(infoHash === 'blah)
}
This allows interfacing with a database and fixes #80 .
Also, swarm.getSwarm() is no longer responsible for creating a Swarm
instance, only returning an instance if there is already one. Creating
a swarm happens in swarm.createSwarm(). This change only affects users
who were override swarm.getSwarm().
2015-07-04 17:13:07 -07:00
Feross Aboukhadijeh
8532426a87
Use anonymous functions
...
- allows overriding `onHttpRequest` on the tracker instance, instead of
only on the prototype
- plus, better perf (in theory)
2015-07-02 16:24:03 -07:00
Feross Aboukhadijeh
67291edfb3
server: emit full params object on server events
...
Fixes #81
2015-06-24 01:48:59 -07:00
Feross Aboukhadijeh
4816796fda
throw when listen is called twice in a row
2015-06-09 22:32:04 -07:00
Feross Aboukhadijeh
5be05f2794
Don't return if not listening (in onXXXXRequest)
...
Fixes #79
2015-06-09 22:25:25 -07:00
Feross Aboukhadijeh
ae9a99a6dc
add node 0.10 support back after PR
2015-05-29 21:05:00 -07:00
Garret Buell
e5531a315f
reuseAddr for dgram.CreateSocket
...
Creating a udp4 and udp6 socket on the same port can result in "ERROR: bind EADDRINUSE". Passing reuseAddr: true fixes this.
2015-05-29 10:43:35 -07:00
Feross Aboukhadijeh
340b3faff2
server: always send binary ids
2015-05-27 12:59:12 +02:00
Feross Aboukhadijeh
749cee1465
server command line: log peer_id for web peers
2015-05-27 12:58:50 +02:00
Feross Aboukhadijeh
a420af8a62
separate hostname.upd6 option for IPv6
2015-05-03 21:00:38 -07:00
Feross Aboukhadijeh
9c2b71fef1
fix listen debug log
2015-05-03 20:38:18 -07:00
Feross Aboukhadijeh
3eb0228c91
allow specifying hostnames for udp/http individually
2015-05-03 20:29:58 -07:00
Feross Aboukhadijeh
4da0f3b8ac
Listen over IPv6 for UDP
...
Fixes #73
2015-05-02 12:15:14 -07:00
Feross Aboukhadijeh
1cc5a511bd
udp server: support multiple info_hash scrape
...
Fixes #33
2015-05-01 17:36:07 -07:00
Feross Aboukhadijeh
efa15629dd
don't reply to http requests after server has stopped listening
2015-05-01 14:21:09 -07:00
Feross Aboukhadijeh
da0382a435
handle udp send errors
...
fixes #71
"Port should be > 0 and < 65536"
2015-05-01 14:20:53 -07:00
Feross Aboukhadijeh
1ec4eaa273
style
2015-05-01 14:17:11 -07:00
Feross Aboukhadijeh
604880b87b
server: support binding to specific hostname
...
Fixes #68
2015-04-02 11:42:13 +13:00
Feross Aboukhadijeh
7e7062d2ae
websocket tracker server/client: fix binary vs. hex bugs
2015-03-29 21:08:26 +13:00
Feross Aboukhadijeh
03bed33457
add webtorrent (websocket) tracker server
...
This PR merges webtorrent-tracker into this repo. Keeping the code in
sync between the two repos was becoming burdensome. This change should
not effect performance of the server since the webtorrent tracker is
disabled by default.
To enable the webtorrent tracker (disabled by default), do:
```js
var server = new Server({ ws: true })
```
2015-03-27 16:19:06 +13:00
Feross Aboukhadijeh
9ace2f5d3a
add command line server
...
Fixes #26
2015-03-19 21:47:47 -07:00
Feross Aboukhadijeh
bdc7edea70
preserve backwards compatibility
2015-02-19 12:56:09 -08:00
Nick Rafter
de19b61c52
Exposed full http request to filter function for more configurable filtering
2015-02-19 12:01:46 -05:00
Astro
138bdb8573
server: rm check for http/udp option
...
my use-case brings its own http server, i just use onHttpRequest()
2015-02-06 18:16:47 +01:00
Astro
b33531d835
server: allow onHttpRequest() with options={ action: 'announce' } for custom routing
...
For GH issue #58
2015-02-04 20:35:52 +01:00
Astro
e1b7fa7e5c
server: save HTTP req/res in params
...
For GH issue #58
2015-02-04 20:34:46 +01:00
Feross Aboukhadijeh
82e6792a6b
BREAKING CHANGES
...
Breaking changes:
- 'listening' event no longer emits with `port` param
- `server.port` property removed (instead, use
`server.http.address().port`)
Added features:
- expose http server as `server.http`
- expose udp server as `server.udp`
- client.destroy() - ungracefully leave the swarm
- server: added `filter` option to black/whitelist torrents
Bugfixes:
- client considers udp tracker errors to be warnings
- emit 'start', 'stop', 'update', etc. AFTER response sent
- fix udp error response action and message being `undefined`
Internal:
- remove `portfinder` dep
- add complete test for `filter` functionality
2015-01-29 14:59:08 -08:00
Sidd Sridharan
55079798c5
white/blacklist implemented ( #44 ) + docs/tests updated
2015-01-29 12:24:17 -08:00
Feross Aboukhadijeh
812c2ded4e
style
2015-01-28 18:18:47 -08:00
Feross Aboukhadijeh
a6f14037ff
style
2015-01-28 18:09:23 -08:00
Feross Aboukhadijeh
ebb86f728f
JavaScript Standard Style
...
https://github.com/feross/standard
2015-01-26 18:16:01 -08:00
Astro
2b8423b04a
server: fix interval unit
2015-01-05 19:55:58 +01:00
Astro
243c94e3d0
server: make onUdpRequest() part of public API
...
As per https://github.com/feross/bittorrent-tracker/pull/48#issuecomment-66893626
2014-12-14 00:12:21 +01:00
Feross Aboukhadijeh
83b4ecc7f5
Merge branch 'master' into server-ipv6
...
Conflicts:
server.js
2014-12-13 14:35:29 -08:00
Feross Aboukhadijeh
37203fb7a6
Merge pull request #49 from feross/reuse-udp
...
Server: reuse UDP socket
2014-12-13 14:17:21 -08:00
Astro
d79bf92db0
server: ipv6 support
2014-12-13 00:12:47 +01:00
Astro
80da7c50d0
server: reuse udp socket for responses
...
Reasons:
* Save file-descriptors
* Support clients behind NAT
2014-12-12 17:27:03 +01:00
Astro
2f7a7131d0
server: make onHttpRequest() part of public API
2014-12-12 16:52:13 +01:00
Feross Aboukhadijeh
79068a49cf
Use hex info_hash and peer_id throughout
2014-12-12 02:02:11 -08:00
Astro
991363a28c
Revert "server _onHttpRequest(): ensure non-empty params"
...
This reverts commit 74d9139049
.
Conflicts:
server.js
feross commented on 74d9139
5 hours ago
> Do we need to check for empty params here?
>
> _onRequest should return an error via callback because
> params.action is missing. Won't that work?
74d9139049 (commitcomment-8937428)
2014-12-12 02:57:01 +01:00
Feross Aboukhadijeh
edb5c6e854
code style
2014-12-11 12:53:39 -08:00
Astro
217bcf7de5
server _onUdpRequest(): don't check empty params, errors will be thrown now
2014-12-11 16:39:10 +01:00
Astro
7a8f9a779f
server _onHttpRequest(): don't wrap errors in errors
2014-12-11 16:24:33 +01:00
Astro
74d9139049
server _onHttpRequest(): ensure non-empty params
2014-12-11 16:22:17 +01:00
Astro
7a417a591d
parseUdpRequest(): fix params.ip
2014-12-11 16:11:12 +01:00
Astro
8439300df9
server: unify compact serialization
2014-12-10 16:51:35 +01:00
Astro
b72960dee3
server: split out Swarm
2014-12-10 16:47:41 +01:00
Astro
1c754a2f49
move parseHttpRequest(), parseUdpRequest() to lib/parse_{http,udp}.js
2014-12-10 00:44:45 +01:00
Astro
aea3c44c08
server: expose getSwarm()
...
drops capability to pass a *hex* infoHash
2014-12-09 23:18:47 +01:00
Astro
fee289b074
server: rm superfluous action fields
2014-12-09 23:18:35 +01:00
Astro
366b49bf06
server: split out _onRequest() et al
2014-12-09 02:35:05 +01:00
Astro
85be917d51
server: replace request string by action number
2014-12-09 00:29:02 +01:00
Astro
0bc88bcf22
server: split out parseUdpRequest()
2014-12-09 00:22:36 +01:00
Astro
037a53accb
server: split out parseHttpRequest()
2014-12-08 23:42:05 +01:00
Feross Aboukhadijeh
2824f16c49
don't assume peer var will exist
2014-11-26 17:40:34 +08:00
Feross Aboukhadijeh
026f2c2de0
Recover from unexpected events better
...
When you restart the tracker server, all peers it's tracking are
discarded. Then, clients that are already running will continue to send
`update` events, but the tracker throws them away because it was
expected to get a `start` event first.
This should only be a warning, and not a fatal error. I just made the
following changes:
- unexpected `started` event (for peer already in swarm) is treated as
an `update`
- unexpected `stopped` event is discarded
- unexpected `completed` event is treated as a `start`
- unexpected `update` event (from peer not in swarm) is treated as
`start`
Fixes #42
2014-11-26 15:27:02 +08:00
Feross Aboukhadijeh
01286e2ee7
listen() without port picks random port
2014-08-16 19:05:56 -07:00
Feross Aboukhadijeh
3d3c0d44d0
better 'listening' event handling
2014-08-06 22:35:43 -07:00
Feross Aboukhadijeh
a8ad0ca1fd
handle numWant === 0
2014-08-03 02:28:54 -07:00
Feross Aboukhadijeh
ea1548abb0
remove extra peer_id check
2014-08-03 01:51:55 -07:00
Feross Aboukhadijeh
ab32d5e7a1
cleanup debug() usage
2014-08-02 14:41:04 -07:00
Feross Aboukhadijeh
ad5c5b6133
lots of little cleanup
2014-08-02 13:43:06 -07:00
Feross Aboukhadijeh
8a6744f276
server: add debug logs
2014-07-20 03:33:33 -07:00
Feross Aboukhadijeh
d1ac7d930e
listen for error on udp socket
2014-07-13 15:28:23 -07:00
Feross Aboukhadijeh
24c8535792
tracker returns warnings for non-fatal conditions
2014-07-12 18:56:25 -07:00
Feross Aboukhadijeh
be875c40af
Fix serious client+server encoding error ( fix #32 )
2014-07-12 18:44:41 -07:00
Feross Aboukhadijeh
65c44e81f7
http server: error on invalid peer_id
2014-07-12 18:40:52 -07:00
Feross Aboukhadijeh
a685cb8088
Servers should obey the numWant
parameter ( fix #21 )
2014-07-11 03:51:29 -07:00
Feross Aboukhadijeh
b4928f001a
Server perf: Use binary info_hash strings ( fix #29 )
2014-07-10 22:05:56 -07:00
Feross Aboukhadijeh
ec67f42b14
only /announce and /scrape are valid endpoints
2014-07-10 21:30:17 -07:00
Feross Aboukhadijeh
23d2c02fe6
Support scrape without info_hash specified ( Fix #28 )
2014-07-10 21:30:10 -07:00
Feross Aboukhadijeh
ce171f196c
move common encode/decode fns to common.js
2014-07-10 21:28:37 -07:00
Feross Aboukhadijeh
2c34583c5f
http tracker: support multiple info_hash scrapes
2014-07-10 21:00:55 -07:00
Feross Aboukhadijeh
bf1d382c7a
http tracker server: error on missing params
2014-07-10 19:59:33 -07:00
Feross Aboukhadijeh
ac00794fb4
error on missing info hash
2014-07-05 14:41:46 -07:00
Feross Aboukhadijeh
f21ab25347
support starting udp and http on different ports
2014-07-05 14:41:22 -07:00