| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e3b1243 commit 6f7b561
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,13 +164,12 @@ function onlookupservice(err, hostname, service) { | |||
| 164 | 164 | } | |
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | - // lookupService(address, port, callback) | ||
| 168 | - function lookupService(hostname, port, callback) { | ||
| 167 | + function lookupService(address, port, callback) { | ||
| 169 | 168 | if (arguments.length !== 3) | |
| 170 | - throw new ERR_MISSING_ARGS('hostname', 'port', 'callback'); | ||
| 169 | + throw new ERR_MISSING_ARGS('address', 'port', 'callback'); | ||
| 171 | 170 | ||
| 172 | - if (isIP(hostname) === 0) | ||
| 173 | - throw new ERR_INVALID_OPT_VALUE('hostname', hostname); | ||
| 171 | + if (isIP(address) === 0) | ||
| 172 | + throw new ERR_INVALID_OPT_VALUE('address', address); | ||
| 174 | 173 | ||
| 175 | 174 | if (!isLegalPort(port)) | |
| 176 | 175 | throw new ERR_SOCKET_BAD_PORT(port); | |
@@ -182,12 +181,12 @@ function lookupService(hostname, port, callback) { | |||
| 182 | 181 | ||
| 183 | 182 | const req = new GetNameInfoReqWrap(); | |
| 184 | 183 | req.callback = callback; | |
| 185 | - req.hostname = hostname; | ||
| 184 | + req.hostname = address; | ||
| 186 | 185 | req.port = port; | |
| 187 | 186 | req.oncomplete = onlookupservice; | |
| 188 | 187 | ||
| 189 | - const err = cares.getnameinfo(req, hostname, port); | ||
| 190 | - if (err) throw dnsException(err, 'getnameinfo', hostname); | ||
| 188 | + const err = cares.getnameinfo(req, address, port); | ||
| 189 | + if (err) throw dnsException(err, 'getnameinfo', address); | ||
| 191 | 190 | return req; | |
| 192 | 191 | } | |
| 193 | 192 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,17 +151,17 @@ function createLookupServicePromise(hostname, port) { | |||
| 151 | 151 | }); | |
| 152 | 152 | } | |
| 153 | 153 | ||
| 154 | - function lookupService(hostname, port) { | ||
| 154 | + function lookupService(address, port) { | ||
| 155 | 155 | if (arguments.length !== 2) | |
| 156 | - throw new ERR_MISSING_ARGS('hostname', 'port'); | ||
| 156 | + throw new ERR_MISSING_ARGS('address', 'port'); | ||
| 157 | 157 | ||
| 158 | - if (isIP(hostname) === 0) | ||
| 159 | - throw new ERR_INVALID_OPT_VALUE('hostname', hostname); | ||
| 158 | + if (isIP(address) === 0) | ||
| 159 | + throw new ERR_INVALID_OPT_VALUE('address', address); | ||
| 160 | 160 | ||
| 161 | 161 | if (!isLegalPort(port)) | |
| 162 | 162 | throw new ERR_SOCKET_BAD_PORT(port); | |
| 163 | 163 | ||
| 164 | - return createLookupServicePromise(hostname, +port); | ||
| 164 | + return createLookupServicePromise(address, +port); | ||
| 165 | 165 | } | |
| 166 | 166 | ||
| 167 | 167 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -265,29 +265,29 @@ dns.lookup('', { | |||
| 265 | 265 | const err = { | |
| 266 | 266 | code: 'ERR_MISSING_ARGS', | |
| 267 | 267 | type: TypeError, | |
| 268 | - message: 'The "hostname", "port", and "callback" arguments must be ' + | ||
| 268 | + message: 'The "address", "port", and "callback" arguments must be ' + | ||
| 269 | 269 | 'specified' | |
| 270 | 270 | }; | |
| 271 | 271 | ||
| 272 | 272 | common.expectsError(() => dns.lookupService('0.0.0.0'), err); | |
| 273 | - err.message = 'The "hostname" and "port" arguments must be specified'; | ||
| 273 | + err.message = 'The "address" and "port" arguments must be specified'; | ||
| 274 | 274 | common.expectsError(() => dnsPromises.lookupService('0.0.0.0'), err); | |
| 275 | 275 | } | |
| 276 | 276 | ||
| 277 | 277 | { | |
| 278 | - const invalidHost = 'fasdfdsaf'; | ||
| 278 | + const invalidAddress = 'fasdfdsaf'; | ||
| 279 | 279 | const err = { | |
| 280 | 280 | code: 'ERR_INVALID_OPT_VALUE', | |
| 281 | 281 | type: TypeError, | |
| 282 | - message: `The value "${invalidHost}" is invalid for option "hostname"` | ||
| 282 | + message: `The value "${invalidAddress}" is invalid for option "address"` | ||
| 283 | 283 | }; | |
| 284 | 284 | ||
| 285 | 285 | common.expectsError(() => { | |
| 286 | - dnsPromises.lookupService(invalidHost, 0); | ||
| 286 | + dnsPromises.lookupService(invalidAddress, 0); | ||
| 287 | 287 | }, err); | |
| 288 | 288 | ||
| 289 | 289 | common.expectsError(() => { | |
| 290 | - dns.lookupService(invalidHost, 0, common.mustNotCall()); | ||
| 290 | + dns.lookupService(invalidAddress, 0, common.mustNotCall()); | ||
| 291 | 291 | }, err); | |
| 292 | 292 | } | |
| 293 | 293 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments