Skip to content

Commit

Permalink
minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
lyokha committed Oct 2, 2023
1 parent cf95c0a commit 1474311
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions NgxExport/Tools/Resolve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ collectA lTTL name = do
-- Returns a list of pairs /(Domain name, IP address)/ wrapped in an 'SRV'
-- container and the minimum value of their TTLs. If the list is empty, then
-- the returned TTL value gets taken from the first argument. Note that trailing
-- dots get removed in the returned domain names.
-- dots in the collected domain names (as in /www.mycompany.com./) get removed
-- in the returned list.
collectSRV
:: TTL -- ^ Fallback TTL value
-> Name -- ^ Service name
Expand All @@ -376,7 +377,7 @@ collectSRV lTTL name = do
return (t
,map (\v ->
s { srvTarget =
(removeTrailingDot srvTarget, v)
(removeTrailingDot srvTarget, v)
}
) is
)
Expand All @@ -386,9 +387,7 @@ collectSRV lTTL name = do
(minimumTTL lTTL $ map fst srv')
,concatMap snd srv'
)
where removeTrailingDot (Name v) = Name $ case C8.unsnoc v of
Just (v', '.') -> v'
_ -> v
where removeTrailingDot (Name v) = Name $ maybe v fst $ C8.unsnoc v

showIPv4 :: IPv4 -> String
showIPv4 (IPv4 w) =
Expand Down

0 comments on commit 1474311

Please sign in to comment.