ErcProxy

Emacs has built-in support for Socks proxies. An HTTP proxy can easily be added.

Socks Proxies

socks.el is built-in to Emacs and can be configured like so:

(setq socks-override-functions 1)
(setq socks-noproxy '("localhost"))
(require 'socks)

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))

Tor

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?

Corkscrew

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.

Generic HTTP Proxy

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.

See Also

w3 - Where you can download socks.el for older Emacs versions.

External Links


ERC