| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f91babe commit 0bb84b0
27 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,6 +114,9 @@ exist and calls such as `socket.address()` and `socket.setTTL()` will fail. | |||
| 114 | 114 | <!-- YAML | |
| 115 | 115 | added: v0.1.99 | |
| 116 | 116 | changes: | |
| 117 | + - version: REPLACEME | ||
| 118 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 119 | + description: The `family` property now returns a string instead of a number. | ||
| 117 | 120 | - version: v18.0.0 | |
| 118 | 121 | pr-url: https://github.com/nodejs/node/pull/41431 | |
| 119 | 122 | description: The `family` property now returns a number instead of a string. | |
@@ -125,7 +128,7 @@ The event handler function is passed two arguments: `msg` and `rinfo`. | |||
| 125 | 128 | * `msg` {Buffer} The message. | |
| 126 | 129 | * `rinfo` {Object} Remote address information. | |
| 127 | 130 | * `address` {string} The sender address. | |
| 128 | - * `family` {number} The address family (`4` for IPv4 or `6` for IPv6). | ||
| 131 | + * `family` {string} The address family (`'IPv4'` or `'IPv6'`). | ||
| 129 | 132 | * `port` {number} The sender port. | |
| 130 | 133 | * `size` {number} The message size. | |
| 131 | 134 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -179,6 +179,11 @@ section if a custom port is used. | |||
| 179 | 179 | <!-- YAML | |
| 180 | 180 | added: v0.1.90 | |
| 181 | 181 | changes: | |
| 182 | + - version: REPLACEME | ||
| 183 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 184 | + description: For compatibility with `node:net`, when passing an option | ||
| 185 | + object the `family` option can be the string `'IPv4'` or the | ||
| 186 | + string `'IPv6'`. | ||
| 182 | 187 | - version: v18.0.0 | |
| 183 | 188 | pr-url: https://github.com/nodejs/node/pull/41678 | |
| 184 | 189 | description: Passing an invalid callback to the `callback` argument | |
@@ -197,9 +202,10 @@ changes: | |||
| 197 | 202 | ||
| 198 | 203 | * `hostname` {string} | |
| 199 | 204 | * `options` {integer | Object} | |
| 200 | - * `family` {integer} The record family. Must be `4`, `6`, or `0`. The value | ||
| 201 | - `0` indicates that IPv4 and IPv6 addresses are both returned. **Default:** | ||
| 202 | - `0`. | ||
| 205 | + * `family` {integer|string} The record family. Must be `4`, `6`, or `0`. For | ||
| 206 | + backward compatibility reasons,`'IPv4'` and `'IPv6'` are interpreted as `4` | ||
| 207 | + and `6` respectively. The value `0` indicates that IPv4 and IPv6 addresses | ||
| 208 | + are both returned. **Default:** `0`. | ||
| 203 | 209 | * `hints` {number} One or more [supported `getaddrinfo` flags][]. Multiple | |
| 204 | 210 | flags may be passed by bitwise `OR`ing their values. | |
| 205 | 211 | * `all` {boolean} When `true`, the callback returns all resolved addresses in | |
@@ -219,8 +225,8 @@ changes: | |||
| 219 | 225 | ||
| 220 | 226 | Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or | |
| 221 | 227 | AAAA (IPv6) record. All `option` properties are optional. If `options` is an | |
| 222 | - integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 | ||
| 223 | - and IPv6 addresses are both returned if found. | ||
| 228 | + integer, then it must be `4` or `6` – if `options` is `0` or not provided, then | ||
| 229 | + IPv4 and IPv6 addresses are both returned if found. | ||
| 224 | 230 | ||
| 225 | 231 | With the `all` option set to `true`, the arguments for `callback` change to | |
| 226 | 232 | `(err, addresses)`, with `addresses` being an array of objects with the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -286,6 +286,9 @@ Emitted when the server has been bound after calling [`server.listen()`][]. | |||
| 286 | 286 | <!-- YAML | |
| 287 | 287 | added: v0.1.90 | |
| 288 | 288 | changes: | |
| 289 | + - version: REPLACEME | ||
| 290 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 291 | + description: The `family` property now returns a string instead of a number. | ||
| 289 | 292 | - version: v18.0.0 | |
| 290 | 293 | pr-url: https://github.com/nodejs/node/pull/41431 | |
| 291 | 294 | description: The `family` property now returns a number instead of a string. | |
@@ -296,7 +299,7 @@ changes: | |||
| 296 | 299 | Returns the bound `address`, the address `family` name, and `port` of the server | |
| 297 | 300 | as reported by the operating system if listening on an IP socket | |
| 298 | 301 | (useful to find which port was assigned when getting an OS-assigned address): | |
| 299 | - `{ port: 12346, family: 4, address: '127.0.0.1' }`. | ||
| 302 | + `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. | ||
| 300 | 303 | ||
| 301 | 304 | For a server listening on a pipe or Unix domain socket, the name is returned | |
| 302 | 305 | as a string. | |
@@ -743,6 +746,9 @@ See also: [`socket.setTimeout()`][]. | |||
| 743 | 746 | <!-- YAML | |
| 744 | 747 | added: v0.1.90 | |
| 745 | 748 | changes: | |
| 749 | + - version: REPLACEME | ||
| 750 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 751 | + description: The `family` property now returns a string instead of a number. | ||
| 746 | 752 | - version: v18.0.0 | |
| 747 | 753 | pr-url: https://github.com/nodejs/node/pull/41431 | |
| 748 | 754 | description: The `family` property now returns a number instead of a string. | |
@@ -752,7 +758,7 @@ changes: | |||
| 752 | 758 | ||
| 753 | 759 | Returns the bound `address`, the address `family` name and `port` of the | |
| 754 | 760 | socket as reported by the operating system: | |
| 755 | - `{ port: 12346, family: 4, address: '127.0.0.1' }` | ||
| 761 | + `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` | ||
| 756 | 762 | ||
| 757 | 763 | ### `socket.bufferSize` | |
| 758 | 764 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -225,6 +225,9 @@ always `[0, 0, 0]`. | |||
| 225 | 225 | <!-- YAML | |
| 226 | 226 | added: v0.6.0 | |
| 227 | 227 | changes: | |
| 228 | + - version: REPLACEME | ||
| 229 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 230 | + description: The `family` property now returns a string instead of a number. | ||
| 228 | 231 | - version: v18.0.0 | |
| 229 | 232 | pr-url: https://github.com/nodejs/node/pull/41431 | |
| 230 | 233 | description: The `family` property now returns a number instead of a string. | |
@@ -242,12 +245,12 @@ The properties available on the assigned network address object include: | |||
| 242 | 245 | ||
| 243 | 246 | * `address` {string} The assigned IPv4 or IPv6 address | |
| 244 | 247 | * `netmask` {string} The IPv4 or IPv6 network mask | |
| 245 | - * `family` {number} Either `4` (for IPv4) or `6` (for IPv6) | ||
| 248 | + * `family` {string} Either `IPv4` or `IPv6` | ||
| 246 | 249 | * `mac` {string} The MAC address of the network interface | |
| 247 | 250 | * `internal` {boolean} `true` if the network interface is a loopback or | |
| 248 | 251 | similar interface that is not remotely accessible; otherwise `false` | |
| 249 | 252 | * `scopeid` {number} The numeric IPv6 scope ID (only specified when `family` | |
| 250 | - is `6`) | ||
| 253 | + is `IPv6`) | ||
| 251 | 254 | * `cidr` {string} The assigned IPv4 or IPv6 address with the routing prefix | |
| 252 | 255 | in CIDR notation. If the `netmask` is invalid, this property is set | |
| 253 | 256 | to `null`. | |
@@ -260,15 +263,15 @@ The properties available on the assigned network address object include: | |||
| 260 | 263 | { | |
| 261 | 264 | address: '127.0.0.1', | |
| 262 | 265 | netmask: '255.0.0.0', | |
| 263 | - family: 4, | ||
| 266 | + family: 'IPv4', | ||
| 264 | 267 | mac: '00:00:00:00:00:00', | |
| 265 | 268 | internal: true, | |
| 266 | 269 | cidr: '127.0.0.1/8' | |
| 267 | 270 | }, | |
| 268 | 271 | { | |
| 269 | 272 | address: '::1', | |
| 270 | 273 | netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', | |
| 271 | - family: 6, | ||
| 274 | + family: 'IPv6', | ||
| 272 | 275 | mac: '00:00:00:00:00:00', | |
| 273 | 276 | scopeid: 0, | |
| 274 | 277 | internal: true, | |
@@ -279,15 +282,15 @@ The properties available on the assigned network address object include: | |||
| 279 | 282 | { | |
| 280 | 283 | address: '192.168.1.108', | |
| 281 | 284 | netmask: '255.255.255.0', | |
| 282 | - family: 4, | ||
| 285 | + family: 'IPv4', | ||
| 283 | 286 | mac: '01:02:03:0a:0b:0c', | |
| 284 | 287 | internal: false, | |
| 285 | 288 | cidr: '192.168.1.108/24' | |
| 286 | 289 | }, | |
| 287 | 290 | { | |
| 288 | 291 | address: 'fe80::a00:27ff:fe4e:66a1', | |
| 289 | 292 | netmask: 'ffff:ffff:ffff:ffff::', | |
| 290 | - family: 6, | ||
| 293 | + family: 'IPv6', | ||
| 291 | 294 | mac: '01:02:03:0a:0b:0c', | |
| 292 | 295 | scopeid: 1, | |
| 293 | 296 | internal: false, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -956,6 +956,9 @@ tlsSocket.once('session', (session) => { | |||
| 956 | 956 | <!-- YAML | |
| 957 | 957 | added: v0.11.4 | |
| 958 | 958 | changes: | |
| 959 | + - version: REPLACEME | ||
| 960 | + pr-url: https://github.com/nodejs/node/pull/43054 | ||
| 961 | + description: The `family` property now returns a string instead of a number. | ||
| 959 | 962 | - version: v18.0.0 | |
| 960 | 963 | pr-url: https://github.com/nodejs/node/pull/41431 | |
| 961 | 964 | description: The `family` property now returns a number instead of a string. | |
@@ -965,7 +968,7 @@ changes: | |||
| 965 | 968 | ||
| 966 | 969 | Returns the bound `address`, the address `family` name, and `port` of the | |
| 967 | 970 | underlying socket as reported by the operating system: | |
| 968 | - `{ port: 12346, family: 4, address: '127.0.0.1' }`. | ||
| 971 | + `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. | ||
| 969 | 972 | ||
| 970 | 973 | ### `tlsSocket.authorizationError` | |
| 971 | 974 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,8 +145,18 @@ function lookup(hostname, options, callback) { | |||
| 145 | 145 | validateHints(hints); | |
| 146 | 146 | } | |
| 147 | 147 | if (options?.family != null) { | |
| 148 | - validateOneOf(options.family, 'options.family', validFamilies, true); | ||
| 149 | - family = options.family; | ||
| 148 | + switch (options.family) { | ||
| 149 | + case 'IPv4': | ||
| 150 | + family = 4; | ||
| 151 | + break; | ||
| 152 | + case 'IPv6': | ||
| 153 | + family = 6; | ||
| 154 | + break; | ||
| 155 | + default: | ||
| 156 | + validateOneOf(options.family, 'options.family', validFamilies, true); | ||
| 157 | + family = options.family; | ||
| 158 | + break; | ||
| 159 | + } | ||
| 150 | 160 | } | |
| 151 | 161 | if (options?.all != null) { | |
| 152 | 162 | validateBoolean(options.all, 'options.all'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -800,9 +800,7 @@ protoGetter('remoteAddress', function remoteAddress() { | |||
| 800 | 800 | }); | |
| 801 | 801 | ||
| 802 | 802 | protoGetter('remoteFamily', function remoteFamily() { | |
| 803 | - const { family } = this._getpeername(); | ||
| 804 | - | ||
| 805 | - return family ? `IPv${family}` : family; | ||
| 803 | + return this._getpeername().family; | ||
| 806 | 804 | }); | |
| 807 | 805 | ||
| 808 | 806 | protoGetter('remotePort', function remotePort() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -216,7 +216,7 @@ function getCIDR(address, netmask, family) { | |||
| 216 | 216 | let groupLength = 8; | |
| 217 | 217 | let hasZeros = false; | |
| 218 | 218 | ||
| 219 | - if (family === 6) { | ||
| 219 | + if (family === 'IPv6') { | ||
| 220 | 220 | split = ':'; | |
| 221 | 221 | range = 16; | |
| 222 | 222 | groupLength = 16; | |
@@ -248,7 +248,7 @@ function getCIDR(address, netmask, family) { | |||
| 248 | 248 | * @returns {Record<string, Array<{ | |
| 249 | 249 | * address: string, | |
| 250 | 250 | * netmask: string, | |
| 251 | - * family: 4 | 6, | ||
| 251 | + * family: 'IPv4' | 'IPv6', | ||
| 252 | 252 | * mac: string, | |
| 253 | 253 | * internal: boolean, | |
| 254 | 254 | * scopeid: number, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -301,6 +301,8 @@ class NoArrayBufferZeroFillScope { | |||
| 301 | 301 | V(input_string, "input") \ | |
| 302 | 302 | V(internal_binding_string, "internalBinding") \ | |
| 303 | 303 | V(internal_string, "internal") \ | |
| 304 | + V(ipv4_string, "IPv4") \ | ||
| 305 | + V(ipv6_string, "IPv6") \ | ||
| 304 | 306 | V(isclosing_string, "isClosing") \ | |
| 305 | 307 | V(issuer_string, "issuer") \ | |
| 306 | 308 | V(issuercert_string, "issuerCertificate") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,8 +174,7 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) { | |||
| 174 | 174 | char ip[INET6_ADDRSTRLEN]; | |
| 175 | 175 | char netmask[INET6_ADDRSTRLEN]; | |
| 176 | 176 | std::array<char, 18> mac; | |
| 177 | - Local<String> name; | ||
| 178 | - Local<Integer> family; | ||
| 177 | + Local<String> name, family; | ||
| 179 | 178 | ||
| 180 | 179 | int err = uv_interface_addresses(&interfaces, &count); | |
| 181 | 180 | ||
@@ -215,14 +214,14 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) { | |||
| 215 | 214 | if (interfaces[i].address.address4.sin_family == AF_INET) { | |
| 216 | 215 | uv_ip4_name(&interfaces[i].address.address4, ip, sizeof(ip)); | |
| 217 | 216 | uv_ip4_name(&interfaces[i].netmask.netmask4, netmask, sizeof(netmask)); | |
| 218 | - family = Integer::New(env->isolate(), 4); | ||
| 217 | + family = env->ipv4_string(); | ||
| 219 | 218 | } else if (interfaces[i].address.address4.sin_family == AF_INET6) { | |
| 220 | 219 | uv_ip6_name(&interfaces[i].address.address6, ip, sizeof(ip)); | |
| 221 | 220 | uv_ip6_name(&interfaces[i].netmask.netmask6, netmask, sizeof(netmask)); | |
| 222 | - family = Integer::New(env->isolate(), 6); | ||
| 221 | + family = env->ipv6_string(); | ||
| 223 | 222 | } else { | |
| 224 | 223 | strncpy(ip, "<unknown sa family>", INET6_ADDRSTRLEN); | |
| 225 | - family = Integer::New(env->isolate(), 0); | ||
| 224 | + family = env->unknown_string(); | ||
| 226 | 225 | } | |
| 227 | 226 | ||
| 228 | 227 | result.emplace_back(name); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments