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

WireguardServer.ts overview

Utilities for connecting to the Wireguard demo server at demo.wireguard.com

Since v1.0.0


Exports Grouped by Category


Encoded types

WireguardDemoServerSchemaEncoded (type alias)

Signature

type WireguardDemoServerSchemaEncoded = Schema.Schema.Encoded<typeof WireguardDemoServerSchema>

Source

Since v1.0.0

Schema

WireguardDemoServerSchema

Signature

declare const WireguardDemoServerSchema: Schema.transform<
  Schema.TemplateLiteral<`OK:${string}:${number}:${string}
`>,
  Schema.Struct<{
    serverPort: InternetSchemas.$Port
    serverPublicKey: Schema.brand<Schema.refine<string, typeof Schema.String>, "WireguardKey">
    yourWireguardAddress: InternetSchemas.$Address
  }>
>

Source

Since v1.0.0

Unbranded types

WireguardDemoServerSchema (type alias)

Signature

type WireguardDemoServerSchema = Schema.Schema.Type<typeof WireguardDemoServerSchema>

Source

Since v1.0.0

utils

WireguardDemoServer

Mock implementation of the Wireguard demo server at demo.wireguard.com

See

  • https://git.zx2c4.com/wireguard-tools/plain/contrib/ncat-client-server/server.sh

Signature

declare const WireguardDemoServer: (options: {
  maxPeers?: number | undefined
  serverEndpoint: InternetSchemas.Endpoint
  wireguardNetwork: InternetSchemas.CidrBlockFromStringEncoded
}) => Effect.Effect<
  void,
  | Socket.SocketError
  | ParseResult.ParseError
  | Cause.TimeoutException
  | WireguardErrors.WireguardError
  | PlatformError.PlatformError
  | SocketServer.SocketServerError,
  | Scope.Scope
  | FileSystem.FileSystem
  | Path.Path
  | SocketServer.SocketServer
  | WireguardControl.WireguardControl
  | CommandExecutor.CommandExecutor
>

Source

Since v1.0.0

requestWireguardDemoConfig

Creates a Wireguard configuration to connect to demo.wireguard.com. When connected, you should be able to see the hidden page at 192.168.4.1

See

  • https://git.zx2c4.com/wireguard-tools/plain/contrib/ncat-client-server/client.sh

Signature

declare const requestWireguardDemoConfig: (
  connectOptions?: { port: number; host: string },
  {
    privateKey,
    publicKey
  }?: { readonly privateKey: WireguardKey.WireguardKey; readonly publicKey: WireguardKey.WireguardKey }
) => Effect.Effect<WireguardConfig.WireguardConfig, Socket.SocketError | ParseResult.ParseError, never>

Source

Since v1.0.0