timeweb

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 9 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Timeweb DNS for libdns

Go Reference

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

Authorize

To authorize you need to use Timeweb Authorization.

Example

Minimal working example of getting DNS zone records.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/libdns/libdns/timeweb-libdns"
)

func main() {

	provider = timeweb.Provider{
		ApiURL:   os.Getenv("TIMEWEB_URL"),
		ApiToken: os.Getenv("TIMEWEB_API_TOKEN"),
	}
	zone = os.Getenv("TIMEWEB_ZONE")
	ctx = context.Background()

	records, err := provider.GetRecords(ctx, zone)
	if err != nil {
		fmt.Printf("Error: %s", err)
		return
	}

	fmt.Println(records)
}

Always yours @Riskful

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainResponse added in v1.1.1

type DomainResponse struct {
	ID   uint   `json:"id"`
	FQDN string `json:"fqdn"`
}

type DomainsResponse added in v1.1.1

type DomainsResponse struct {
	Meta struct {
		Total int `json:"total"`
	} `json:"meta"`
	Domains []DomainResponse `json:"domains"`
}

type Provider

type Provider struct {
	ApiURL   string
	ApiToken string
}

func (*Provider) AppendRecords

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

func (*Provider) DeleteRecords

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

func (*Provider) GetRecords

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

func (*Provider) ListZones added in v1.1.1

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

func (*Provider) SetRecords

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

type RecordResponse

type RecordResponse struct {
	ID   uint   `json:"id"`
	Type string `json:"type"`
	Data struct {
		Value     string `json:"value"`
		Subdomain string `json:"subdomain"`
		Priority  uint   `json:"priority,omitempty"`
	} `json:"data"`
	TTL uint `json:"ttl"`
}

type RecordsResponse

type RecordsResponse struct {
	Meta struct {
		Total int `json:"total"`
	} `json:"meta"`
	DNSRecords []RecordResponse `json:"user_records,omitempty"`
}

type SavedRecord

type SavedRecord struct {
	DNSRecord RecordResponse `json:"dns_record"`
}

type TimewebRecord added in v1.1.1

type TimewebRecord struct {
	Subdomain string `json:"subdomain,omitempty"`
	Type      string `json:"type"`
	TTL       uint   `json:"ttl,omitempty"`
	Value     string `json:"value"`
	Priority  uint   `json:"priority,omitempty"` // MX priority
}

Jump to

Keyboard shortcuts

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