ecc96b695e5be7cd65655e1c1c0428ac9deedfe4
mailinabox-go
Go client library and CLI for the Mail-in-a-Box admin DNS API.
Library
import miab "gitea.koszewscy.waw.pl/koszewscy/mailinabox-go"
// Explicit credentials:
c, err := miab.NewClient("box.example.com", "admin@example.com", "password")
// From environment variables (MIAB_* or MAILINABOX_* style):
c, err := miab.NewClient("", "", "")
c.SetRecord("foo.example.com", "TXT", "v=spf1 ~all")
c.AddRecord("foo.example.com", "A", "1.2.3.4")
c.DeleteRecord("foo.example.com", "A", "1.2.3.4")
records, _ := c.ListRecords("TXT")
CLI
Install from registry:
go install gitea.koszewscy.waw.pl/koszewscy/mailinabox-go/cmd/miab@latest
Build locally:
go build -o miab ./cmd/miab
Credentials via environment variables (either style is accepted):
# MIAB style
export MIAB_HOST=box.example.com
export MIAB_USERNAME=admin@example.com
export MIAB_PASSWORD=password
# Mail-in-a-Box style
export MAILINABOX_BASE_URL=https://box.example.com
export MAILINABOX_EMAIL=admin@example.com
export MAILINABOX_PASSWORD=password
Commands:
miab list [--type TXT]
miab set --name foo.example.com --type TXT --value "hello"
miab add --name foo.example.com --type A --value 1.2.3.4
miab delete --name foo.example.com --type TXT [--value "hello"]
AI Disclaimer
This project was generated with the assistance of AI tools. While efforts have been made to ensure the accuracy and reliability of the code, users should review and test the code thoroughly before using it in production environments. The author is not responsible for any issues arising from the use of this code.
Languages
Go
100%