Skip to content

Conversation

@xrn
Copy link
Owner

@xrn xrn commented Sep 18, 2025

This change introduces new functions to the Go SDK specifically designed for use in ephemeral environments like AWS Lambda, where filesystem access is restricted or undesirable.

Previously, using the zrok Go SDK required an "enabled" environment on disk (~/.zrok), which was created by the zrok enable command. This made it difficult to use the SDK from serverless functions.

The new functions, sdk.Enable and sdk.Dial, allow a Go application to:

  1. Programmatically enable a zrok environment by calling the controller API and holding the resulting Ziti identity entirely in memory.
  2. Use this in-memory identity to dial a zrok share and receive a standard net.Conn object for communication.

This eliminates the need for a pre-configured zrok environment on disk or a separate proxy process, allowing Lambda functions to act as native zrok clients.

A corresponding sdk.Unaccess function is provided for cleanup, and a new example sdk/golang/examples/lambda/main.go demonstrates the complete lifecycle of this new feature.

This change introduces new functions to the Go SDK specifically designed for use in ephemeral environments like AWS Lambda, where filesystem access is restricted or undesirable.

Previously, using the `zrok` Go SDK required an "enabled" environment on disk (`~/.zrok`), which was created by the `zrok enable` command. This made it difficult to use the SDK from serverless functions.

The new functions, `sdk.Enable` and `sdk.Dial`, allow a Go application to:
1.  Programmatically enable a `zrok` environment by calling the controller API and holding the resulting Ziti identity entirely in memory.
2.  Use this in-memory identity to dial a `zrok` share and receive a standard `net.Conn` object for communication.

This eliminates the need for a pre-configured `zrok` environment on disk or a separate proxy process, allowing Lambda functions to act as native `zrok` clients.

A corresponding `sdk.Unaccess` function is provided for cleanup, and a new example `sdk/golang/examples/lambda/main.go` demonstrates the complete lifecycle of this new feature.
This change introduces new functions to the Go SDK specifically designed for use in ephemeral environments like AWS Lambda, where filesystem access is restricted or undesirable.

Previously, using the `zrok` Go SDK required an "enabled" environment on disk (`~/.zrok`), which was created by the `zrok enable` command. This made it difficult to use the SDK from serverless functions.

The new functions, `sdk.Enable` and `sdk.Dial`, allow a Go application to:
1.  Programmatically enable a `zrok` environment by calling the controller API and holding the resulting Ziti identity entirely in memory.
2.  Use this in-memory identity to dial a `zrok` share and receive a standard `net.Conn` object for communication.

This eliminates the need for a pre-configured `zrok` environment on disk or a separate proxy process, allowing Lambda functions to act as native `zrok` clients.

A corresponding `sdk.Unaccess` function is provided for cleanup.

This change also includes:
- A generic example in `sdk/golang/examples/lambda/main.go`.
- A specific test demonstrating how to integrate with the `go-mssqldb` driver for SQL Server connections in `sdk/golang/examples/lambda/mssql_test.go`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants