~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/socialweb-computer-console

console.socialweb.computer: kcp, kubectl and ssh compiled to wasm in a browser tab with a terminal; a kcp fork

0
0
main
25 lines · 871 B Raw History
package socialweb

import (
	"net/http"
	"time"

	"github.com/bluesky-social/indigo/atproto/identity"
)

// BrowserDirectory resolves AT Protocol handles and DIDs with fetch() only.
//
// indigo's DefaultDirectory installs an SSRF dialer, which makes net/http use
// the socket stack instead of fetch() under GOOS=js and fails with "dial tcp:
// lookup ...". The wasm runtime has no sockets. An empty DNS suffix skips DNS
// entirely (every string has the empty suffix), so handles resolve through the
// public HTTPS well-known endpoint, and did:plc/did:web through fetch as well.
func BrowserDirectory() identity.Directory {
	client := &http.Client{Timeout: 10 * time.Second}
	return &identity.BaseDirectory{
		PLCURL:                identity.DefaultPLCURL,
		HTTPClient:            *client,
		PLCClient:             client,
		SkipDNSDomainSuffixes: []string{""},
	}
}