import type * as CommandExecutor from "@effect/platform/CommandExecutor"; import type * as PlatformError from "@effect/platform/Error"; import type * as Socket from "@effect/platform/Socket"; import type * as Cause from "effect/Cause"; import type * as Scope from "effect/Scope"; import * as FileSystem from "@effect/platform/FileSystem"; import * as Path from "@effect/platform/Path"; import * as InternetSchemas from "effect-schemas/Internet"; import * as Effect from "effect/Effect"; import * as ParseResult from "effect/ParseResult"; import * as Schema from "effect/Schema"; import * as Stream from "effect/Stream"; import * as WireguardControl from "../WireguardControl.ts"; import * as WireguardErrors from "../WireguardErrors.ts"; import * as WireguardPeer from "../WireguardPeer.ts"; declare const WireguardConfig_base: import("@effect/experimental/VariantSchema").Class; /** * The value for this is a decimal-string integer corresponding to the * listening port of the interface. */ readonly ListenPort: Schema.Union<[typeof InternetSchemas.Port, Schema.transformOrFail]>; /** * The value for this is a decimal-string integer corresponding to the * fwmark of the interface. The value may 0 in the case of a set operation, * in which case it indicates that the fwmark should be removed. */ readonly FirewallMark: Schema.optionalWith; /** * The value for this key should be a lowercase hex-encoded private key of * the interface. The value may be an all zero string in the case of a set * operation, in which case it indicates that the private key should be * removed. */ readonly PrivateKey: Schema.brand, "WireguardKey">; /** List of peers to add. */ readonly Peers: import("@effect/experimental/VariantSchema").Field<{ readonly json: Schema.optionalWith, { default: () => never[]; nullable: true; }>; readonly uapi: Schema.optionalWith; readonly AllowedIPs: Schema.optionalWith, { nullable: true; default: () => Set; }>; readonly Endpoint: Schema.optionalWith; readonly PublicKey: Schema.brand, "WireguardKey">; readonly PresharedKey: Schema.optionalWith, "WireguardKey">, { nullable: true; as: "Option"; }>; readonly rxBytes: typeof Schema.NumberFromString; readonly txBytes: typeof Schema.NumberFromString; readonly lastHandshake: Schema.transform>, typeof Schema.DateTimeUtcFromNumber>; }>>, { default: () => never[]; nullable: true; }>; }>; }, import("@effect/experimental/VariantSchema").ExtractFields<"json", { /** The Address of this peer. */ readonly Address: typeof InternetSchemas.CidrBlockFromString; /** DNS for this peer. */ readonly Dns: Schema.optional; /** * The value for this is a decimal-string integer corresponding to the * listening port of the interface. */ readonly ListenPort: Schema.Union<[typeof InternetSchemas.Port, Schema.transformOrFail]>; /** * The value for this is a decimal-string integer corresponding to the * fwmark of the interface. The value may 0 in the case of a set operation, * in which case it indicates that the fwmark should be removed. */ readonly FirewallMark: Schema.optionalWith; /** * The value for this key should be a lowercase hex-encoded private key of * the interface. The value may be an all zero string in the case of a set * operation, in which case it indicates that the private key should be * removed. */ readonly PrivateKey: Schema.brand, "WireguardKey">; /** List of peers to add. */ readonly Peers: import("@effect/experimental/VariantSchema").Field<{ readonly json: Schema.optionalWith, { default: () => never[]; nullable: true; }>; readonly uapi: Schema.optionalWith; readonly AllowedIPs: Schema.optionalWith, { nullable: true; default: () => Set; }>; readonly Endpoint: Schema.optionalWith; readonly PublicKey: Schema.brand, "WireguardKey">; readonly PresharedKey: Schema.optionalWith, "WireguardKey">, { nullable: true; as: "Option"; }>; readonly rxBytes: typeof Schema.NumberFromString; readonly txBytes: typeof Schema.NumberFromString; readonly lastHandshake: Schema.transform>, typeof Schema.DateTimeUtcFromNumber>; }>>, { default: () => never[]; nullable: true; }>; }>; }, true>, { readonly Dns?: { readonly ip: string & import("effect/Brand").Brand<"IPv4">; readonly family: "ipv4"; } | { readonly ip: string & import("effect/Brand").Brand<"IPv6">; readonly family: "ipv6"; } | undefined; } & { readonly ListenPort: number & import("effect/Brand").Brand<"Port">; } & { readonly Peers: readonly WireguardPeer.WireguardPeer[]; } & { readonly Address: InternetSchemas.IPv4CidrBlock | InternetSchemas.IPv6CidrBlock; } & { readonly FirewallMark?: number | undefined; } & { readonly PrivateKey: string & import("effect/Brand").Brand<"WireguardKey">; }, Schema.Struct.Encoded; /** * The value for this is a decimal-string integer corresponding to the * listening port of the interface. */ readonly ListenPort: Schema.Union<[typeof InternetSchemas.Port, Schema.transformOrFail]>; /** * The value for this is a decimal-string integer corresponding to the * fwmark of the interface. The value may 0 in the case of a set operation, * in which case it indicates that the fwmark should be removed. */ readonly FirewallMark: Schema.optionalWith; /** * The value for this key should be a lowercase hex-encoded private key of * the interface. The value may be an all zero string in the case of a set * operation, in which case it indicates that the private key should be * removed. */ readonly PrivateKey: Schema.brand, "WireguardKey">; /** List of peers to add. */ readonly Peers: import("@effect/experimental/VariantSchema").Field<{ readonly json: Schema.optionalWith, { default: () => never[]; nullable: true; }>; readonly uapi: Schema.optionalWith; readonly AllowedIPs: Schema.optionalWith, { nullable: true; default: () => Set; }>; readonly Endpoint: Schema.optionalWith; readonly PublicKey: Schema.brand, "WireguardKey">; readonly PresharedKey: Schema.optionalWith, "WireguardKey">, { nullable: true; as: "Option"; }>; readonly rxBytes: typeof Schema.NumberFromString; readonly txBytes: typeof Schema.NumberFromString; readonly lastHandshake: Schema.transform>, typeof Schema.DateTimeUtcFromNumber>; }>>, { default: () => never[]; nullable: true; }>; }>; }, true>>, never, { readonly Dns?: { readonly ip: string & import("effect/Brand").Brand<"IPv4">; readonly family: "ipv4"; } | { readonly ip: string & import("effect/Brand").Brand<"IPv6">; readonly family: "ipv6"; } | undefined; } & { readonly ListenPort: number & import("effect/Brand").Brand<"Port">; } & { readonly Peers?: readonly WireguardPeer.WireguardPeer[]; } & { readonly Address: InternetSchemas.IPv4CidrBlock | InternetSchemas.IPv6CidrBlock; } & { readonly FirewallMark?: number | undefined; } & { readonly PrivateKey: string & import("effect/Brand").Brand<"WireguardKey">; }> & { readonly json: Schema.Struct<{ readonly Address: typeof InternetSchemas.CidrBlockFromString; readonly Dns: Schema.optional; readonly ListenPort: Schema.Union<[typeof InternetSchemas.Port, Schema.transformOrFail]>; readonly FirewallMark: Schema.optionalWith; readonly PrivateKey: Schema.brand, "WireguardKey">; readonly Peers: Schema.optionalWith, { default: () => never[]; nullable: true; }>; }>; readonly uapi: Schema.Struct<{ readonly Address: typeof InternetSchemas.CidrBlockFromString; readonly Dns: Schema.optional; readonly ListenPort: Schema.Union<[typeof InternetSchemas.Port, Schema.transformOrFail]>; readonly FirewallMark: Schema.optionalWith; readonly PrivateKey: Schema.brand, "WireguardKey">; readonly Peers: Schema.optionalWith; readonly AllowedIPs: Schema.optionalWith, { nullable: true; default: () => Set; }>; readonly Endpoint: Schema.optionalWith; readonly PublicKey: Schema.brand, "WireguardKey">; readonly PresharedKey: Schema.optionalWith, "WireguardKey">, { nullable: true; as: "Option"; }>; readonly rxBytes: typeof Schema.NumberFromString; readonly txBytes: typeof Schema.NumberFromString; readonly lastHandshake: Schema.transform>, typeof Schema.DateTimeUtcFromNumber>; }>>, { default: () => never[]; nullable: true; }>; }>; }; export declare class WireguardConfig extends WireguardConfig_base { /** * Writes a wireguard interface configuration to an INI file. * * @since 1.0.0 * @category Constructors * @param file - The path to the INI file. */ writeToFile: { (file: string): Effect.Effect; }; /** * Starts a wireguard tunnel that will continue to run and serve traffic * even after the nodejs process exits. * * @since 1.0.0 * @category Wireguard */ up: { (wireguardInterface?: WireguardInterface | undefined): Effect.Effect; }; /** * Starts a wireguard tunnel that will be gracefully shutdown and stop * serving traffic once the scope is closed. * * @since 1.0.0 * @category Wireguard */ upScoped: { (wireguardInterface?: WireguardInterface | undefined): Effect.Effect; }; } declare const WireguardIniConfig_base: Schema.transformOrFail; export declare class WireguardIniConfig extends WireguardIniConfig_base { } declare const WireguardInterface_base: Schema.Class; }, Schema.Struct.Encoded<{ /** * Ensures the interface name matches the platform's interface name regex. * These functions need to be fully typed as we are accessing a static * method on this same class and otherwise typescript really complains about * inference. */ Name: Schema.transformOrFail; }>, never, { readonly Name: string; }, {}, {}>; /** * A wireguard interface name. * * @since 1.0.0 * @category Datatypes */ export declare class WireguardInterface extends WireguardInterface_base { /** * @since 1.0.0 * @category Constructors */ static getNextAvailableInterface: Effect.Effect; static InterfaceRegExpForPlatform: Effect.Effect; /** * @since 1.0.0 * @category Userspace api */ readonly SocketLocation: string; /** * Starts a wireguard tunnel that will be gracefully shutdown and stop * serving traffic once the scope is closed. * * @since 1.0.0 * @category Wireguard control */ upScoped: { (config: WireguardConfig): Effect.Effect; }; /** * Starts a wireguard tunnel that will continue to run and serve traffic * even after the nodejs process exits. * * @since 1.0.0 * @category Wireguard control */ up: { (config: WireguardConfig): Effect.Effect; }; /** * Stops a previously started wireguard tunnel. * * @since 1.0.0 * @category Wireguard control */ down: { (config: WireguardConfig): Effect.Effect; }; /** * Sets the config for this wireguard interface. * * @since 1.0.0 * @category Wireguard control */ setConfig: { (wireguardConfig: WireguardConfig): Effect.Effect; }; /** * Retrieves the config from this wireguard interface. * * @since 1.0.0 */ getConfig: { (address: Schema.Schema.Encoded): Effect.Effect, Socket.SocketError | ParseResult.ParseError, never>; }; /** * Adds a peer to this interface. * * @since 1.0.0 * @category Wireguard control */ addPeer: { (peer: WireguardPeer.WireguardPeer): Effect.Effect; }; /** * Removes a peer from this interface. * * @since 1.0.0 * @category Wireguard control */ removePeer: { (peer: WireguardPeer.WireguardPeer): Effect.Effect; }; /** * Streams the stats from all the peers on this interface. * * @since 1.0.0 * @category Wireguard control */ streamPeerStats: { (): Stream.Stream>, Socket.SocketError | ParseResult.ParseError, never>; }; } export {}; //# sourceMappingURL=circular.d.ts.map