A bilingual (English/简体中文) landing and utility site for wgquick.com that generates WireGuard key pairs, pre-shared keys, and derived public keys entirely inside the browser. Cryptographic operations run through a Go module compiled to WebAssembly; no network requests are made after the page loads.
- Go 1.24 → WebAssembly (
cmd/wasm) - React 19 + TypeScript (strict) + Vite (
web/) - Custom handcrafted CSS (
web/public/styles.css) designed to comply with an inline-free CSP
- Generate private/public key pairs and pre-shared keys locally via Go’s
wgtypes - Derive a public key from a user-supplied private key
- Zero server interaction, reinforced by an explicit Content Security Policy (
default-src 'self'with WebAssembly support) - Marketing copy emphasises security and convenience in English and Chinese, auto-detected on first visit and stored in
localStorage - Optional Google Analytics integration controlled via
VITE_GA_MEASUREMENT_ID
- Install dependencies
pnpm install --dir web
- Build the Go → WASM binary (reproducible output)
make wasm # or: GODEBUG=randautoseed=0 GOOS=js GOARCH=wasm go build -trimpath -buildvcs=false -ldflags="-buildid=" -o web/public/main.wasm ./cmd/wasm - Run the development server
make dev # (equivalent to `pnpm --dir web dev`)The strict CSP in
index.htmlis production-oriented. If the dev tools you use inject scripts, consider running the dev server in an isolated profile.
make build
# outputs to web/dist with main.wasm + wasm_exec.js alongside the bundleThe combination of GODEBUG=randautoseed=0, -trimpath, -buildvcs=false, and -ldflags="-buildid=" removes non-deterministic metadata so identical sources produce identical main.wasm binaries.
- Copy
web/.env.exampletoweb/.env.local(or set the variable in your deployment environment). - Set
VITE_GA_MEASUREMENT_ID=G-XXXXXXXXXXto enable Google Analytics; leave it empty to disable analytics for private deployments. - The build injects the required GA
<script>tags and expands the CSP automatically when a measurement ID is present. - When using the provided GitHub Actions workflow, create the
VITE_GA_MEASUREMENT_IDrepository secret so Cloudflare Pages builds include analytics.- If you need reproducible artifacts outside the workflow, remember to set
GODEBUG=randautoseed=0when runninggo build.
- If you need reproducible artifacts outside the workflow, remember to set
Deploy the contents of web/dist at https://wgquick.com/. The dist folder already includes main.wasm and wasm_exec.js under the same CSP rules.
├── cmd/wasm/ # Go entrypoint exposing JS bindings
├── web/
│ ├── public/ # static assets (wasm_exec.js, styles.css, main.wasm)
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── i18n/ # locale messages + context
│ │ └── lib/ # WASM loader
│ └── index.html # Strict CSP + asset bootstrap
├── Makefile # wasm/dev/build helpers
└── README.md
- Inspect or edit
cmd/wasm/main.go, rebuildmain.wasm, and diff the resulting SHA256 with the deployed artifact. - Monitor the browser’s network tab: after the initial page load, no additional requests are issued.
- Add automated integrity checks (e.g., Service Worker verifying WASM hash)
- Publish the site to the wgquick.com domain via a static host (Netlify, Cloudflare Pages, etc.)
- Consider publishing reproducible build instructions or CI pipelines for transparency.
- Code is released under the MIT License © 2025 eyebrowkang.
- Website icons and branding assets are proprietary to eyebrowkang; please contact the author before reuse.