Access onion services by a SOCKS proxy (e.g., Tor)
authorSimon Nicolussi <sinic@sinic.name>
Sun, 4 Oct 2020 15:17:53 +0000 (17:17 +0200)
committerSimon Nicolussi <sinic@sinic.name>
Sun, 4 Oct 2020 15:17:53 +0000 (17:17 +0200)
To test this, start the Tor daemon (tor), set the variable socks-server
to the list ("Tor" "localhost" 9050 5), and visit some onion service.

The socks library of Emacs provides a (very limited) alternative to the
regular open-network-stream function. Some of those limitations can be
mitigated by setting the respective options (e.g., the coding system)
later on, instead of when creating the network process object. This is
now done for both indirect and direct connections, for consistency.

TLS is a special case, as the initial connection to the SOCKS server is
typically unencrypted: TLS negotiation only takes place after the proxy
established a connection to the target. The force-ipv4 option is also
a special case, as it is ignored (it obviously cannot work with Tor).

The most serious limitation of the socks library is that opening the
network stream happens synchronously. For this reason, create the timer
before calling socks-open-network-stream. The sentinel function is also
not called automatically in the case of a synchronous open, so call it
explicitly. The appearance of a hanging Emacs is not ideal (even though
users should always be able to abort connection attempts with C-g), but
any improvement probably requires changes in the socks library.


No differences found