#librewolf active dynamic proxy when access to onion and NWC address

cat < librewolf-tor.pac

function FindProxyForURL(url, host) {

// GetAlby relay domain

var getAlbyRelay = "relay.getalby.com";

// Route WebSocket connections to GetAlby's relay through the Tor proxy

if (shExpMatch(host, getAlbyRelay)) {

return "SOCKS5 127.0.0.1:9050";

}

// Handle custom schemes like nostr+walletconnect://

// Example: nostr+walletconnect://yyyyyy?relay=wss://relay.getalby.com/v1&secret=xxxxx

if (url.indexOf("nostr+walletconnect://") === 0) {

// Extract the relay parameter from the URL

var relay = url.match(/relay=([^&]*)/);

if (relay && relay[1]) {

var relayHost = relay[1].replace("wss://", "").replace("ws://", "").replace("/v1", "");

// Route the relay host through Tor proxy

if (shExpMatch(relayHost, "relay.getalby.com")) {

return "SOCKS5 127.0.0.1:9050";

}

}

}

// Route .onion domains through the Tor proxy

if (shExpMatch(host, "*.onion")) {

return "SOCKS5 127.0.0.1:9050";

}

// For everything else, use a direct connection

return "DIRECT";

}

EOF

then add this file to proxy setting configuration

Reply to this note

Please Login to reply.

Discussion

No replies yet.