Skip to main content Link Search Menu Expand Document (external link)

WireguardConfig overview

Wireguard config schema definitions

Added in v1.0.0


Table of contents


Api interface

$WireguardIniConfig (interface)

Signature

export interface $WireguardIniConfig
  extends Schema.Annotable<$WireguardIniConfig, string, Schema.Schema.Encoded<typeof WireguardConfig>, never> {}

Added in v1.0.0

Constructors

fromConfigFile

Loads a wireguard interface configuration from an INI file.

Signature

export declare const fromConfigFile: (
  file: string
) => Effect.Effect<WireguardConfig, ParseResult.ParseError | PlatformError.PlatformError, FileSystem.FileSystem>

Added in v1.0.0

Requests

WireguardGetConfigRequest (class)

Signature

export declare class WireguardGetConfigRequest

Added in v1.0.0

WireguardSetConfigRequest (class)

Signature

export declare class WireguardSetConfigRequest

Added in v1.0.0

Resolvers

WireguardGetConfigResolver

Signature

export declare const WireguardGetConfigResolver: Resolver.RequestResolver<WireguardGetConfigRequest, never>

Added in v1.0.0

WireguardSetConfigResolver

Signature

export declare const WireguardSetConfigResolver: Resolver.RequestResolver<WireguardSetConfigRequest, never>

Added in v1.0.0

Responses

WireguardGetConfigResponse

Signature

export declare const WireguardGetConfigResponse: Schema.extend<
  Schema.SchemaClass<
    {
      readonly Address: InternetSchemas.CidrBlockBase<"ipv4"> | InternetSchemas.CidrBlockBase<"ipv6">
      readonly PrivateKey: string & Brand<"WireguardKey">
      readonly Dns?:
        | { readonly family: "ipv4"; readonly ip: InternetSchemas.IPv4Brand }
        | { readonly family: "ipv6"; readonly ip: InternetSchemas.IPv6Brand }
        | undefined
      readonly ListenPort: InternetSchemas.PortBrand
      readonly FirewallMark?: number | undefined
      writeToFile: (
        file: string
      ) => Effect.Effect<void, ParseResult.ParseError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>
      up: (
        interfaceObject?: WireguardInterface.WireguardInterface | undefined
      ) => Effect.Effect<
        WireguardInterface.WireguardInterface,
        | Socket.SocketError
        | ParseResult.ParseError
        | Cause.TimeoutException
        | WireguardErrors.WireguardError
        | PlatformError.PlatformError,
        FileSystem.FileSystem | Path.Path | WireguardControl.WireguardControl | CommandExecutor.CommandExecutor
      >
      upScoped: (
        interfaceObject?: WireguardInterface.WireguardInterface | undefined
      ) => Effect.Effect<
        WireguardInterface.WireguardInterface,
        | Socket.SocketError
        | ParseResult.ParseError
        | Cause.TimeoutException
        | WireguardErrors.WireguardError
        | PlatformError.PlatformError,
        | Scope.Scope
        | FileSystem.FileSystem
        | Path.Path
        | WireguardControl.WireguardControl
        | CommandExecutor.CommandExecutor
      >
    },
    {
      readonly Address: `${string}/${number}`
      readonly PrivateKey: string
      readonly Dns?: string | undefined
      readonly ListenPort: string | number
      readonly FirewallMark?: number | null | undefined
    },
    never
  >,
  Schema.Struct<{
    Peers: Schema.optionalWithOptions<
      Schema.Array$<typeof WireguardPeer.WireguardUApiGetPeerResponse>,
      { default: () => never[]; nullable: true }
    >
  }>
>

Added in v1.0.0

WireguardGetConfigResponse (type alias)

Signature

export type WireguardGetConfigResponse = Schema.Schema.Type<typeof WireguardGetConfigResponse>

Added in v1.0.0

Schema Transformations

WireguardIniConfig

A wireguard configuration encoded in the INI format.

Signature

export declare const WireguardIniConfig: $WireguardIniConfig

Added in v1.0.0

Schemas

WireguardConfig (class)

A wireguard configuration.

Signature

export declare class WireguardConfig

Added in v1.0.0

writeToFile (property)

Writes a wireguard interface configuration to an INI file.

Signature

writeToFile: (file: string) =>
  Effect.Effect<void, ParseResult.ParseError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>

Added in v1.0.0

up (property)

Starts a wireguard tunnel that will continue to run and serve traffic even after the nodejs process exits.

Signature

up: (interfaceObject?: WireguardInterface.WireguardInterface | undefined) =>
  Effect.Effect<
    WireguardInterface.WireguardInterface,
    | Socket.SocketError
    | ParseResult.ParseError
    | Cause.TimeoutException
    | PlatformError.PlatformError
    | WireguardErrors.WireguardError,
    FileSystem.FileSystem | Path.Path | CommandExecutor.CommandExecutor | WireguardControl.WireguardControl
  >

Added in v1.0.0

upScoped (property)

Starts a wireguard tunnel that will be gracefully shutdown and stop serving traffic once the scope is closed.

Signature

upScoped: (interfaceObject?: WireguardInterface.WireguardInterface | undefined) =>
  Effect.Effect<
    WireguardInterface.WireguardInterface,
    | Socket.SocketError
    | ParseResult.ParseError
    | Cause.TimeoutException
    | PlatformError.PlatformError
    | WireguardErrors.WireguardError,
    | FileSystem.FileSystem
    | Path.Path
    | CommandExecutor.CommandExecutor
    | WireguardControl.WireguardControl
    | Scope.Scope
  >

Added in v1.0.0