UNPKG

the-wireguard-effect

Version:

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

62 lines 3.38 kB
/** * Utilities for connecting to the Wireguard demo server at demo.wireguard.com * * @since 1.0.0 */ import type * as Cause from "effect/Cause"; import type * as FileSystem from "effect/FileSystem"; import type * as Path from "effect/Path"; import type * as PlatformError from "effect/PlatformError"; import type * as Scope from "effect/Scope"; import type * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner"; import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; import * as Socket from "effect/unstable/socket/Socket"; import * as SocketServer from "effect/unstable/socket/SocketServer"; import type * as WireguardInternetSchemas from "./InternetSchemas.ts"; import type * as WireguardControl from "./WireguardControl.ts"; import type * as WireguardErrors from "./WireguardErrors.ts"; import * as InternetSchemas from "effect-schemas/Internet"; import * as WireguardConfig from "./WireguardConfig.ts"; import * as WireguardKey from "./WireguardKey.ts"; /** * @since 1.0.0 * @category Schema */ export declare const WireguardDemoServerSchema: Schema.decodeTo<Schema.Struct<{ readonly serverPort: Schema.brand<Schema.Int, "Port">; readonly serverPublicKey: Schema.brand<Schema.String, "WireguardKey">; readonly yourWireguardAddress: Schema.Union<readonly [Schema.decodeTo<Schema.Struct<{ readonly family: Schema.Literal<"ipv4">; readonly ip: Schema.brand<Schema.String, "IPv4">; }>, Schema.String, never, never>, Schema.decodeTo<Schema.Struct<{ readonly family: Schema.Literal<"ipv6">; readonly ip: Schema.brand<Schema.String, "IPv6">; }>, Schema.String, never, never>]>; }>, Schema.TemplateLiteral<readonly [Schema.Literal<"OK">, Schema.Literal<":">, Schema.String, Schema.Literal<":">, Schema.Number, Schema.Literal<":">, Schema.String, Schema.Literal<"\n">]>, never, never>; /** * 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 | Schema.SchemaError, 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: Schema.Schema.Type<typeof WireguardInternetSchemas.Endpoint>; wireguardNetwork: (typeof InternetSchemas.CidrBlockFromString)["Encoded"]; }) => Effect.Effect<void, Socket.SocketError | Schema.SchemaError | Cause.TimeoutError | WireguardErrors.WireguardError | PlatformError.PlatformError | PlatformError.SystemError | PlatformError.BadArgument | SocketServer.SocketServerError, Scope.Scope | FileSystem.FileSystem | Path.Path | SocketServer.SocketServer | WireguardControl.WireguardControl | ChildProcessSpawner.ChildProcessSpawner>; //# sourceMappingURL=WireguardServer.d.ts.map