ππ A socks proxy with user authentication can be set for electron's session
# NPM
npm install electron-session-proxy
# Yarn
yarn add electron-session-proxy
# PNPM
pnpm add electron-session-proxyimport { session } from "electron";
const ses = session.fromPartition("persist:github");
// proxy is invalid ββ Unable to authenticate
ses.setProxy({ proxyRules: "socks5://user:[email protected]:1080" });import { session } from "electron";
import { sockProxyRules } from "electron-session-proxy";
const ses = session.fromPartition("persist:github");
// proxyRules === 'http://127.0.0.1:[random-port]'
const proxyRules = await sockProxyRules("socks5://user:[email protected]:1080");
// proxy is valid β
β
Able to authenticate
ses.setProxy({ proxyRules });Thanks to the socks( GitHub | npm ) project, it has been a huge help to me.