unbound

package
v0.0.0-...-757a075 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SearchOverridesEndpoint is used to get existing DNS entries in unbound.
	SearchOverridesEndpoint = apiPrefix + "/settings/searchHostOverride"
	// AddOverrideEndpoint is the create DNS entries.
	AddOverrideEndpoint = apiPrefix + "/settings/addHostOverride"
	// DelOverrideEndpoint is the api endpoint for deleting DNS entries.
	DelOverrideEndpoint = apiPrefix + "/settings/delHostOverride/"

	ApplyChangesEndpoint = apiPrefix + "/service/reconfigure"

	CreateOpSuccessResponse = "saved"
	DeleteOpSuccessResponse = "deleted"

	DescriptionPrefix = "Managed by K8s external-dns"
)

Variables

View Source
var (
	ErrRequestFailed = errors.New("request failed")
	ErrMarshalling   = errors.New("marshal response")
)

Functions

This section is empty.

Types

type AddOverrideRequest

type AddOverrideRequest struct {
	Host Record `json:"host"`
}

type OperationResponse

type OperationResponse struct {
	Result string `json:"result"`
}

OperationResponse is the in memory representation of success/fail response from opnsense unbound api success response is typically the opSuccessResponse value.

type Record

type Record struct {
	UUID        string `json:"uuid,omitempty"`
	Hostname    string `json:"hostname"`
	Domain      string `json:"domain"`
	Rr          string `json:"rr,omitempty"`
	Server      string `json:"server"`
	Enabled     string `json:"enabled"`
	Description string `json:"description"`
}

func (Record) DNSName

func (r Record) DNSName() string

type SearchHostResp

type SearchHostResp struct {
	Rows []Record `json:"rows"`
}

func (SearchHostResp) ToEndpoints

func (shr SearchHostResp) ToEndpoints() []*endpoint.Endpoint

type Unbound

type Unbound struct {
	// contains filtered or unexported fields
}

Unbound is the opnsense unbound dns provider implementation. opnsense unbound does not support txt records. Txt records will be added to the "description" field of a record.

func New

func New(client *http.Client, cfg config.Config, logger *slog.Logger) *Unbound

New creates an Unbound provider client - the http client to use baseUrl - location of the opnsense unbound API creds - credentials in the form of apiKey:apiSecret.

func (Unbound) AdjustEndpoints

func (u Unbound) AdjustEndpoints(endpoints []*endpoint.Endpoint) ([]*endpoint.Endpoint, error)

AdjustEndpoints canonicalizes a set of candidate endpoints. It is called with a set of candidate endpoints obtained from the various sources. It returns a set modified as required by the provider. The provider is responsible for adding, removing, and modifying the ProviderSpecific properties to match the endpoints that the provider returns in `Records` so that the change plan will not have unnecessary (potentially failing) changes. It may also modify other fields, add, or remove Endpoints. It is permitted to modify the supplied endpoints.

func (Unbound) ApplyChanges

func (u Unbound) ApplyChanges(ctx context.Context, changes *plan.Changes) error

func (Unbound) GetDomainFilter

func (u Unbound) GetDomainFilter() endpoint.DomainFilter

func (Unbound) Records

func (u Unbound) Records(ctx context.Context) ([]*endpoint.Endpoint, error)

Records returns all records or "overrides" in opnsense unbound. Unbound does not support txt record types. If a record is managed by external-dns, it will have the associated txt records in the description field. Records will marshall the txt fields into a separate endpoint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL