Feross Aboukhadijeh
2959c2cea6
Use safe-buffer
...
Use the new Buffer APIs from Node v6 for added security. For example,
`Buffer.from()` will throw if passed a number, unlike `Buffer()` which
allocated UNINITIALIZED memory in that case.
Use the `safe-buffer` package for compatibility with previous versions
of
Node.js, including v4.x, v0.12, and v0.10.
https://github.com/feross/safe-buffer
2016-05-29 23:12:23 -07:00
Feross Aboukhadijeh
4a0758db24
Fix unnecessary escape
2016-04-23 23:02:52 -07:00
Feross Aboukhadijeh
4431ae14ab
Ensure client.destroy() callback is called when websocket pool used
...
Fixes #141
2016-03-31 21:49:18 -07:00
Feross Aboukhadijeh
2966165a8f
BREAKING: Client() takes single opts object now
...
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118 . Fixes #115 .
Added ws tests for scrape.
2016-03-31 21:37:51 -07:00
Feross Aboukhadijeh
c92b1714db
Remove all Function.bind calls
...
For https://github.com/feross/webtorrent-desktop/issues/256
2016-03-28 23:38:23 -07:00
Feross Aboukhadijeh
f60ecec0dc
remove buffer-equals dependency
2016-03-24 03:25:31 -07:00
Feross Aboukhadijeh
35697f5187
Merge pull request #137 from fanatid/feature/buffer-equals
...
buffer-equals instead buffer-equal
2016-03-24 03:21:08 -07:00
Feross Aboukhadijeh
721a7bea7c
make server and client always send { action: 'announce' }
2016-03-23 22:04:07 -07:00
Feross Aboukhadijeh
2fffdc6730
ws server: drop support for old tracker clients
...
old clients don’t send params.action === ‘action’
2016-03-23 21:27:32 -07:00
Feross Aboukhadijeh
4159d35cfc
ws client: drop support for old tracker servers
...
Old tracker server versions don’t send data.action === ‘announce’
2016-03-23 21:26:52 -07:00
Kirill Fomichev
0193f58654
buffer-equals instead buffer-equal
2016-03-21 14:46:39 +03:00
Feross Aboukhadijeh
89b9fb7f40
prevent two reconnect timers for running at same time
2016-03-18 23:14:48 -07:00
Feross Aboukhadijeh
49025c1320
reset self.peers = {} after destroy
...
Supersedes PR #135
2016-03-18 23:12:54 -07:00
Feross Aboukhadijeh
db868cac78
guard against self.socket being null
2016-03-18 23:12:28 -07:00
Feross Aboukhadijeh
51e2439333
Lower generated offer number to 5
...
Temporary mitigation for leak issue
2016-03-16 18:06:42 -07:00
Feross Aboukhadijeh
c181020937
client: Do not include WebRTC offers with 'stopped' announce event ( fix #132 )
2016-03-16 18:04:56 -07:00
Feross Aboukhadijeh
2c23ae7f00
client: websocket: Unref peer.trackerTimeout
2016-03-16 17:59:01 -07:00
Feross Aboukhadijeh
d079171044
Fixes for PR #129
2016-03-16 17:58:47 -07:00
Yoann Ciabaud
5127aad052
Make electron webrtc working in headless and stabdard fix
2016-03-16 17:33:07 -07:00
Yoann Ciabaud
d4c34c344e
Destroy peers and tracker timeouts on destroy
2016-03-16 17:33:07 -07:00
Yoann Ciabaud
3252070328
Clear reconnect timeout on destroy
2016-03-16 17:33:06 -07:00
Yoann Ciabaud
35e6eeaef2
Close the websocket only when no one is using it
2016-03-16 17:33:06 -07:00
Feross Aboukhadijeh
5d4cf75e0a
Merge pull request #123 from DiegoRBaquero/patch-1
...
Reconnect timeout improvement
2016-03-15 21:41:01 -07:00
Diego Rodríguez Baquero
050d95ac72
Variance and higher max
2016-03-16 01:14:24 -03:00
Feross Aboukhadijeh
8c01cb7268
do not throw and crash client
2016-03-15 20:59:04 -07:00
Feross Aboukhadijeh
ba4a52d2d1
Fixes for PR #125
2016-03-15 20:06:39 -07:00
Feross Aboukhadijeh
3d753ab805
Merge pull request #125 from yciabaud/ws-scrape
...
Scrape implementation for websocket. Issue #116
2016-03-15 19:39:59 -07:00
Feross Aboukhadijeh
6df64ffe06
Fixes for PR #126
2016-03-14 19:16:00 -07:00
Autarc
09e2b55e42
invoke callbacks of destroyed trackers
2016-03-14 17:13:34 +01:00
Yoann Ciabaud
39507bf8be
Scrape implementation for websocket. Issue #116
2016-03-14 00:36:51 +01:00
Yoann Ciabaud
eb3cefec35
Use type from server to filter peers to offer
2016-03-13 15:51:08 +01:00
Feross Aboukhadijeh
e3c65bc2a3
PR Feedback for #120
2016-03-11 17:21:19 -08:00
Diego Rodríguez Baquero
529203ea40
Max reconnect time
2016-03-11 15:26:55 -03:00
Yoann Ciabaud
af631d9fce
Merge remote-tracking branch 'upstream/master' into client-infos
2016-03-11 10:34:07 +01:00
Yoann Ciabaud
2f37e6c476
Adds a type param to identify the source of the peer
2016-03-11 10:09:09 +01:00
Diego Rodríguez Baquero
8e2dbdc576
Reconnect timeout increase lineally
...
Minimum set at 15 seconds, each retry adds 30 seconds.
2016-03-11 04:12:09 -03:00
Feross Aboukhadijeh
0585d8b18a
use delete obj[key]
instead of obj[key] = null
2016-03-10 21:26:28 -08:00
Diego Rodríguez Baquero
e185f321d3
Delete peer on announce stopped
2016-03-11 01:10:34 -03:00
Yoann Ciabaud
60f03b9529
Provide IP and HTTP headers in both HTTP and Websocket server
2016-03-03 11:10:54 +01:00
Feross Aboukhadijeh
a82f5c9878
websocket client: fix: emit 'update' when data.complete is 0
2016-02-29 14:48:59 -08:00
Feross Aboukhadijeh
b34fc100a1
fixes for PR #107
2016-02-29 12:34:06 -08:00
Feross Aboukhadijeh
1db2cb8736
Merge pull request #107 from yciabaud/announce-extension
...
Provide a way to give extra data on announce
2016-02-29 10:19:14 -08:00
Feross Aboukhadijeh
ad580c3d7c
fixes for simple-websocket@4
2016-02-15 19:38:50 -08:00
Feross Aboukhadijeh
1e919c44cb
changes for simple-get 2.0.0
2016-02-14 00:31:44 -08:00
Feross Aboukhadijeh
ab042bd2f6
remove old todo
2016-02-05 14:06:45 -08:00
Yoann Ciabaud
f1669a506e
Provide a way to give updated announce opts via callback on setInterval
2016-02-03 08:28:38 +01:00
Alex
8692e45215
Fix display error
2016-01-13 15:57:22 -05: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
8d735bf97d
more cleanup
2015-12-05 03:06:54 -08:00
Feross Aboukhadijeh
3f1c9644ec
50s offer timeout
2015-12-05 03:06:46 -08:00
Feross Aboukhadijeh
5687a72fdb
raise number of offers created to 10 again
2015-12-05 01:01:23 -08:00
Feross Aboukhadijeh
fe2ac4ac67
cleanup peers that never get an answer
...
attempt to fix https://github.com/feross/webtorrent/issues/502
2015-12-05 01:01:04 -08:00
Feross Aboukhadijeh
e6382c9af6
don't send peer to itself
2015-12-05 00:41:56 -08:00
Feross Aboukhadijeh
208ae5d911
calling tracker.setInterval() should override current interval
2015-12-04 23:59:11 -08:00
Feross Aboukhadijeh
582ac990a4
webtorrent perf: create 5 offers at a time
2015-12-04 23:38:50 -08:00
Feross Aboukhadijeh
177171b82c
expose client.peerId
and client.peerIdBuffer
2015-12-02 22:33:15 -08:00
Feross Aboukhadijeh
d344537766
expose client.infoHash and client.infoHashBuffer
2015-12-02 15:46:41 -08:00
Feross Aboukhadijeh
38a80093a1
Fix UDP scrape returning invalid info hashes ( Fix #97 )
2015-12-02 15:35:42 -08:00
Feross Aboukhadijeh
e9322a32d6
code style
2015-12-02 15:31:20 -08:00
Aram Drevekenin
ab3482fc4f
Changed infoHash to always be hex
2015-11-29 16:02:29 +02:00
Feross Aboukhadijeh
abbb076484
client: interval.unref()
2015-08-24 00:11:48 +02:00
Feross Aboukhadijeh
6ef2d98b07
client: websocket-tracker: announce on reconnect
...
when coming back from being offline, or losing the websocket
connection, announcing immediately means peers will be found faster
(for us and remote peers who may be sitting at 0 peers)
2015-07-29 03:56:22 -07:00
Feross Aboukhadijeh
4128604301
remove socket from pool on destroy
2015-07-29 03:21:31 -07:00
Feross Aboukhadijeh
f5d2810c89
Announce to websocket tracker every 30 seconds (for #338 )
2015-07-29 02:12:14 -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
2dc56de223
rename files
2015-07-29 00:06:59 -07:00
Feross Aboukhadijeh
5aa0696a34
fix crash, oops
2015-07-27 15:46:49 -07:00
Feross Aboukhadijeh
c8fcf81908
fix for node 0.10
2015-07-27 15:28:23 -07:00
Feross Aboukhadijeh
a49a0d8d18
remove stray log
2015-07-27 15:24:34 -07:00
Feross Aboukhadijeh
c3abef72ce
tracker should not modify opts
object, it's passed to all trackers
2015-07-27 15:19:18 -07:00
Feross Aboukhadijeh
c42335af43
unref timer
2015-07-16 18:33:54 -07:00
Feross Aboukhadijeh
5b79d42dcd
client: destroy callback isn't called until after cleanup
2015-07-16 18:33:50 -07:00
Feross Aboukhadijeh
b5d8748db4
fix crash on invalid udp tracker response
2015-07-06 17:48:39 -07:00
Feross Aboukhadijeh
37f95b4b54
small cleanup
2015-07-04 17:10:41 -07:00
Feross Aboukhadijeh
96f6fce1ab
only return correct peer type from swarm
2015-06-06 13:10:49 -07:00
Feross Aboukhadijeh
da5036424b
fix exception in websocket tracker
2015-05-30 14:20:42 -07:00
Feross Aboukhadijeh
ac2c3d06d8
client: Re-use WebSocket connections
...
Use a socket pool, so tracker clients share WebSocket objects for the
same server.
In practice, WebSockets are pretty slow to establish, so this gives a
nice performance boost, and saves browser resources.
2015-05-27 13:09:15 +02:00
Feross Aboukhadijeh
3be06d6684
always produce valid urls with trailing /
...
Fixes this error:
ERROR: connection error to wss://tracker.webtorrent.io?1fe16837ed
ERROR: If you think this is a bug in webtorrent, report it!
2015-05-22 16:21:55 +02:00
Feross Aboukhadijeh
c1bbade6d7
cache infohash and peerid
2015-05-20 06:45:59 -07:00
Feross Aboukhadijeh
bb145cce14
ws client: ignore offers/answers from self
2015-05-20 06:40:25 -07:00
Feross Aboukhadijeh
d40eeccf4d
limit webrtc offers to 10
2015-05-19 04:32:17 -07:00
Feross Aboukhadijeh
02c92fd2ba
randomize the peers that are given out
2015-05-19 04:32:09 -07:00
Feross Aboukhadijeh
2505e13009
after socket destroy, ignore all future errors
2015-05-17 13:53:36 -07:00
Feross Aboukhadijeh
d78b678f5b
fix regression: double cleanup bug
2015-05-17 01:47:12 -07:00
Feross Aboukhadijeh
0482c01a47
ws client: better offline reconnect behavior
...
Fixes https://github.com/feross/webtorrent/issues/318
2015-05-17 00:07:21 -07:00
Feross Aboukhadijeh
8788d75737
udp/ws clients: add destroy functions
...
Fixes #75
2015-05-16 23:25:34 -07:00
Feross Aboukhadijeh
ee91dff19d
client: add http tracker destroy function
2015-05-16 22:55:41 -07:00
Feross Aboukhadijeh
2b48883742
ws tracker: JSON.stringify messages
2015-05-05 23:05:10 -07:00
Feross Aboukhadijeh
938c025ed9
remove wrtc
dependency
...
For #303
2015-05-03 17:21:08 -07:00
Feross Aboukhadijeh
9a6e854609
Limit number of WebRTC offers to only 5
2015-05-03 16:53:37 -07:00
Feross Aboukhadijeh
68f2317870
Revert "prevent "value out of bounds error""
...
This reverts commit 25b25f663c
.
2015-05-03 16:46:39 -07:00
Feross Aboukhadijeh
1338282cc9
prevent negative complete/incomplete numbers
...
Fixes #65
Fixes #72
2015-05-03 16:38:16 -07:00
Feross Aboukhadijeh
4c3c950056
One more fix for IPv6 UDP support
...
For #73
2015-05-03 14:20:17 -07:00
Feross Aboukhadijeh
25b25f663c
prevent "value out of bounds error"
...
For #72
2015-05-01 21:32:54 -07:00
Feross Aboukhadijeh
1cc5a511bd
udp server: support multiple info_hash scrape
...
Fixes #33
2015-05-01 17:36:07 -07:00
Feross Aboukhadijeh
d705be775e
generate 5 offers in the browser, not 50
2015-04-30 21:00:14 -07:00
Feross Aboukhadijeh
ee3ea92c47
fix webrtc support detection in browser
2015-04-23 23:27:12 -07:00
Feross Aboukhadijeh
814b167e8a
bittorrent-tracker/client should work if wrtc
fails to install
2015-04-23 22:48:39 -07:00
Feross Aboukhadijeh
e0afafc776
don't return empty wrtc object in browser
2015-04-23 21:15:40 -07:00