summaryrefslogtreecommitdiff
path: root/prober/record_prober.go
diff options
context:
space:
mode:
Diffstat (limited to 'prober/record_prober.go')
-rw-r--r--prober/record_prober.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/prober/record_prober.go b/prober/record_prober.go
new file mode 100644
index 0000000..e976477
--- /dev/null
+++ b/prober/record_prober.go
@@ -0,0 +1,38 @@
+package prober
+
+import (
+ "dtool/utils"
+)
+
+type SVCBResult struct {
+ Ip string `json:"ip"`
+ Response utils.SVCBResponse `json:"response"`
+}
+
+func SVCBProbeOnce(ip string, domain string) (SVCBResult, error) {
+ result := SVCBResult{Ip: ip}
+ res, err := utils.SendSVCBQuery(ip, domain)
+ if err != nil {
+ return result, err
+ }
+ resp, err := utils.ParseSVCBResponse(res)
+ if err != nil {
+ return result, err
+ }
+ result.Response = resp
+ return result, nil
+}
+
+func SVCBProbe(ip string, domain string) SVCBResult {
+ result := SVCBResult{Ip: ip}
+ res, err := utils.SendSVCBQuery(ip, domain)
+ if err != nil {
+ return result
+ }
+ resp, err := utils.ParseSVCBResponse(res)
+ if err != nil {
+ return result
+ }
+ result.Response = resp
+ return result
+}