Skip to content

libdns/mailinabox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mail-In-A-Box custom DNS API provider

Go Reference

This package implements the libdns interfaces for Mail-In-A-Box custom DNS API, allowing you to manage DNS records.

This provider only supports the one zone that the admin custom dns api is hosted on.

import (
	"context"
	"fmt"

	"github.com/libdns/mailinabox"
)

func GetSubDomains() []string {
	zone := "[your mailinabox root domain]." // <- note the trailing .
	provider := &mailinabox.Provider{
		APIURL:       "https://[your mailinabox box]/admin/dns/custom",
		EmailAddress: "[create a special account on your box for managing domains]",
		Password:     "[password of the special dns account]",
	}
	records, err := provider.GetRecords(context.TODO(), zone)
	if err != nil {
		fmt.Printf("Error fetching records: %s", err)
		return nil
	}

	subDomains := make([]string, len(records))
	for i, record := range records {
		subDomains[i] = record.Name
	}
	return subDomains
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages