module PeerResolve ( peerKeyToResolvedNames , resolvePeer , parseAddress , unsafeParseAddress , strip_brackets , withPort ) where import Data.Text ( Text ) import Network.Socket ( SockAddr(..) ) import System.IO.Unsafe import DNSCache import ConnectionKey {-# NOINLINE global_dns_cache #-} global_dns_cache :: DNSCache global_dns_cache = unsafePerformIO $ newDNSCache resolvePeer :: Text -> IO [PeerAddress] resolvePeer addrtext = map PeerAddress <$> forwardResolve global_dns_cache addrtext peerKeyToResolvedNames :: PeerAddress -> IO [Text] peerKeyToResolvedNames (PeerAddress addr) = reverseResolve global_dns_cache addr