Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion client.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ class Client extends EventEmitter {

this._trackers = announce
.map(announceUrl => {
const protocol = url.parse(announceUrl).protocol
const parsedUrl = url.parse(announceUrl)
const port = parsedUrl.port
if (port < 0 || port > 65535) {
nextTickWarn(new Error(`Invalid tracker port: ${announceUrl}`))
return null
}

const protocol = parsedUrl.protocol
if ((protocol === 'http:' || protocol === 'https:') &&
typeof HTTPTracker === 'function') {
return new HTTPTracker(this, announceUrl)
Expand Down