UNPKG

the-wireguard-effect

Version:

Cross platform wireguard api client for nodejs built on wireguard-go with effect-ts

67 lines 3.06 kB
/** * Utilities for connecting to the Wireguard demo server at demo.wireguard.com * * @since 1.0.0 */ import type * as CommandExecutor from "@effect/platform/CommandExecutor"; import type * as PlatformError from "@effect/platform/Error"; import type * as FileSystem from "@effect/platform/FileSystem"; import type * as Path from "@effect/platform/Path"; import type * as Cause from "effect/Cause"; import type * as ParseResult from "effect/ParseResult"; import type * as Scope from "effect/Scope"; import type * as WireguardControl from "./WireguardControl.js"; import type * as WireguardErrors from "./WireguardErrors.js"; import * as Socket from "@effect/platform/Socket"; import * as SocketServer from "@effect/platform/SocketServer"; import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; import * as InternetSchemas from "./InternetSchemas.js"; import * as WireguardConfig from "./WireguardConfig.js"; import * as WireguardKey from "./WireguardKey.js"; /** * @since 1.0.0 * @category Unbranded types */ export type WireguardDemoServerSchema = Schema.Schema.Type<typeof WireguardDemoServerSchema>; /** * @since 1.0.0 * @category Encoded types */ export type WireguardDemoServerSchemaEncoded = Schema.Schema.Encoded<typeof WireguardDemoServerSchema>; /** * @since 1.0.0 * @category Schema */ export declare const WireguardDemoServerSchema: Schema.transform<Schema.TemplateLiteral<`OK:${string}:${number}:${string} `>, Schema.Struct<{ serverPort: InternetSchemas.$Port; serverPublicKey: Schema.brand<Schema.refine<string, typeof Schema.String>, "WireguardKey">; yourWireguardAddress: InternetSchemas.$Address; }>>; /** * Creates a Wireguard configuration to connect to demo.wireguard.com. When * connected, you should be able to see the hidden page at 192.168.4.1 * * @since 1.0.0 * @see https://git.zx2c4.com/wireguard-tools/plain/contrib/ncat-client-server/client.sh */ export declare const requestWireguardDemoConfig: (connectOptions?: { port: number; host: string; }, { privateKey, publicKey }?: { readonly privateKey: WireguardKey.WireguardKey; readonly publicKey: WireguardKey.WireguardKey; }) => Effect.Effect<WireguardConfig.WireguardConfig, Socket.SocketError | ParseResult.ParseError, never>; /** * Mock implementation of the Wireguard demo server at demo.wireguard.com * * @since 1.0.0 * @see https://git.zx2c4.com/wireguard-tools/plain/contrib/ncat-client-server/server.sh */ export declare const WireguardDemoServer: (options: { maxPeers?: number | undefined; serverEndpoint: InternetSchemas.Endpoint; wireguardNetwork: InternetSchemas.CidrBlockFromStringEncoded; }) => Effect.Effect<void, Socket.SocketError | ParseResult.ParseError | Cause.TimeoutException | WireguardErrors.WireguardError | PlatformError.PlatformError | SocketServer.SocketServerError, Scope.Scope | FileSystem.FileSystem | Path.Path | SocketServer.SocketServer | WireguardControl.WireguardControl | CommandExecutor.CommandExecutor>; //# sourceMappingURL=WireguardServer.d.ts.map