fix(tsconnect/wasm): Node.js compatibility — safesocket unique name, listen addr normalisation #13

Merged
codinget merged 3 commits from wasm-node-fixes into webnet 2026-06-15 00:17:31 +02:00
Showing only changes of commit 915dca44fe - Show all commits
+8 -1
View File
@@ -5,15 +5,22 @@ package safesocket
import (
"context"
"fmt"
"net"
"sync/atomic"
"github.com/akutz/memconn"
)
const memName = "Tailscale-IPN"
// memSeq ensures each IPN instance in the same WASM process gets a distinct
// memconn address, so concurrent instances do not conflict on the registry.
var memSeq atomic.Int64
func listen(path string) (net.Listener, error) {
return memconn.Listen("memu", memName)
name := fmt.Sprintf("%s-%d", memName, memSeq.Add(1))
return memconn.Listen("memu", name)
}
func connect(ctx context.Context, _ string) (net.Conn, error) {