Created
November 30, 2013 21:31
-
-
Save llasram/7724741 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn parse-nx | |
"Parse & filter raw NX records. Truncate QNAMEs to E2LDs." | |
[[sensor rest]] | |
(ignore-errors | |
(am/domonad am/maybe-m | |
[:when (not (v-sensor? sensor)) | |
[ts client domain :as fields] (str/split rest #"\t" 3) | |
:when (valid-fields? 3 fields) | |
ts (Long/parseLong ts 10) | |
domain (flat/domain-e2ld @etlds domain) | |
oplab (-> domain dns/domain-labels first) | |
:when (interesting? oplab domain) | |
[ipv iph :as fields] (str/split client #":") | |
:when (valid-fields? 2 fields) | |
ipv (Long/parseLong ipv 10) | |
iph (Long/parseLong iph 16)] | |
[oplab ts [sensor ipv iph] domain]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment