summaryrefslogtreecommitdiff
path: root/json.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-12-20 03:13:43 -0600
committerJeff Carr <[email protected]>2023-12-20 03:13:43 -0600
commit382cc8dd171731cc333dd05b7b0b798340162a32 (patch)
tree946e99e434183b3eb1272180799c3678f5c7e037 /json.go
parentbbf96ee7fa67a6d50ea1d1b3a23a3f44f136a30e (diff)
make a cloudflare packagev0.1.2
move cloudflare stuff to a package display cloudflare API values dns protobuf example sort output, but gocli formatting is bad cloudflare window can be closed first time success pushing AAAA records for my box enable a cloudflare button RFC 8482. DNS servers we use should respond to ANY We should support ANY requests via DNS as long as we enforce TCP over UDP populate the API provider domain NS record changes are tracked check hostname OS configuration detect domain name changes lookup of NS records for my domain name button to investigate port 53 daemon start dns resolver detection and debugging measure dns resolution speed sort todo items Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'json.go')
-rw-r--r--json.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/json.go b/json.go
new file mode 100644
index 0000000..6cb3af5
--- /dev/null
+++ b/json.go
@@ -0,0 +1,25 @@
+// This is a simple example
+package main
+
+import (
+ "encoding/json"
+)
+
+// formatJSON takes an unformatted JSON string and returns a formatted version.
+func formatJSON(unformattedJSON string) (string, error) {
+ var jsonData interface{}
+
+ // Decode the JSON string into an interface
+ err := json.Unmarshal([]byte(unformattedJSON), &jsonData)
+ if err != nil {
+ return "", err
+ }
+
+ // Re-encode the JSON with indentation for formatting
+ formattedJSON, err := json.MarshalIndent(jsonData, "", " ")
+ if err != nil {
+ return "", err
+ }
+
+ return string(formattedJSON), nil
+}