Documentation ¶
Overview ¶
Package gomiabdns provides a interface for the Mail-In-A-Box dns API
Index ¶
- type Client
- func (c *Client) AddHost(ctx context.Context, name string, recordType RecordType, value string) error
- func (c *Client) DeleteHost(ctx context.Context, name string, recordType RecordType, value string) error
- func (c *Client) GetHosts(ctx context.Context, name string, recordType RecordType) ([]DNSRecord, error)
- func (c *Client) UpdateHost(ctx context.Context, name string, recordType RecordType, value string) error
- type DNSRecord
- type RecordType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client provides a target for methods interacting with the DNS API.
func (*Client) AddHost ¶
func (c *Client) AddHost(ctx context.Context, name string, recordType RecordType, value string) error
AddHost adds a record. name, recordType, and value are all required. If a record exists with the same value, no new record is created. Use this method for creating multple A records for dns loadbalancing. Or use it to create multiple different TXT records.
func (*Client) DeleteHost ¶
func (c *Client) DeleteHost(ctx context.Context, name string, recordType RecordType, value string) error
DeleteHost will delete records that match the passed paramters.
func (*Client) GetHosts ¶
func (c *Client) GetHosts(ctx context.Context, name string, recordType RecordType) ([]DNSRecord, error)
GetHosts returns all defined records if name and recordType are both empty string. If values are provided for both name and recordType, only the records that match both are returned. If one or the other of name and recordType are empty string, no records are returned.
func (*Client) UpdateHost ¶
func (c *Client) UpdateHost(ctx context.Context, name string, recordType RecordType, value string) error
UpdateHost will create or update a record that corresponds with the name and recordType. If multiple records with the same name and type exists, they will all be removed and replaced with a single one that matches the parameters passed to this method. name, recordType, and value are all required.
type DNSRecord ¶
type DNSRecord struct { QualifiedName string `json:"qname"` RecordType RecordType `json:"rtype"` SortOrder struct { ByCreated int `json:"created"` ByName int `json:"qname"` } `json:"sort-order"` Value string `json:"value"` Zone string `json:"zone"` }
DNSRecord represents the host data returned from the API
type RecordType ¶
type RecordType string
RecordType is the type of DNS Record. For ex. CNAME.
const ( // A record type. A RecordType = "A" // AAAA record type. AAAA RecordType = "AAAA" // CAA record type. CAA RecordType = "CAA" // CNAME record type. CNAME RecordType = "CNAME" // MX record type. MX RecordType = "MX" // NS record type. NS RecordType = "NS" // TXT record type. TXT RecordType = "TXT" // SRV record type. SRV RecordType = "SRV" // SSHFP record type. SSHFP RecordType = "SSHFP" )