Skip to content
File

Blob: src/cloudflare/sockets.ts

typescript22 lines
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 
7import sockets from 'cloudflare-internal:sockets';
8import { type ServiceStub } from 'cloudflare-internal:workers';
9 
10export function connect(
11 address: string | sockets.SocketAddress,
12 options: sockets.SocketOptions
13): sockets.Socket {
14 return sockets.connect(address, options);
15}
16 
17export function internalNewHttpClient(
18 socket: sockets.Socket
19): Promise<ServiceStub> {
20 return sockets.internalNewHttpClient(socket);
21}