File
Blob: src/cloudflare/sockets.ts
| 1 | // Copyright (c) 2023 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | // TODO: c++ built-ins do not yet support named exports |
| 6 | |
| 7 | import sockets from 'cloudflare-internal:sockets'; |
| 8 | import { type ServiceStub } from 'cloudflare-internal:workers'; |
| 9 | |
| 10 | export function connect( |
| 11 | address: string | sockets.SocketAddress, |
| 12 | options: sockets.SocketOptions |
| 13 | ): sockets.Socket { |
| 14 | return sockets.connect(address, options); |
| 15 | } |
| 16 | |
| 17 | export function internalNewHttpClient( |
| 18 | socket: sockets.Socket |
| 19 | ): Promise<ServiceStub> { |
| 20 | return sockets.internalNewHttpClient(socket); |
| 21 | } |