summaryrefslogtreecommitdiff
path: root/examples/cloudflare/structs.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cloudflare/structs.go')
-rw-r--r--examples/cloudflare/structs.go77
1 files changed, 77 insertions, 0 deletions
diff --git a/examples/cloudflare/structs.go b/examples/cloudflare/structs.go
new file mode 100644
index 0000000..af4d7f3
--- /dev/null
+++ b/examples/cloudflare/structs.go
@@ -0,0 +1,77 @@
+// This is a simple example
+package main
+
+import (
+ "git.wit.org/wit/gui"
+)
+
+var cloudflareURL string = "https://api.cloudflare.com/client/v4/zones/"
+
+// Define a struct to match the JSON structure of the response.
+// This structure should be adjusted based on the actual format of the response.
+type DNSRecords struct {
+ Result []struct {
+ ID string `json:"id"`
+ Type string `json:"type"`
+ Name string `json:"name"`
+ Content string `json:"content"`
+ Proxied bool `json:"proxied"`
+ Proxiable bool `json:"proxiable"`
+ TTL int `json:"ttl"`
+ } `json:"result"`
+}
+
+var masterSave *gui.Node
+
+var domainWidget *gui.Node
+var zoneWidget *gui.Node
+var authWidget *gui.Node
+var emailWidget *gui.Node
+
+var loadButton *gui.Node
+var saveButton *gui.Node
+var zonedrop *gui.Node
+
+// Resource Record (used in a DNS zonefile)
+type RRT struct {
+ typeNode *gui.Node
+ nameNode *gui.Node
+ proxyNode *gui.Node
+ ttlNode *gui.Node
+ valueNode *gui.Node
+ saveNode *gui.Node
+
+ ID string
+ Type string
+ Name string
+ Content string
+ Proxied bool
+ Proxiable bool
+ TTL int
+}
+
+/*
+ This is a structure of all the RR's (Resource Records)
+ in the DNS zonefiile for a hostname. For example:
+
+ For the host test.wit.com:
+
+ test.wit.com A 127.0.0.1
+ test.wit.com AAAA
+ test.wit.com TXT email [email protected]
+ test.wit.com TXT phone 212-555-1212
+ test.wit.com CNAME real.wit.com
+*/
+type hostT struct {
+ hostname string
+ RRs []configT
+}
+
+type configT struct {
+ domain string
+ zoneID string
+ auth string
+ email string
+}
+
+var config map[string]*configT