/**
 * Wireguard config schema definitions
 *
 * @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 HashMap from "effect/HashMap";
import * as ReadonlyArray from "effect/ReadonlyArray";
import * as Scope from "effect/Scope";
import * as InternetSchemas from "./InternetSchemas.js";
import * as WireguardErrors from "./WireguardErrors.js";
import * as WireguardInterface from "./WireguardInterface.js";
import * as WireguardKey from "./WireguardKey.js";
import * as WireguardPeer from "./WireguardPeer.js";
declare const WireguardConfig_base: Schema.Class<WireguardConfig, {
    Address: InternetSchemas.$CidrBlockFromString;
    /**
     * The value for this is a decimal-string integer corresponding to the
     * listening port of the interface.
     */
    ListenPort: Schema.union<[InternetSchemas.$Port, Schema.transformOrFail<Schema.$string, InternetSchemas.$Port, 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 | null | 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: `${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 ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        };
        readonly PublicKey: string;
        readonly PersistentKeepalive?: number | null | undefined;
        readonly AllowedIPs?: readonly `${string}/${number}`[] | null | undefined;
        readonly PresharedKey?: string | null | undefined;
    }[] | null | undefined, never>;
}, {
    readonly Address: InternetSchemas.CidrBlock;
    readonly ListenPort: InternetSchemas.PortBrand;
    readonly FirewallMark?: number | undefined;
    readonly PrivateKey: string & import("effect/Brand").Brand<"WireguardKey">;
    readonly Peers: readonly WireguardPeer.WireguardPeer[];
}, {
    readonly Address: `${string}/${number}`;
    readonly ListenPort: string | number;
    readonly PrivateKey: string;
    readonly FirewallMark?: number | null | undefined;
    readonly Peers?: readonly {
        readonly Endpoint: `${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 ip: string;
            readonly port: number;
        } | {
            readonly ip: string;
            readonly natPort: number;
            readonly listenPort: number;
        };
        readonly PublicKey: string;
        readonly PersistentKeepalive?: number | null | undefined;
        readonly AllowedIPs?: readonly `${string}/${number}`[] | null | undefined;
        readonly PresharedKey?: string | null | undefined;
    }[] | null | undefined;
}, never, {
    readonly Address: InternetSchemas.CidrBlock;
    readonly ListenPort: InternetSchemas.PortBrand;
    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.
     *
     * @since 1.0.0
     * @category Constructors
     * @param aliceData - The data for the first peer.
     * @param bobData - The data for the second peer.
     */
    static generateP2PConfigs: {
        <AliceData extends InternetSchemas.SetupDataEncoded, BobData extends InternetSchemas.SetupDataEncoded>(options: {
            aliceData: AliceData;
            bobData: BobData;
        }): Effect.Effect<readonly [aliceConfig: WireguardConfig, bobConfig: WireguardConfig], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
        <AliceData extends InternetSchemas.EndpointEncoded, BobData extends InternetSchemas.EndpointEncoded>(options: {
            aliceData: AliceData;
            bobData: BobData;
            cidrBlock: InternetSchemas.CidrBlock;
            addressStartingIndex?: number | undefined;
        }): Effect.Effect<readonly [aliceConfig: WireguardConfig, bobConfig: WireguardConfig], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
    };
    /**
     * Generates two wireguard configurations, each with the other as a single
     * peer and shares their keys appropriately.
     *
     * TODO: update docs
     *
     * @since 1.0.0
     * @category Constructors
     * @param aliceData - The data for the first peer.
     * @param bobData - The data for the second peer.
     */
    static generateStarConfigs: {
        <HubData extends InternetSchemas.SetupDataEncoded, SpokeData extends ReadonlyArray.NonEmptyReadonlyArray<InternetSchemas.SetupDataEncoded>>(options: {
            hubData: HubData;
            spokeData: SpokeData;
        }): Effect.Effect<readonly [hubConfig: WireguardConfig, spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
        <HubData extends InternetSchemas.EndpointEncoded, SpokeData extends ReadonlyArray.NonEmptyReadonlyArray<InternetSchemas.EndpointEncoded>>(options: {
            hubData: HubData;
            spokeData: SpokeData;
            cidrBlock: InternetSchemas.CidrBlock;
            addressStartingIndex?: number | undefined;
        }): Effect.Effect<readonly [hubConfig: WireguardConfig, spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
    };
    /**
     * Generates a collection of wireguard configurations for a star network
     * with a single central hub node and many peers all connected to it.
     *
     * @since 1.0.0
     * @category Constructors
     * @param hubData - The data for the hub node.
     * @param spokeData - The data for the spoke nodes.
     */
    static generateHubSpokeConfigs: {
        <HubData extends InternetSchemas.SetupDataEncoded, SpokeData extends ReadonlyArray.NonEmptyReadonlyArray<InternetSchemas.SetupDataEncoded>, TrustMap extends HashMap.HashMap<keyof SpokeData, ReadonlyArray.NonEmptyReadonlyArray<keyof SpokeData>>, PreshareKeysMap extends HashMap.HashMap<keyof SpokeData | HubData, {
            readonly privateKey: WireguardKey.WireguardKey;
            readonly publicKey: WireguardKey.WireguardKey;
        }>>(options: {
            hubData: HubData;
            spokeData: SpokeData;
            preshareKeys?: PreshareKeysMap | "generate" | undefined;
            trustMap?: TrustMap | "trustAllPeers" | "trustNoPeers" | undefined;
        }): Effect.Effect<readonly [hubConfig: WireguardConfig, spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
        <HubData extends InternetSchemas.EndpointEncoded, SpokeData extends ReadonlyArray.NonEmptyReadonlyArray<InternetSchemas.EndpointEncoded>, TrustMap extends HashMap.HashMap<keyof SpokeData, ReadonlyArray.NonEmptyReadonlyArray<keyof SpokeData>>, PreshareKeysMap extends HashMap.HashMap<keyof SpokeData | HubData, {
            readonly privateKey: WireguardKey.WireguardKey;
            readonly publicKey: WireguardKey.WireguardKey;
        }>>(options: {
            hubData: HubData;
            spokeData: SpokeData;
            cidrBlock: InternetSchemas.CidrBlock;
            addressStartingIndex?: number | undefined;
            preshareKeys?: PreshareKeysMap | "generate" | undefined;
            trustMap?: TrustMap | "trustAllPeers" | "trustNoPeers" | undefined;
        }): Effect.Effect<readonly [hubConfig: WireguardConfig, spokeConfigs: ReadonlyArray.NonEmptyReadonlyArray<WireguardConfig>], ParseResult.ParseError | WireguardErrors.WireguardError, never>;
    };
    /**
     * Loads a wireguard interface configuration from an INI file.
     *
     * @since 1.0.0
     * @category Constructors
     * @param file - The path to the INI file.
     */
    static fromConfigFile: {
        (file: string): Effect.Effect<WireguardConfig, ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem>;
    };
    /**
     * 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<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.
     *
     * @since 1.0.0
     * @category Wireguard
     * @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.
     */
    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, WireguardErrors.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.
     *
     * @since 1.0.0
     * @category Wireguard
     * @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.
     */
    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, WireguardErrors.WireguardError | ParseResult.ParseError | Platform.Error.PlatformError, Platform.FileSystem.FileSystem | Platform.Path.Path | Scope.Scope>;
    };
}
/**
 * A wireguard configuration encoded in the INI format.
 *
 * TODO: Write an api interface type
 *
 * @since 1.0.0
 * @category Transformations
 * @see {@link WireguardConfig}
 */
export declare const WireguardIniConfig: Schema.transformOrFail<typeof WireguardConfig, Schema.$string, never>;
/**
 * A wireguard configuration encoded in the userspace api format.
 *
 * TODO: Write an api interface type
 *
 * @since 1.0.0
 * @category Transformations
 * @see {@link WireguardConfig}
 */
export declare const WireguardUapiConfig: Schema.transformOrFail<typeof WireguardConfig, Schema.tuple<[Schema.$string, InternetSchemas.$CidrBlockFromString]>, never>;
export {};
//# sourceMappingURL=WireguardConfig.d.ts.map