Skip to content

Commit 3eb0228

Browse files
committed
allow specifying hostnames for udp/http individually
1 parent e7f0478 commit 3eb0228

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ Server.prototype.listen = function (/* port, hostname, onlistening */) {
121121
// ATTENTION:
122122
// binding to :: only receives IPv4 connections if the bindv6only
123123
// sysctl is set 0, which is the default on many operating systems.
124-
if (self.http) self.http.listen(port.http || port, hostname || '::')
125-
if (self.udp4) self.udp4.bind(port.udp || port, hostname)
126-
if (self.udp6) self.udp6.bind(port.udp || port, hostname)
124+
if (self.http) self.http.listen(port.http || port, (hostname && hostname.http) || hostname || '::')
125+
if (self.udp4) self.udp4.bind(port.udp || port, (hostname && hostname.udp) || hostname)
126+
if (self.udp6) self.udp6.bind(port.udp || port, (hostname && hostname.udp) || hostname)
127127
}
128128

129129
Server.prototype.close = function (cb) {

0 commit comments

Comments
 (0)