/**
 * Internet schemas for wireguard configuration.
 *
 * @since 1.0.0
 */
import * as ParseResult from "@effect/schema/ParseResult";
import * as Schema from "@effect/schema/Schema";
import * as Brand from "effect/Brand";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
/**
 * @since 1.0.0
 * @category Branded types
 */
export type DurationFromSecondsBrand = Duration.Duration & Brand.Brand<"DurationFromSeconds">;
/**
 * @since 1.0.0
 * @category Branded constructors
 */
export declare const DurationFromSecondsBrand: Brand.Brand.Constructor<DurationFromSecondsBrand>;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $DurationFromSeconds extends Schema.Annotable<$DurationFromSeconds, DurationFromSecondsBrand, number, never> {
}
/**
 * A schema that transforms a `number` tuple into a `Duration`. Treats the value
 * as the number of seconds.
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare const DurationFromSeconds: $DurationFromSeconds;
/**
 * @since 1.0.0
 * @category Branded types
 */
export type PortBrand = number & Brand.Brand<"Port">;
/**
 * @since 1.0.0
 * @category Branded constructors
 */
export declare const PortBrand: Brand.Brand.Constructor<PortBrand>;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $Port extends Schema.Annotable<$Port, PortBrand, Brand.Brand.Unbranded<PortBrand>, never> {
}
/**
 * An operating system port number.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { Port } from "the-wireguard-effect/InternetSchemas";
 *
 *     const port: Port = Port(8080);
 *     assert.strictEqual(port, 8080);
 *
 *     const decodePort = Schema.decodeSync(Port);
 *     assert.strictEqual(decodePort(8080), 8080);
 *
 *     assert.throws(() => decodePort(65536));
 *     assert.doesNotThrow(() => decodePort(8080));
 */
export declare const Port: $Port;
declare const IPv4_base: Schema.Class<IPv4, {
    ip: Schema.Schema<string, string, never>;
}, {
    readonly ip: string;
}, {
    readonly ip: string;
}, never, {
    readonly ip: string;
}, {}, {}>;
/**
 * An IPv4 address.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { IPv4 } from "the-wireguard-effect/InternetSchemas";
 *
 *     const ipv4: IPv4 = IPv4("1.1.1.1");
 *     assert.strictEqual(ipv4, "1.1.1.1");
 *
 *     const decodeIPv4 = Schema.decodeSync(IPv4);
 *     assert.strictEqual(decodeIPv4("1.1.1.1"), "1.1.1.1");
 *
 *     assert.throws(() => decodeIPv4("1.1.a.1"));
 *     assert.doesNotThrow(() => decodeIPv4("1.1.1.1"));
 */
export declare class IPv4 extends IPv4_base {
    /** @since 1.0.0 */
    readonly family: "ipv4";
    static readonly FromBigint: (n: bigint) => Effect.Effect<IPv4, ParseResult.ParseError, never>;
    get asBigint(): bigint;
}
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv4FromString extends Schema.Annotable<$IPv4FromString, IPv4, string, never> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type IPv4FromString = Schema.Schema.Type<typeof IPv4FromString>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type IPv4FromStringEncoded = Schema.Schema.Encoded<typeof IPv4FromString>;
/**
 * A schema that transforms a `string` into an `IPv4`.
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare const IPv4FromString: $IPv4FromString;
declare const IPv6_base: Schema.Class<IPv6, {
    ip: Schema.Schema<string, string, never>;
}, {
    readonly ip: string;
}, {
    readonly ip: string;
}, never, {
    readonly ip: string;
}, {}, {}>;
/**
 * An IPv6 address.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { IPv6 } from "the-wireguard-effect/InternetSchemas";
 *
 *     const ipv6: IPv6 = IPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
 *     assert.strictEqual(ipv6, "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
 *
 *     const decodeIPv6 = Schema.decodeSync(IPv6);
 *     assert.deepStrictEqual(
 *         decodeIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"),
 *         "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
 *     );
 *
 *     assert.throws(() =>
 *         decodeIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334:")
 *     );
 *     assert.throws(() => decodeIPv6("2001::85a3::0000::0370:7334"));
 *     assert.doesNotThrow(() =>
 *         decodeIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
 *     );
 */
export declare class IPv6 extends IPv6_base {
    /** @since 1.0.0 */
    readonly family: "ipv6";
    static readonly FromBigint: (n: bigint) => Effect.Effect<IPv6, ParseResult.ParseError, never>;
    get asBigint(): bigint;
}
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv6FromString extends Schema.Annotable<$IPv6FromString, IPv6, string, never> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type IPv6FromString = Schema.Schema.Type<typeof IPv6FromString>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type IPv6FromStringEncoded = Schema.Schema.Encoded<typeof IPv6FromString>;
/**
 * A schema that transforms a `string` into an `IPv6`.
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare const IPv6FromString: $IPv6FromString;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $Address extends Schema.union<[typeof IPv4, typeof IPv6]> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type Address = Schema.Schema.Type<typeof Address>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type AddressEncoded = Schema.Schema.Encoded<typeof Address>;
/**
 * An IP address, which is either an IPv4 or IPv6 address.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { Address } from "the-wireguard-effect/InternetSchemas";
 *
 *     const address1: Address = Address("1.1.1.1");
 *     const address2: Address = Address(
 *         "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
 *     );
 *
 *     const decodeAddress = Schema.decodeSync(Address);
 *     assert.throws(() => decodeAddress("1.1.b.1"));
 *     assert.throws(() =>
 *         decodeAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334:")
 *     );
 *     assert.doesNotThrow(() => decodeAddress("1.1.1.2"));
 *     assert.doesNotThrow(() =>
 *         decodeAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
 *     );
 *
 * @see {@link IPv4}
 * @see {@link IPv6}
 */
export declare const Address: $Address;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $AddressFromString extends Schema.union<[typeof IPv4FromString, typeof IPv6FromString]> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type AddressFromString = Schema.Schema.Type<typeof AddressFromString>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type AddressFromStringEncoded = Schema.Schema.Encoded<typeof AddressFromString>;
/**
 * An IP address, which is either an IPv4 or IPv6 address. This schema
 * transforms a `string` into an `Address`.
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare const AddressFromString: $AddressFromString;
/**
 * @since 1.0.0
 * @category Branded types
 */
export type IPv4CidrMaskBrand = number & Brand.Brand<"IPv4CidrMask">;
/**
 * @since 1.0.0
 * @category Branded constructors
 */
export declare const IPv4CidrMaskBrand: Brand.Brand.Constructor<IPv4CidrMaskBrand>;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv4CidrMask extends Schema.Annotable<$IPv4CidrMask, IPv4CidrMaskBrand, Brand.Brand.Unbranded<IPv4CidrMaskBrand>, never> {
}
/**
 * An ipv4 cidr mask, which is a number between 0 and 32.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { IPv4CidrMask } from "the-wireguard-effect/InternetSchemas";
 *
 *     const mask: IPv4CidrMask = IPv4CidrMask(24);
 *     assert.strictEqual(mask, 24);
 *
 *     const decodeMask = Schema.decodeSync(IPv4CidrMask);
 *     assert.strictEqual(decodeMask(24), 24);
 *
 *     assert.throws(() => IPv4CidrMask(33));
 *     assert.doesNotThrow(() => IPv4CidrMask(0));
 *     assert.doesNotThrow(() => IPv4CidrMask(32));
 */
export declare const IPv4CidrMask: $IPv4CidrMask;
/**
 * @since 1.0.0
 * @category Branded types
 */
export type IPv6CidrMaskBrand = number & Brand.Brand<"IPv6CidrMask">;
/**
 * @since 1.0.0
 * @category Branded constructors
 */
export declare const IPv6CidrMaskBrand: Brand.Brand.Constructor<IPv6CidrMaskBrand>;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv6CidrMask extends Schema.Annotable<$IPv6CidrMask, IPv6CidrMaskBrand, Brand.Brand.Unbranded<IPv6CidrMaskBrand>, never> {
}
/**
 * An ipv6 cidr mask, which is a number between 0 and 128.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *     import { IPv6CidrMask } from "the-wireguard-effect/InternetSchemas";
 *
 *     const mask: IPv6CidrMask = IPv6CidrMask(64);
 *     assert.strictEqual(mask, 64);
 *
 *     const decodeMask = Schema.decodeSync(IPv6CidrMask);
 *     assert.strictEqual(decodeMask(64), 64);
 *
 *     assert.throws(() => IPv6CidrMask(129));
 *     assert.doesNotThrow(() => IPv6CidrMask(0));
 *     assert.doesNotThrow(() => IPv6CidrMask(128));
 */
export declare const IPv6CidrMask: $IPv6CidrMask;
declare const CidrBlock_base: Schema.Class<CidrBlock, {
    /** The IP address of this cidr block. */
    ip: $AddressFromString;
    /** The subnet mask of this cidr block. */
    mask: Schema.union<[$IPv4CidrMask, $IPv6CidrMask]>;
}, {
    readonly ip: IPv4 | IPv6;
    readonly mask: IPv4CidrMaskBrand | IPv6CidrMaskBrand;
}, {
    readonly ip: string;
    readonly mask: number;
}, never, {
    readonly ip: IPv4 | IPv6;
    readonly mask: IPv4CidrMaskBrand | IPv6CidrMaskBrand;
}, {}, {}>;
/**
 * Internal helper representation of a cidr range so that we can do
 * transformations to and from it as we cannot represent a stream using
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare class CidrBlock extends CidrBlock_base {
    /**
     * The address family of this cidr block.
     *
     * @since 1.0.0
     */
    readonly family: "ipv4" | "ipv6";
    /**
     * The first address in the range given by this address' subnet, often
     * referred to as the Network Address.
     */
    get networkAddressAsBigint(): bigint;
    /**
     * The last address in the range given by this address' subnet, often
     * referred to as the Broadcast Address.
     */
    get broadcastAddressAsBigint(): bigint;
    /**
     * A stream of all addresses in the range given by this address' subnet.
     *
     * @since 1.0.0
     */
    get range(): Stream.Stream<Address, ParseResult.ParseError, never>;
    get total(): bigint;
}
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $CidrBlockFromString extends Schema.Annotable<$CidrBlockFromString, CidrBlock, `${string}/${number}`, never> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type CidrBlockFromString = Schema.Schema.Type<typeof CidrBlockFromString>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type CidrBlockFromStringEncoded = Schema.Schema.Encoded<typeof CidrBlockFromString>;
/**
 * A schema that transforms a `string` into a `CidrBlock`.
 *
 * @since 1.0.0
 * @category Schemas
 */
export declare const CidrBlockFromString: $CidrBlockFromString;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv4Endpoint extends Schema.Annotable<$IPv4Endpoint, {
    readonly address: IPv4;
    readonly natPort: PortBrand;
    readonly listenPort: PortBrand;
}, `${string}:${number}` | `${string}:${number}:${number}` | {
    readonly ip: string;
    readonly port: number;
} | {
    readonly ip: string;
    readonly natPort: number;
    readonly listenPort: number;
}, never> {
}
/**
 * An IPv4 wireguard endpoint, which consists of an IPv4 address followed by a
 * nat port then an optional local port. If only one port is provided, it is
 * assumed that the nat port and listen port are the same.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *
 *     import {
 *         Port,
 *         IPv4,
 *         IPv4Endpoint,
 *     } from "the-wireguard-effect/InternetSchemas";
 *
 *     const endpoint1 = Schema.decodeSync(IPv4Endpoint)("1.2.3.4:51820");
 *     const endpoint2 = Schema.decodeSync(IPv4Endpoint)("1.2.3.4:51820:41820");
 *
 *     const endpoint3 = Schema.decodeSync(IPv4Endpoint)({
 *         ip: "1.2.3.4",
 *         port: 51820,
 *     });
 *
 *     const endpoint4: IPv4Endpoint = IPv4Endpoint({
 *         ip: IPv4("1.2.3.4"),
 *         natPort: Port(51820),
 *         listenPort: Port(41820),
 *     });
 */
export declare const IPv4Endpoint: Schema.transform<Schema.union<[Schema.struct<{
    ip: Schema.$string;
    port: Schema.$number;
}>, Schema.struct<{
    ip: Schema.$string;
    natPort: Schema.$number;
    listenPort: Schema.$number;
}>, Schema.Schema<`${string}:${number}`, `${string}:${number}`, never>, Schema.Schema<`${string}:${number}:${number}`, `${string}:${number}:${number}`, never>]>, Schema.struct<{
    address: $IPv4FromString;
    natPort: $Port;
    listenPort: $Port;
}>>;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $IPv6Endpoint extends Schema.Annotable<$IPv6Endpoint, {
    readonly address: IPv6;
    readonly natPort: PortBrand;
    readonly listenPort: PortBrand;
}, `[${string}]:${number}` | `[${string}]:${number}:${number}` | {
    readonly ip: string;
    readonly port: number;
} | {
    readonly ip: string;
    readonly natPort: number;
    readonly listenPort: number;
}, never> {
}
/**
 * An IPv6 wireguard endpoint, which consists of an IPv6 address in square
 * brackets followed by a nat port then an optional local port. If only one port
 * is provided, it is assumed that the nat port and listen port are the same.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *
 *     import {
 *         Port,
 *         IPv6,
 *         IPv6Endpoint,
 *     } from "the-wireguard-effect/InternetSchemas";
 *
 *     const endpoint1 = Schema.decodeSync(IPv6Endpoint)(
 *         "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:51820"
 *     );
 *     const endpoint2 = Schema.decodeSync(IPv6Endpoint)(
 *         "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:51820:41820"
 *     );
 *
 *     const endpoint3 = Schema.decodeSync(IPv6Endpoint)({
 *         ip: "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
 *         port: 51820,
 *     });
 *
 *     const endpoint4: IPv6Endpoint = IPv6Endpoint({
 *         ip: IPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"),
 *         natPort: Port(51820),
 *         listenPort: Port(41820),
 *     });
 */
export declare const IPv6Endpoint: $IPv6Endpoint;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $Endpoint extends Schema.union<[$IPv4Endpoint, $IPv6Endpoint]> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type Endpoint = Schema.Schema.Type<typeof Endpoint>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type EndpointEncoded = Schema.Schema.Encoded<typeof Endpoint>;
/**
 * A wireguard endpoint, which is either an IPv4 or IPv6 endpoint.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *
 *     import {
 *         Endpoint,
 *         IPv4,
 *         IPv6,
 *         Port,
 *     } from "the-wireguard-effect/InternetSchemas";
 *
 *     const endpoint1 = Schema.decodeSync(Endpoint)("1.2.3.4:51820");
 *     const endpoint2 = Schema.decodeSync(Endpoint)("1.2.3.4:51820:41820");
 *
 *     const endpoint3 = Schema.decodeSync(Endpoint)({
 *         ip: "1.2.3.4",
 *         port: 51820,
 *     });
 *
 *     const endpoint4: Endpoint = Endpoint({
 *         ip: IPv4("1.2.3.4"),
 *         natPort: Port(51820),
 *         listenPort: Port(41820),
 *     });
 *
 *     const endpoint5 = Schema.decodeSync(Endpoint)(
 *         "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:51820"
 *     );
 *     const endpoint6 = Schema.decodeSync(Endpoint)(
 *         "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:51820:41820"
 *     );
 *
 *     const endpoint7 = Schema.decodeSync(Endpoint)({
 *         ip: "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
 *         port: 51820,
 *     });
 *
 *     const endpoint8: Endpoint = Endpoint({
 *         ip: IPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"),
 *         natPort: Port(51820),
 *         listenPort: Port(41820),
 *     });
 *
 * @see {@link IPv4Endpoint}
 * @see {@link IPv6Endpoint}
 */
export declare const Endpoint: $Endpoint;
/**
 * @since 1.0.0
 * @category Api interface
 */
export interface $SetupData extends Schema.tuple<[$Endpoint, $AddressFromString]> {
}
/**
 * @since 1.0.0
 * @category Unbranded types
 */
export type SetupData = Schema.Schema.Type<typeof SetupData>;
/**
 * @since 1.0.0
 * @category Encoded types
 */
export type SetupDataEncoded = Schema.Schema.Encoded<typeof SetupData>;
/**
 * A wireguard setup data, which consists of an endpoint followed by an address.
 *
 * @since 1.0.0
 * @category Schemas
 * @example
 *     import * as Schema from "@effect/schema/Schema";
 *
 *     import {
 *         Address,
 *         Endpoint,
 *         SetupData,
 *     } from "the-wireguard-effect/InternetSchemas";
 *
 *     const setupData1 = Schema.decodeSync(SetupData)([
 *         "1.1.1.1:51280",
 *         "10.0.0.1",
 *     ]);
 *
 *     const address = Schema.decodeSync(Address)("10.0.0.1");
 *     const endpoint = Schema.decodeSync(Endpoint)("1.1.1.1:51820");
 *     const setupData2: SetupData = SetupData([endpoint, address]);
 *
 * @see {@link EndpointSchema}
 * @see {@link Address}
 */
export declare const SetupData: $SetupData;
export {};
//# sourceMappingURL=InternetSchemas.d.ts.map