Permalink
Browse files

Move hSpec tests for 'lookupSRC' into the (tested) docs for 'lookupSRV'.

  • Loading branch information...
1 parent 1d5415f commit 407360e63b47a40aa70493b1dd857bd617e7a5e3 @orlitzky orlitzky committed Sep 12, 2013
Showing with 24 additions and 10 deletions.
  1. +24 −3 Network/DNS/Lookup.hs
  2. +0 −7 test2/LookupSpec.hs
View
@@ -373,9 +373,30 @@ lookupRDNS rlv ip = lookupPTR rlv dom
----------------------------------------------------------------
-{-|
- Resolving 'Domain' and its preference by 'SRV'.
--}
+-- | Look up all \'SRV\' records for the given hostname. A SRV record
+-- comprises four fields,
+--
+-- * Priority (lower is more-preferred)
+--
+-- * Weight (relative frequency with which to use this record
+-- amongst all results with the same priority)
+--
+-- * Port (the port on which the service is offered)
+--
+-- * Target (the hostname on which the service is offered)
+--
+-- The first three are integral, and the target is another DNS
+-- hostname. We therefore return a four-tuple
+-- @(Int,Int,Int,'Domain')@.
+--
+-- Examples:
+--
+-- >>> let hostname = Data.ByteString.Char8.pack "_sip._tcp.cisco.com"
+-- >>>
+-- >>> rs <- makeResolvSeed defaultResolvConf
+-- >>> withResolver rs $ \resolver -> lookupSRV resolver hostname
+-- Right [(1,0,5060,"vcsgw.cisco.com.")]
+--
lookupSRV :: Resolver -> Domain -> IO (Either DNSError [(Int,Int,Int,Domain)])
lookupSRV rlv dom = do
erds <- DNS.lookup rlv dom SRV
View
@@ -16,10 +16,3 @@ spec = do
`shouldReturn`
Right []
- describe "lookupSRV" $ do
- it "gets SRV" $ do
- rs <- makeResolvSeed defaultResolvConf
- withResolver rs $ \resolver ->
- DNS.lookupSRV resolver "_sip._tcp.cisco.com"
- `shouldReturn`
- Right [(1,0,5060,"vcsgw.cisco.com.")]

0 comments on commit 407360e

Please sign in to comment.