Skip to content

Commit 32b0154

Browse files
committed
adding https init
1 parent f62eb74 commit 32b0154

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Debug from 'debug'
33
import dgram from 'dgram'
44
import EventEmitter from 'events'
55
import http from 'http'
6+
import https from 'https'
67
import peerid from 'bittorrent-peerid'
78
import series from 'run-series'
89
import string2compact from 'string2compact'
@@ -140,7 +141,7 @@ class Server extends EventEmitter {
140141

141142
if (opts.stats !== false) {
142143
if (!this.http) {
143-
this.http = http.createServer()
144+
this.http = (opts.ssl ? https : http).createServer(opts.ssl)
144145
this.http.on('error', err => { this._onError(err) })
145146
this.http.on('listening', onListening)
146147
}
@@ -307,7 +308,7 @@ class Server extends EventEmitter {
307308

308309
debug('listen (port: %o hostname: %o)', port, hostname)
309310

310-
const httpPort = isObject(port) ? (port.http || 0) : port
311+
const httpPort = (isObject(port) ? (port.http || 0) : port)
311312
const udpPort = isObject(port) ? (port.udp || 0) : port
312313

313314
// binding to :: only receives IPv4 connections if the bindv6only sysctl is set 0,

0 commit comments

Comments
 (0)