/** * Wireguard peer schema definitions * * @since 1.0.0 */ import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; import * as InternetSchemas from "effect-schemas/Internet"; declare const WireguardPeer_base: import("effect/unstable/schema/VariantSchema").Class>; /** * The collection of IPs/masks that will be accepted from this peer. If an * identical value already exists as part of a prior peer, the allowed IP * entry will be removed from that peer and added to this peer. */ readonly AllowedIPs: Schema.withDecodingDefault, Schema.TemplateLiteral, never, never>>, never>; /** * The value for this key is either IP:port for IPv4 or [IP]:port for IPv6 * or some.hostname.com:port for a hostname endpoint. The endpoint is * optional and, if not supplied, the remote peer must connect first (so * they should have the endpoint set to know where to connect to) and this * client will just send requests back to the remote peer's source IP and * port. */ 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>]>>>; /** Lowercase hex-encoded public key of the new peer entry. */ readonly PublicKey: Schema.brand; /** * The preshared key is optional and is a lowercase hex-encoded key. The * value may be an all zero string in the case of a set operation, in which * case it indicates that the preshared-key should be removed. */ readonly PresharedKey: Schema.OptionFromOptionalNullOr>; /** The number of received bytes. */ readonly rxBytes: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.FiniteFromString; }>; /** The number of transmitted bytes. */ readonly txBytes: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.FiniteFromString; }>; /** * The number of seconds since the most recent handshake, expressed relative * to the Unix epoch. */ readonly lastHandshake: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.compose, Schema.FiniteFromString, never, never>>; }>; }, Schema.Struct>; /** * The collection of IPs/masks that will be accepted from this peer. If an * identical value already exists as part of a prior peer, the allowed IP * entry will be removed from that peer and added to this peer. */ readonly AllowedIPs: Schema.withDecodingDefault, Schema.TemplateLiteral, never, never>>, never>; /** * The value for this key is either IP:port for IPv4 or [IP]:port for IPv6 * or some.hostname.com:port for a hostname endpoint. The endpoint is * optional and, if not supplied, the remote peer must connect first (so * they should have the endpoint set to know where to connect to) and this * client will just send requests back to the remote peer's source IP and * port. */ 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>]>>>; /** Lowercase hex-encoded public key of the new peer entry. */ readonly PublicKey: Schema.brand; /** * The preshared key is optional and is a lowercase hex-encoded key. The * value may be an all zero string in the case of a set operation, in which * case it indicates that the preshared-key should be removed. */ readonly PresharedKey: Schema.OptionFromOptionalNullOr>; /** The number of received bytes. */ readonly rxBytes: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.FiniteFromString; }>; /** The number of transmitted bytes. */ readonly txBytes: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.FiniteFromString; }>; /** * The number of seconds since the most recent handshake, expressed relative * to the Unix epoch. */ readonly lastHandshake: import("effect/unstable/schema/VariantSchema").Field<{ readonly uapi: Schema.compose, Schema.FiniteFromString, never, never>>; }>; }, true>>> & { readonly json: Schema.Struct<{ readonly PersistentKeepalive: Schema.OptionFromOptionalNullOr>; 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 uapi: Schema.Struct<{ readonly PersistentKeepalive: Schema.OptionFromOptionalNullOr>; 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>>; }>; }; /** * A wireguard peer configuration. * * @since 1.0.0 * @category Datatypes * @example * ```ts * * import * as Schema from "effect/Schema"; * import * as WireguardKey from "the-wireguard-effect/WireguardKey"; * * import { WireguardPeer } from "the-wireguard-effect/WireguardPeer"; * * const preshareKey = WireguardKey.generatePreshareKey(); * const { publicKey, privateKey: _privateKey } = * WireguardKey.generateKeyPair(); * * const peerSchemaInstantiation = Schema.decodeEffect(WireguardPeer)({ * PublicKey: publicKey, * PresharedKey: preshareKey, * Endpoint: "192.168.0.1:51820", * AllowedIPs: new Set(["192.168.0.0/24"]), * PersistentKeepalive: 20, * }); * ```; */ export declare class WireguardPeer extends WireguardPeer_base { } /** * A wireguard peer configuration encoded in INI format. * * @since 1.0.0 * @category Transformations * @example * ```ts * * import * as Effect from "effect/Effect"; * import * as Function from "effect/Function"; * import * as Schema from "effect/Schema"; * import * as WireguardKey from "the-wireguard-effect/WireguardKey"; * import * as WireguardPeer from "the-wireguard-effect/WireguardPeer"; * * const preshareKey = WireguardKey.generatePreshareKey(); * const { publicKey, privateKey: _privateKey } = * WireguardKey.generateKeyPair(); * * const peer = Schema.decodeEffect(WireguardPeer.WireguardPeer)({ * PublicKey: publicKey, * PresharedKey: preshareKey, * AllowedIPs: new Set(["192.168.0.0/24"]), * Endpoint: "192.168.0.1:51820", * PersistentKeepalive: 20, * }); * * const iniPeer = Function.pipe( * peer, * Effect.flatMap(Schema.encodeEffect(WireguardPeer.WireguardPeer)), * Effect.flatMap(Schema.decodeEffect(WireguardPeer.WireguardIniPeer)) * ); * ```; * * @see {@link WireguardPeer} */ export declare const WireguardIniPeer: Schema.decodeTo; /** * @since 1.0.0 * @category Schemas * @see https://www.wireguard.com/xplatform/ */ export declare const WireguardUapiSetPeer: Schema.decodeTo; /** * @since 1.0.0 * @category Schemas * @see https://www.wireguard.com/xplatform/ */ export declare const WireguardUapiGetPeer: Schema.decodeTo>; 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>>; }>, Schema.String, never, never>; /** * @since 1.0.0 * @category Refinements */ export declare const hasBidirectionalTraffic: (wireguardPeer: Schema.Schema.Type<(typeof WireguardPeer)["uapi"]>) => Effect.Effect; /** * @since 1.0.0 * @category Refinements */ export declare const hasHandshakedRecently: (wireguardPeer: Schema.Schema.Type<(typeof WireguardPeer)["uapi"]>) => Effect.Effect; export {}; //# sourceMappingURL=WireguardPeer.d.ts.map