ksuzu46 / golang-wasm-stun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang wasm stun

This repository is based on:

Get started

Copy wasm_exec.js:

Use Go:

cp `go env GOROOT`/misc/wasm/wasm_exec.js public/js/

Use TinyGo:

wget https://raw.githubusercontent.com/tinygo-org/tinygo/release/targets/wasm_exec.js -O public/js/wasm_exec.js

Build:

Go:

GOOS=js GOARCH=wasm go build -o public/js/main.wasm src/main.go

TinyGo:

tinygo build -o public/js/main.wasm -target wasm src/main.go

Run server:

go run src/server.go

TODO:

  • Use WASI since Wasm does not support OS features like file I/O or Networking

Stuff which may be related to this:

About

License:Apache License 2.0


Languages

Language:Go 67.4%Language:CSS 17.5%Language:HTML 15.0%