![[Home]](https://www.emacswiki.org/images/logo218x38.png)
Emacs has built-in support for Socks proxies. An HTTP proxy can easily be added.
socks.el is built-in to Emacs and can be configured like so:
(setq socks-override-functions 1) (setq socks-noproxy '("localhost")) (require 'socks)
socks-override-function - Set this before loading the library to make Emacs use Socks for all networking functions.socks-noproxy - A list of domains to exclude from the proxy.(require 'socks) - Finally, load the socks library.Alternatively, you can use the following for ERC only:
(require 'socks) (setq erc-server-connect-function 'socks-open-network-stream)
The location of the socks server is in the variable ‘socks-server’. To set it you can do:
(setq socks-server '("My Proxy" "socks.host.name" 1080 5))
"My socks server" is the description of the server."socks.host.name" is the host name for the server.1080 is the port number.5 is the socks version (can be 4 as well).If you run ‘torsocks emacs’ from the command line, Emacs will run through Tor. You can also open .onion links in eww and Erc.
You can also use Privoxy and socks.el to connect to tor. After configuring Privoxy, add this to your InitFile:
(setq socks-override-functions 1) (setq socks-noproxy '("localhost")) (require 'socks) (setq socks-server '("Tor Proxy" "localhost" 9050 5))
Does this solutions leak dns?
You may use corkscrew to tunnel IRC connections through HTTP proxies:
(defun corkscrew-open-network-stream (name buffer host service) "Opens a network stream via corkscrew" (open-network-stream name buffer host service :type 'shell :shell-command "corkscrew <proxyhost> <proxyport> %s %p"))
(let ((erc-server-connect-function open-network-stream)) (erc :server "chat.freenode.net"))
Of course, you want to install corkscrew first.
You can use the following to use an unauthenticated HTTP proxy for ERC without external tools:
(defvar http-proxy-host <proxyhost> "Host address for http proxy") (defvar http-proxy-port <proxyport> "Host port for http proxy")
(defun open-http-proxy-stream (name buffer host service &rest parameters) "Open network stream via http proxy. Proxy is defined by variables http-proxy-host and http-proxy-port." (let ((tmp-process (apply 'open-network-stream name buffer http-proxy-host http-proxy-port parameters))) (process-send-string name (format "CONNECT %s:%d HTTP/1.1\n\n" host service)) tmp-process))
(setq erc-server-connect-function 'open-http-proxy-stream)
Alternatively, you could run desproxy-socksserver on localhost and tunnel it through your HTTP proxy.
w3 - Where you can download socks.el for older Emacs versions.