summaryrefslogtreecommitdiff
path: root/dht/examples/nalias2.hs
blob: 609f2ec67de48566cf4053b30bb21cd386f71076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import System.Environment
import Control.Monad
import qualified Data.Text as Text

import DNSCache

main = do
    dns <- newDNSCache
    args <- getArgs
    forM args $ \arg -> do
    putStrLn $ arg ++ ":"
    let targ = Text.pack arg
    addrs <- forwardResolve dns targ
    putStrLn $ "  forward: " ++ show addrs
    forM addrs $ \addr -> do
        names <- reverseResolve dns addr
        putStrLn $ "  reverse "++show addr++": "++show names
    return ()