Support building with socks-0.6 and persistant-template-2.7

persistent-template now needs UndecidableInstances.

socks changed defaultSocksConf to take a SockAddr.
This commit is contained in:
Joey Hess 2019-07-30 12:49:37 -04:00
parent 9fd37e65d0
commit 018b5b8173
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 14 additions and 0 deletions

View file

@ -5,6 +5,8 @@
- Licensed under the GNU AGPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Utility.Tor where
import Common
@ -37,7 +39,12 @@ connectHiddenService (OnionAddress address) port = do
return s
where
torsocksport = 9050
#if MIN_VERSION_socks(0,6,0)
torsockconf = defaultSocksConf $ SockAddrInet torsocksport $
tupleToHostAddress (127,0,0,1)
#else
torsockconf = defaultSocksConf "127.0.0.1" torsocksport
#endif
socksdomain = SocksAddrDomainName (BU8.fromString address)
socksaddr = SocksAddress socksdomain (fromIntegral port)