Example: uTLS.wasm
This example shows how to build a fully functional TLS client with TinyGo from uTLS.
Build
Go 1.20/1.21/1.22 is required to build this example. TinyGo started to support Go 1.22 in v0.31.0.
Debug
tinygo build -o utls.wasm -target=wasi -scheduler=asyncify -gc=conservative -tags=purego .
Release
tinygo build -o utls.wasm -target=wasi -no-debug -scheduler=asyncify -gc=conservative -tags=purego .
Dependencies
The utls
imported must be from the wasm
branch of uTLS. You may use a replace directive in go.mod
to your local clone of uTLS, or use a tagged version with suffix -wasm
(e.g., v1.6.2-wasm
) to make sure it is tagged from the correct branch.