/**
 * @since 1.0.0
 */
import * as Platform from "@effect/platform";
import * as ParseResult from "@effect/schema/ParseResult";
import * as Schema from "@effect/schema/Schema";
import * as Effect from "effect/Effect";
import * as ReadonlyArray from "effect/ReadonlyArray";
import * as Scope from "effect/Scope";
import * as InternetSchemas from "./InternetSchemas.js";
import * as WireguardError from "./WireguardErrors.js";
import * as WireguardInterface from "./WireguardInterface.js";
import * as WireguardPeer from "./WireguardPeer.js";
declare const WireguardConfig_base: Schema.Class<WireguardConfig, {
    Address: Schema.brand<Schema.transformOrFail<Schema.union<[Schema.struct<{
        ipv4: Schema.brand<Schema.Schema<string, string, never>, "IPv4">;
        mask: Schema.brand<Schema.Schema<number, number, never>, "IPv4CidrMask">;
    }>, Schema.struct<{
        ipv6: Schema.brand<Schema.Schema<string, string, never>, "IPv6">;
        mask: Schema.brand<Schema.Schema<number, number, never>, "IPv6CidrMask">;
    }>, Schema.Schema<`${string}/${number}`, `${string}/${number}`, never>]>, typeof InternetSchemas.CidrBlockInternal, never>, "CidrBlock">;
    /**
     * The value for this is a decimal-string integer corresponding to the
     * listening port of the interface.
     */
    ListenPort: Schema.PropertySignature<":", number & import("effect/Brand").Brand<"Port">, never, "?:", number | null | undefined, never>;
    /**
     * 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.
     */
    FirewallMark: Schema.PropertySignature<"?:", number | undefined, never, "?:", number | undefined, never>;
    /**
     * 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.
     */
    PrivateKey: Schema.brand<Schema.Schema<string, string, never>, "WireguardKey">;
    /** List of peers to add. */
    Peers: Schema.PropertySignature<":", readonly WireguardPeer.WireguardPeer[], never, "?:", readonly {
        readonly Endpoint: {
            readonly ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        } | `${string}:${number}` | `${string}:${number}:${number}` | {
            readonly ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        } | `[${string}]:${number}` | `[${string}]:${number}:${number}`;
        readonly PublicKey: string;
        readonly PersistentKeepaliveInterval?: import("effect/Duration").Duration | null | undefined;
        readonly AllowedIPs?: readonly ({
            readonly ipv4: string;
            readonly mask: number;
        } | {
            readonly ipv6: string;
            readonly mask: number;
        } | `${string}/${number}`)[] | null;
        readonly PresharedKey?: string | null | undefined;
    }[] | null | undefined, never>;
}, {
    readonly Address: InternetSchemas.CidrBlockInternal & import("effect/Brand").Brand<"CidrBlock">;
    readonly ListenPort: number & import("effect/Brand").Brand<"Port">;
    readonly FirewallMark?: number | undefined;
    readonly PrivateKey: string & import("effect/Brand").Brand<"WireguardKey">;
    readonly Peers: readonly WireguardPeer.WireguardPeer[];
}, {
    readonly Address: {
        readonly ipv4: string;
        readonly mask: number;
    } | {
        readonly ipv6: string;
        readonly mask: number;
    } | `${string}/${number}`;
    readonly PrivateKey: string;
    readonly ListenPort?: number | null | undefined;
    readonly FirewallMark?: number | undefined;
    readonly Peers?: readonly {
        readonly Endpoint: {
            readonly ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        } | `${string}:${number}` | `${string}:${number}:${number}` | {
            readonly ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        } | `[${string}]:${number}` | `[${string}]:${number}:${number}`;
        readonly PublicKey: string;
        readonly PersistentKeepaliveInterval?: import("effect/Duration").Duration | null | undefined;
        readonly AllowedIPs?: readonly ({
            readonly ipv4: string;
            readonly mask: number;
        } | {
            readonly ipv6: string;
            readonly mask: number;
        } | `${string}/${number}`)[] | null;
        readonly PresharedKey?: string | null | undefined;
    }[] | null | undefined;
}, never, {
    readonly Address: InternetSchemas.CidrBlockInternal & import("effect/Brand").Brand<"CidrBlock">;
    readonly ListenPort: number & import("effect/Brand").Brand<"Port">;
    readonly FirewallMark?: number | undefined;
    readonly PrivateKey: string & import("effect/Brand").Brand<"WireguardKey">;
    readonly Peers: readonly WireguardPeer.WireguardPeer[];
}, {}, {}>;
/**
 * A wireguard configuration.
 *
 * @since 1.0.0
 * @category Datatypes
 */
export declare class WireguardConfig extends WireguardConfig_base {
    /**
     * Generates two wireguard configurations, each with the other as a single
     * peer and shares their keys appropriately.
     *
     * @param aliceData - The data for the first peer.
     * @param bobData - The data for the second peer.
     *
     * @since 1.0.0
     * @category Constructors
     */
    static generateP2PConfigs: {
        <T extends InternetSchemas.SetupDataEncoded | InternetSchemas.SetupData>(aliceData: T, bobData: T): Effect.Effect<[aliceConfig: WireguardConfig, bobConfig: WireguardConfig], ParseResult.ParseError, never>;
        <T extends InternetSchemas.EndpointEncoded | InternetSchemas.Endpoint>(aliceEndpoint: T, bobEndpoint: T, cidrBlock: InternetSchemas.CidrBlockEncoded): Effect.Effect<[aliceConfig: WireguardConfig, bobConfig: WireguardConfig], ParseResult.ParseError, never>;
    };
    /**
     * Generates a collection of wireguard configurations for a star network
     * with a single central hub node and many peers all connected to it.
     *
     * @param hubData - The data for the hub node.
     * @param spokeData - The data for the spoke nodes.
     *
     * @since 1.0.0
     * @category Constructors
     */
    static generateHubSpokeConfigs: {
        <T extends InternetSchemas.SetupDataEncoded | InternetSchemas.SetupData>(hubData: T, spokeData: ReadonlyArray.NonEmptyReadonlyArray<T>): Effect.Effect<[
            hubConfig: WireguardConfig,
            spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>
        ], ParseResult.ParseError, never>;
        <T extends InternetSchemas.EndpointEncoded | InternetSchemas.Endpoint>(hubData: T, spokeData: ReadonlyArray.NonEmptyReadonlyArray<T>, cidrBlock: InternetSchemas.CidrBlockEncoded): Effect.Effect<[
            hubConfig: WireguardConfig,
            spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>
        ], ParseResult.ParseError, never>;
    };
    /**
     * Loads a wireguard interface configuration from an INI file.
     *
     * @param file - The path to the INI file.
     *
     * @since 1.0.0
     * @category Constructors
     */
    static fromConfigFile: {
        (file: string): Effect.Effect<WireguardConfig, ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem>;
    };
    /**
     * Writes a wireguard interface configuration to an INI file.
     *
     * @param file - The path to the INI file.
     *
     * @since 1.0.0
     * @category Constructors
     */
    writeToFile: {
        (file: string): Effect.Effect<void, ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem | Platform.Path.Path>;
    };
    /**
     * Starts a wireguard tunnel that will continue to run and serve traffic
     * even after the nodejs process exits.
     *
     * @param options - The options for bringing the interface up.
     * @param interfaceObject - The wireguard interface to bring this config up on, it not specified it will use the next available interface on the system according to the required naming conventions.
     *
     * @since 1.0.0
     * @category Wireguard
     */
    up: {
        (options: {
            how?: "bundled-wireguard-go+userspace-api" | "system-wireguard-go+userspace-api" | "system-wireguard+system-wg-quick" | "system-wireguard+bundled-wg-quick" | "system-wireguard-go+system-wg-quick" | "bundled-wireguard-go+system-wg-quick" | "system-wireguard-go+bundled-wg-quick" | "bundled-wireguard-go+bundled-wg-quick" | undefined;
            sudo?: boolean | "ask";
        }, interfaceObject?: WireguardInterface.WireguardInterface | undefined): Effect.Effect<WireguardInterface.WireguardInterface, WireguardError.WireguardError | ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem | Platform.Path.Path>;
    };
    /**
     * Starts a wireguard tunnel that will be gracefully shutdown and stop
     * serving traffic once the scope is closed.
     *
     * @param options - The options for bringing the interface up.
     * @param interfaceObject - The wireguard interface to bring this config up on, if not specified it will use the next available interface on the system according to the required naming conventions.
     *
     * @since 1.0.0
     * @category Wireguard
     */
    upScoped: {
        (options: {
            how?: "bundled-wireguard-go+userspace-api" | "system-wireguard-go+userspace-api" | "system-wireguard+system-wg-quick" | "system-wireguard+bundled-wg-quick" | "system-wireguard-go+system-wg-quick" | "bundled-wireguard-go+system-wg-quick" | "system-wireguard-go+bundled-wg-quick" | "bundled-wireguard-go+bundled-wg-quick" | undefined;
            sudo?: boolean | "ask";
        }, interfaceObject?: WireguardInterface.WireguardInterface | undefined): Effect.Effect<WireguardInterface.WireguardInterface, WireguardError.WireguardError | ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem | Platform.Path.Path | Scope.Scope>;
    };
}
/**
 * A wireguard configuration encoded in the INI format.
 *
 * @see {@link WireguardConfig}
 * @since 1.0.0
 * @category Transformations
 */
export declare const WireguardIniConfig: Schema.brand<Schema.transformOrFail<typeof WireguardConfig, Schema.$string, never>, "WireguardIniConfig">;
/**
 * A wireguard configuration encoded in the userspace api format.
 *
 * @see {@link WireguardConfig}
 * @since 1.0.0
 * @category Transformations
 */
export declare const WireguardUapiConfig: Schema.brand<Schema.transformOrFail<typeof WireguardConfig, Schema.tuple<[Schema.$string, Schema.brand<Schema.transformOrFail<Schema.union<[Schema.struct<{
    ipv4: Schema.brand<Schema.Schema<string, string, never>, "IPv4">;
    mask: Schema.brand<Schema.Schema<number, number, never>, "IPv4CidrMask">;
}>, Schema.struct<{
    ipv6: Schema.brand<Schema.Schema<string, string, never>, "IPv6">;
    mask: Schema.brand<Schema.Schema<number, number, never>, "IPv6CidrMask">;
}>, Schema.Schema<`${string}/${number}`, `${string}/${number}`, never>]>, typeof InternetSchemas.CidrBlockInternal, never>, "CidrBlock">]>, never>, "WireguardUapiConfig">;
export {};
//# sourceMappingURL=WireguardConfig.d.ts.map