-
Notifications
You must be signed in to change notification settings - Fork 3.5k
node:net rework #18962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
node:net rework #18962
Changes from all commits
Commits
Show all changes
131 commits
Select commit
Hold shift + click to select a range
cf2cb63
some node:net progress
nektro 294c3fa
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 47415dc
more fixes
nektro e97be5e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 5193024
end
nektro 591248c
more fixes
nektro ef3a61e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro b56edc7
merge fixes
nektro 45e0e1b
remove lots of logs
nektro 30b5cbd
tidy
nektro 6926eea
add back a few logs as $debug
nektro 8ca9a6d
`bun run clang-format`
nektro 761f981
tidy
nektro 7e64b50
add back a couple logs
nektro fb7c418
fix
nektro a7daebd
bring back tls handling
nektro f899805
more passing tls tests
nektro 0836a30
more regression fix
nektro 0b06159
this can return null when connecting on port 0
nektro 61745b1
more
nektro 579e48c
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 7945339
revert that for now
nektro 5cffa7b
ci: disable some of the matrix while some tests are failing
nektro 8d7224a
types: allowHalfOpen is allowed on both tcp and unix sockets
nektro 28174dc
types fixes
nektro b99e5db
bring back some of the short circuiting logic for tls
nektro 0da9a7c
pull new SocketHandlers out into variable
nektro 8284a91
regression fixes
nektro fa85b64
try this too
nektro b760fbd
reduce import cost of node:net and node:events
nektro 81c2d38
oops
nektro 80dfd71
this was not actually fixed yet, come back to it
nektro 95a3a5e
more nets got fixed
nektro e2fff4a
fix typo from b760fbd54
nektro ac7ac89
do this later
nektro b5019a6
writables dont always have a readable state
nektro 418b22b
do that in a non- breaking change way
nektro 0193fff
include whether the socket is a client or server in these logs
nektro 6087a1b
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 2d7a651
merge fix
nektro b1aadeb
fix ban-words.test.ts
nektro e4e2700
fix bun-types.test.ts
nektro 36c6f26
'| undefined' on optional fields is redundant
nektro 3ba34ea
document socket.upgradeTLS
nektro 351c87e
regression fixes
nektro 1fe8f6a
add back some more test targets
nektro 18eee12
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 5ed4e9e
`bun run clang-format`
nektro b2f9cf5
x64 macos takes too long
nektro 9443527
tidy
nektro 087b584
asserting this turned out to be wrong
nektro 83bcac8
getting closer, add more test targets
nektro ab1b211
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro f650ba0
fixes
nektro 262e257
more http2 pass
nektro 46742d6
dont mess with the number of args
nektro 0b3ad0c
more
nektro 7695e83
tidy
nektro a91c815
fix
nektro 0983950
fixes
nektro c5bba60
remove test-net-connect-reset-after-destroy.js for now
nektro 08cec41
remove test-net-socket-reset-send.js for now
nektro 8f3d737
remove test-tls-connect-abort-controller.js for now
nektro fb03052
ci: add back flaky test retry
nektro aa34062
this change was bad
nektro 3f8ef98
this needed just a lil more time
nektro d40e825
better assertion here
nektro be3219e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 82af73a
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro 5e3f335
fix net-buffersize timeout and others
nektro 0217823
fix test-http-keep-alive-drop-requests.js regression
nektro 794737b
ci: turn the rest back on
nektro 321947f
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro ceafd58
this isnt passing on main either
nektro f45c6c6
we report openssl v1 but hit the error in the comment for openssl v3
nektro 3d8e900
fix test-http2-trailers-after-session-close.js regression
nektro 4594684
tidy some logs
nektro 89cc382
new and not passing, investigate later
nektro 14beca8
add server/client differentiation to the socket logs
nektro 15d2e31
fix test-tls-inception
nektro 9d131ff
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro b0bebf8
revert this message change
nektro 23d32a5
unregress ENOENT connect failure message
nektro be3f96f
sync kConnectPipe promise handling with kConnectTcp
nektro 2edd2aa
unregress another test in node-net.test.ts
nektro e759354
sync arg handling here
nektro 9b24e25
unregress next dev-server.test.ts
nektro 25e9fb9
add more expectations here
nektro b0b606a
ci: redisable x64-darwin until its green
nektro fbddcdd
fix windows build
nektro 2dc227d
come back to this
nektro ff31948
just to be sure
nektro 91b7026
those iterations dont work in node either
nektro df42b45
another windows fix
nektro 910e9b2
`bun run prettier`
nektro 5ce7088
another windows fix smh
nektro dab5c1e
come back to this one
nektro 2a5eb5c
the errnos here are actuall always positive
nektro f5667ed
these need more time to pass in debug mode
nektro fe1bda5
Merge branch 'main' into nektro-patch-40023
nektro 41e3d09
address some review
nektro e0630dc
ci: disable auto retry from timeout
nektro fbb0c4a
address more review
nektro 9dbe028
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro c9d3069
ci: disable more auto retry
nektro 91f18c9
investigate macos http2 fails
nektro 3ef7b46
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro b60f6d6
surely this time'll work
nektro 9e07091
long running test, add logs in debug mode
nektro 08200c7
test wasnt working before, false positive
nektro e035f9b
tidy
nektro 4668d66
edits
nektro ecacf4a
fixes from time on windows
nektro a3b95c6
see if this fixes http2 timeout issues on mac
nektro edbc80d
align the style of the comment with the others
nektro 307f81b
better return type for try_parse_ip
nektro 7c2a4c2
align param name here with others
nektro 0541af5
fix http2 yay
nektro 081fa6c
tidying
nektro 02e9f06
`bun run prettier`
nektro 9e2b893
come back to these
nektro 46f2055
fix node-tls-namedpipes.test.ts
nektro 595dd4f
address review
nektro c92af17
address review
nektro 3fac122
fix skipped test
nektro d733c2c
oops git too close to the sun
nektro f774a1e
Merge branch 'main' into nektro-patch-40023
nektro 12d20e7
undo modifications to test-tls-inception
nektro 73dd2c3
fix lint
nektro 2db9101
:facepalm:
nektro 6a07f7e
address review
nektro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3662,7 +3662,7 @@ declare module "bun" { | |
| * the well-known CAs curated by Mozilla. Mozilla's CAs are completely | ||
| * replaced when CAs are explicitly specified using this option. | ||
| */ | ||
| ca?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined; | ||
| ca?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined; | ||
| /** | ||
| * Cert chains in PEM format. One cert chain should be provided per | ||
| * private key. Each cert chain should consist of the PEM formatted | ||
|
|
@@ -3674,7 +3674,7 @@ declare module "bun" { | |
| * intermediate certificates are not provided, the peer will not be | ||
| * able to validate the certificate, and the handshake will fail. | ||
| */ | ||
| cert?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined; | ||
| cert?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined; | ||
| /** | ||
| * Private keys in PEM format. PEM allows the option of private keys | ||
| * being encrypted. Encrypted keys will be decrypted with | ||
|
|
@@ -3685,13 +3685,25 @@ declare module "bun" { | |
| * object.passphrase is optional. Encrypted keys will be decrypted with | ||
| * object.passphrase if provided, or options.passphrase if it is not. | ||
| */ | ||
| key?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined; | ||
| key?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined; | ||
| /** | ||
| * Optionally affect the OpenSSL protocol behavior, which is not | ||
| * usually necessary. This should be used carefully if at all! Value is | ||
| * a numeric bitmask of the SSL_OP_* options from OpenSSL Options | ||
| */ | ||
| secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options | ||
|
|
||
| keyFile?: string; | ||
|
|
||
| certFile?: string; | ||
|
|
||
| ALPNProtocols?: string | BufferSource; | ||
|
|
||
| ciphers?: string; | ||
|
|
||
| clientRenegotiationLimit?: number; | ||
|
|
||
| clientRenegotiationWindow?: number; | ||
| } | ||
|
|
||
| // Note for contributors: TLSOptionsAsDeprecated should be considered immutable | ||
|
|
@@ -6060,7 +6072,7 @@ declare module "bun" { | |
| * certificate. | ||
| * @return A certificate object. | ||
| */ | ||
| getPeerCertificate(): import("tls").PeerCertificate; | ||
| getPeerCertificate(): import("node:tls").PeerCertificate; | ||
| getPeerX509Certificate(): import("node:crypto").X509Certificate; | ||
|
|
||
| /** | ||
|
|
@@ -6165,6 +6177,34 @@ declare module "bun" { | |
| * The number of bytes written to the socket. | ||
| */ | ||
| readonly bytesWritten: number; | ||
|
|
||
| resume(): void; | ||
|
|
||
| pause(): void; | ||
|
|
||
| renegotiate(): void; | ||
|
|
||
| setVerifyMode(requestCert: boolean, rejectUnauthorized: boolean): void; | ||
|
|
||
| getSession(): void; | ||
|
|
||
| setSession(session: string | Buffer | BufferSource): void; | ||
|
|
||
| exportKeyingMaterial(length: number, label: string, context?: string | BufferSource): void; | ||
|
|
||
| upgradeTLS<Data>(options: TLSUpgradeOptions<Data>): [raw: Socket<Data>, tls: Socket<Data>]; | ||
|
|
||
| close(): void; | ||
|
|
||
| getServername(): string; | ||
|
|
||
| setServername(name: string): void; | ||
| } | ||
|
|
||
| interface TLSUpgradeOptions<Data> { | ||
| data?: Data; | ||
| tls: TLSOptions | boolean; | ||
| socket: SocketHandler<Data>; | ||
| } | ||
|
|
||
| interface SocketListener<Data = undefined> extends Disposable { | ||
|
|
@@ -6265,6 +6305,22 @@ declare module "bun" { | |
| * The per-instance data context | ||
| */ | ||
| data?: Data; | ||
| /** | ||
| * Whether to allow half-open connections. | ||
| * | ||
| * A half-open connection occurs when one end of the connection has called `close()` | ||
| * or sent a FIN packet, while the other end remains open. When set to `true`: | ||
| * | ||
| * - The socket won't automatically send FIN when the remote side closes its end | ||
| * - The local side can continue sending data even after the remote side has closed | ||
| * - The application must explicitly call `end()` to fully close the connection | ||
| * | ||
| * When `false`, the socket automatically closes both ends of the connection when | ||
| * either side closes. | ||
| * | ||
| * @default false | ||
| */ | ||
| allowHalfOpen?: boolean; | ||
| } | ||
|
|
||
| interface TCPSocketListenOptions<Data = undefined> extends SocketOptions<Data> { | ||
|
|
@@ -6279,7 +6335,7 @@ declare module "bun" { | |
| /** | ||
| * The TLS configuration object with which to create the server | ||
| */ | ||
| tls?: TLSOptions; | ||
| tls?: TLSOptions | boolean; | ||
| /** | ||
| * Whether to use exclusive mode. | ||
| * | ||
|
|
@@ -6325,7 +6381,7 @@ declare module "bun" { | |
| /** | ||
| * TLS Configuration with which to create the socket | ||
| */ | ||
| tls?: boolean; | ||
| tls?: TLSOptions | boolean; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add to JSDoc why |
||
| /** | ||
| * Whether to use exclusive mode. | ||
| * | ||
|
|
@@ -6341,22 +6397,8 @@ declare module "bun" { | |
| * @default false | ||
| */ | ||
| exclusive?: boolean; | ||
| /** | ||
| * Whether to allow half-open connections. | ||
| * | ||
| * A half-open connection occurs when one end of the connection has called `close()` | ||
| * or sent a FIN packet, while the other end remains open. When set to `true`: | ||
| * | ||
| * - The socket won't automatically send FIN when the remote side closes its end | ||
| * - The local side can continue sending data even after the remote side has closed | ||
| * - The application must explicitly call `end()` to fully close the connection | ||
| * | ||
| * When `false` (default), the socket automatically closes both ends of the connection | ||
| * when either side closes. | ||
| * | ||
| * @default false | ||
| */ | ||
| allowHalfOpen?: boolean; | ||
| reusePort?: boolean; | ||
| ipv6Only?: boolean; | ||
| } | ||
|
|
||
| interface UnixSocketOptions<Data = undefined> extends SocketOptions<Data> { | ||
|
|
@@ -6367,14 +6409,14 @@ declare module "bun" { | |
| /** | ||
| * TLS Configuration with which to create the socket | ||
| */ | ||
| tls?: TLSOptions; | ||
| tls?: TLSOptions | boolean; | ||
| } | ||
|
|
||
| interface FdSocketOptions<Data = undefined> extends SocketOptions<Data> { | ||
| /** | ||
| * TLS Configuration with which to create the socket | ||
| */ | ||
| tls?: TLSOptions; | ||
| tls?: TLSOptions | boolean; | ||
| /** | ||
| * The file descriptor to connect to | ||
| */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to JSDoc why
booleanis supported here/highlight the difference between the object or just a boolean