import type * as Cause from "effect/Cause"; import type * as PlatformError from "effect/PlatformError"; import type * as Scope from "effect/Scope"; import type * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner"; import type * as Socket from "effect/unstable/socket/Socket"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Path from "effect/Path"; import * as Result from "effect/Result"; import * as Schema from "effect/Schema"; import * as Stream from "effect/Stream"; import * as InternetSchemas from "effect-schemas/Internet"; import * as WireguardControl from "../WireguardControl.ts"; import * as WireguardErrors from "../WireguardErrors.ts"; import * as WireguardPeer from "../WireguardPeer.ts"; declare const WireguardConfig_base: import("effect/unstable/schema/VariantSchema").Class, Schema.TemplateLiteral, never, never>; /** DNS for this peer. */ readonly Dns: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>]>>; /** * The value for this is a decimal-string integer corresponding to the * listening port of the interface. */ readonly ListenPort: Schema.Union, Schema.compose, Schema.FiniteFromString>]>; /** * 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.optional>; /** * 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; /** List of peers to add. */ readonly Peers: import("effect/unstable/schema/VariantSchema").Field<{ readonly json: Schema.withDecodingDefault, never>; readonly uapi: Schema.withDecodingDefault>; readonly AllowedIPs: Schema.withDecodingDefault, Schema.TemplateLiteral, never, never>>, never>; readonly Endpoint: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv4">; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv6">; }>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite]>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly listenPort: Schema.brand; }>, Schema.Union, Schema.Struct<{ readonly host: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>]>>>; readonly PublicKey: Schema.brand; readonly PresharedKey: Schema.OptionFromOptionalNullOr>; readonly rxBytes: Schema.FiniteFromString; readonly txBytes: Schema.FiniteFromString; readonly lastHandshake: Schema.compose, Schema.FiniteFromString, never, never>>; }>>, never>; }>; }, Schema.Struct, Schema.TemplateLiteral, never, never>; /** DNS for this peer. */ readonly Dns: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>]>>; /** * The value for this is a decimal-string integer corresponding to the * listening port of the interface. */ readonly ListenPort: Schema.Union, Schema.compose, Schema.FiniteFromString>]>; /** * 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.optional>; /** * 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; /** List of peers to add. */ readonly Peers: import("effect/unstable/schema/VariantSchema").Field<{ readonly json: Schema.withDecodingDefault, never>; readonly uapi: Schema.withDecodingDefault>; readonly AllowedIPs: Schema.withDecodingDefault, Schema.TemplateLiteral, never, never>>, never>; readonly Endpoint: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv4">; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv6">; }>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite]>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly listenPort: Schema.brand; }>, Schema.Union, Schema.Struct<{ readonly host: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>]>>>; readonly PublicKey: Schema.brand; readonly PresharedKey: Schema.OptionFromOptionalNullOr>; readonly rxBytes: Schema.FiniteFromString; readonly txBytes: Schema.FiniteFromString; readonly lastHandshake: Schema.compose, Schema.FiniteFromString, never, never>>; }>>, never>; }>; }, true>>> & { readonly json: Schema.Struct<{ readonly Address: Schema.decodeTo, Schema.TemplateLiteral, never, never>; readonly Dns: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>]>>; readonly ListenPort: Schema.Union, Schema.compose, Schema.FiniteFromString>]>; readonly FirewallMark: Schema.optional>; readonly PrivateKey: Schema.brand; readonly Peers: Schema.withDecodingDefault, never>; }>; readonly uapi: Schema.Struct<{ readonly Address: Schema.decodeTo, Schema.TemplateLiteral, never, never>; readonly Dns: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>]>>; readonly ListenPort: Schema.Union, Schema.compose, Schema.FiniteFromString>]>; readonly FirewallMark: Schema.optional>; readonly PrivateKey: Schema.brand; readonly Peers: Schema.withDecodingDefault>; readonly AllowedIPs: Schema.withDecodingDefault, Schema.TemplateLiteral, never, never>>, never>; readonly Endpoint: Schema.optional; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv4">; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly ip: Schema.brand; }>, Schema.String, never, never>; readonly natPort: Schema.brand; readonly listenPort: Schema.brand; }>, Schema.Union; }>, Schema.Struct<{ readonly ip: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; readonly family: Schema.Literal<"ipv6">; }>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite]>, Schema.TemplateLiteral, Schema.String, Schema.Literal<"]">, Schema.Literal<":">, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>, Schema.decodeTo; readonly listenPort: Schema.brand; }>, Schema.Union, Schema.Struct<{ readonly host: Schema.String; readonly natPort: Schema.Finite; readonly listenPort: Schema.Finite; }>, Schema.TemplateLiteral, Schema.Finite]>, Schema.TemplateLiteral, Schema.Finite, Schema.Literal<":">, Schema.Finite]>]>, never, never>]>>>; readonly PublicKey: Schema.brand; readonly PresharedKey: Schema.OptionFromOptionalNullOr>; readonly rxBytes: Schema.FiniteFromString; readonly txBytes: Schema.FiniteFromString; readonly lastHandshake: Schema.compose, Schema.FiniteFromString, never, never>>; }>>, never>; }>; }; 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): 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): Effect.Effect; }; } export declare const WireguardIniConfig: Schema.decodeTo; declare const WireguardInterface_base: Schema.Class, {}>; /** * A wireguard interface name. * * @since 1.0.0 * @category Datatypes */ export declare class WireguardInterface extends WireguardInterface_base { /** * @since 1.0.0 * @category Constructors */ static readonly getNextAvailableInterface: Effect.Effect; /** * @since 1.0.0 * @category Static members */ static readonly InterfaceRegExpForPlatform: Result.Result; /** * @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: (typeof InternetSchemas.CidrBlockFromString)["Encoded"]): Effect.Effect, Socket.SocketError | Schema.SchemaError, 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 | Schema.SchemaError, never>; }; } export {}; //# sourceMappingURL=circular.d.ts.map