diff options
| author | Jeff Carr <[email protected]> | 2023-12-14 10:36:56 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-12-14 10:36:56 -0600 |
| commit | 282119d970faed3f8a60d5105a2f26ee14681ff4 (patch) | |
| tree | 1680731c899f0e147487b9ba4d50ace2f3e96eb1 /examples/cloudflare/structs.go | |
| parent | 9d075afb1df62276dea06be4a188eaee8fc69420 (diff) | |
tabs, windows + gocui dropdown menu (almost)
dropdown menu figures out what text was clicked
dropdown menu movement changes line colors
dropdown menus force user to select a response
accidentally committed a binary
tab selection works
tab and window views almost working
tabs and windows almost working
window widgets selection works
better color handling
using gocui view.Visable flag
removal of old color setting code
still need an artificial delay for andlabs SetText()
catching more 'nil' errors
fixed the stupid duplicate tab problem in andlabs
figured out how andlabs had a tab/box mess
works on more than one domain
builds and runs again
debugging double tabs in andlabs gui
GO111MODULE compile notes
code reorg
further improvements
example cloudflare app does first successful dns update
add NewEntryLine() for single line entry boxes
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'examples/cloudflare/structs.go')
| -rw-r--r-- | examples/cloudflare/structs.go | 77 |
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 |
