summaryrefslogtreecommitdiff
path: root/Presence/PeerResolve.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-03-11 03:00:36 -0400
committerjoe <joe@jerkface.net>2014-03-11 03:00:36 -0400
commitc2807f80a5376cdb084503c0d80bc1eb24595b99 (patch)
tree6ade55974c41c9fdf696e23518010235dd9d0d12 /Presence/PeerResolve.hs
parentf92276b3c28e715146bee11d0cdb48b711190fea (diff)
oops missing PeerResolve
Diffstat (limited to 'Presence/PeerResolve.hs')
-rw-r--r--Presence/PeerResolve.hs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Presence/PeerResolve.hs b/Presence/PeerResolve.hs
new file mode 100644
index 00000000..39607ef4
--- /dev/null
+++ b/Presence/PeerResolve.hs
@@ -0,0 +1,39 @@
1module PeerResolve
2 ( peerKeyToResolvedNames
3 , resolvePeer
4 , parseAddress
5 , strip_brackets
6 , withPort
7 ) where
8
9import Data.List ( nub )
10import Data.Text ( Text )
11import Network.Socket ( SockAddr(..) )
12import System.Endian ( fromBE32, toBE32 )
13import System.IO.Error ( isDoesNotExistError )
14import Control.Exception ( handle, ErrorCall(..) )
15import qualified Network.BSD as BSD
16import qualified Data.Text as Text
17import Control.Concurrent
18import Control.Concurrent.STM
19import Control.Monad
20import Data.Maybe
21import System.IO.Unsafe
22
23import GetHostByAddr
24import DNSCache
25import ConnectionKey
26import ControlMaybe
27
28{-# NOINLINE global_dns_cache #-}
29global_dns_cache = unsafePerformIO $ newDNSCache
30
31resolvePeer :: Text -> IO [SockAddr]
32resolvePeer addrtext = forwardResolve global_dns_cache addrtext
33
34peerKeyToResolvedNames :: ConnectionKey -> IO [Text]
35peerKeyToResolvedNames k@(ClientKey { localAddress=addr }) = return []
36peerKeyToResolvedNames k@(PeerKey { callBackAddress=addr }) = do
37 reverseResolve global_dns_cache addr
38
39