pph

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 8 Imported by: 0

README

pph for libdns

Go Reference

This package implements the libdns interfaces for PPH using the API, allowing you to manage DNS records.

Authenticating

[!IMPORTANT] This package supports API token authentication which is currently a beta feature of the provider.

Create an API Token in the Web-UI Vionity.de.

These tokens are not scoped, so be careful were you store this token.

API Token in UI

Example Configuration

You can either export the token by using an environment variable called API_TOKEN or the go initialization.

If you want to use the environment variable you need to pass an empty string "" to the pph.New("") function.

You can also pass the token to the pph.New("<I am a very secure token>") function of the library.

$ export API_TOKEN="<I am a very secure token>"
>
import (
  "context"

  "github.com/libdns/libdns"
  "github.com/libdns/pph"
)

func main() {
  zone := "zone.example.com"
  // uses the data from the API_TOKEN environment variable
  p := pph.Provider{
      APIToken: "",
  }
  ctx := context.Background()
  records, err := p.GetRecords(ctx, zone)
}

Thie example uses the provider struct directly.

// With token Auth
p := pph.Provider{
    APIToken: "<I am a very secure token>",
}

Documentation

Overview

Package pph implements a DNS record management client compatible with the libdns interfaces for PrepaidHoster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(recordA libdns.Record, recordB libdns.Record, delete bool) (bool, error)

Types

type Provider

type Provider struct {
	APIToken string `json:"api_token,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with pph

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the specified records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) (records []libdns.Record, err error)

GetRecords lists all the records in the zone.

func (*Provider) ListZones

func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)

ListZones lists all the zones in the account.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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