{"id":13413602,"url":"https://github.com/joeig/go-powerdns","last_synced_at":"2026-01-02T16:19:36.466Z","repository":{"id":33970238,"uuid":"138224292","full_name":"joeig/go-powerdns","owner":"joeig","description":"PowerDNS API client for Go (community project)","archived":false,"fork":false,"pushed_at":"2025-04-07T14:32:05.000Z","size":261,"stargazers_count":93,"open_issues_count":3,"forks_count":30,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-12T23:37:56.425Z","etag":null,"topics":["go","powerdns"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/joeig/go-powerdns/v3","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joeig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-21T21:37:33.000Z","updated_at":"2025-03-15T18:15:46.000Z","dependencies_parsed_at":"2023-11-30T15:29:31.231Z","dependency_job_id":"aa328f9c-9d05-422a-ae6b-9442f587b798","html_url":"https://github.com/joeig/go-powerdns","commit_stats":{"total_commits":230,"total_committers":17,"mean_commits":"13.529411764705882","dds":0.4043478260869565,"last_synced_commit":"991821c851d48c5f13afa3138c6e5c1df911a5c7"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgo-powerdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgo-powerdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgo-powerdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgo-powerdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeig","download_url":"https://codeload.github.com/joeig/go-powerdns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647255,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","powerdns"],"created_at":"2024-07-30T20:01:44.226Z","updated_at":"2026-01-02T16:19:36.461Z","avatar_url":"https://github.com/joeig.png","language":"Go","funding_links":[],"categories":["Networking","网络","网络相关库","Relational Databases"],"sub_categories":["Transliteration","音译","Strings","Uncategorized","暂未分类","暂未分类这些库被放在这里是因为其他类别似乎都不适合。"],"readme":"# PowerDNS API client for Go (community project)\n\nThis community project provides an API client for PowerDNS Authoritative Server 4.x.\nIt's not associated with the official PowerDNS product itself.\n\n[![Test coverage](https://img.shields.io/badge/coverage-100%25-success)](https://github.com/joeig/go-powerdns/blob/main/.github/testcoverage.yml)\n[![CodeQL](https://github.com/joeig/go-powerdns/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/joeig/go-powerdns/actions/workflows/github-code-scanning/codeql)\n[![Go Report Card](https://goreportcard.com/badge/github.com/joeig/go-powerdns/v3)](https://goreportcard.com/report/github.com/joeig/go-powerdns/v3)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/joeig/go-powerdns/v3)](https://pkg.go.dev/github.com/joeig/go-powerdns/v3)\n\n## Features\n\nConveniently manage\n\n* [zones](https://github.com/joeig/go-powerdns?tab=readme-ov-file#getaddchangedelete-zones)\n* [resource records](https://github.com/joeig/go-powerdns?tab=readme-ov-file#addchangedelete-resource-records)\n* [cryptokeys](https://github.com/joeig/go-powerdns?tab=readme-ov-file#handle-dnssec-cryptographic-material) (DNSSEC)\n* [TSIG keys](https://github.com/joeig/go-powerdns?tab=readme-ov-file#createchangedelete-tsig-keys)\n* [servers](https://pkg.go.dev/github.com/joeig/go-powerdns/v3#ServersService)\n* [statistics](https://github.com/joeig/go-powerdns?tab=readme-ov-file#request-server-information-and-statistics)\n* [metadata](https://pkg.go.dev/github.com/joeig/go-powerdns/v3#MetadataService)\n* [configuration](https://pkg.go.dev/github.com/joeig/go-powerdns/v3#ConfigService)\n\nIt works entirely with the Go standard library and can easily be customized.[^1]\n\n[^1]: There is a dependency for `github.com/jarcoal/httpmock`, which is used by the test suite.\n\nFor more features, consult our [documentation](https://pkg.go.dev/github.com/joeig/go-powerdns/v3).\n\n## Setup\n\n```shell\ngo get -u github.com/joeig/go-powerdns/v3\n```\n\n```go\nimport \"github.com/joeig/go-powerdns/v3\"\n```\n\n## Usage\n\n### Initialize the handle\n\n```go\nimport (\n\t\"github.com/joeig/go-powerdns/v3\"\n\t\"context\"\n)\n\n// Let's say\n// * PowerDNS Authoritative Server is listening on `http://localhost:80`,\n// * the virtual host is `localhost` and\n// * the API key is `apipw`.\npdns := powerdns.New(\"http://localhost:80\", \"localhost\", powerdns.WithAPIKey(\"apipw\"))\n\n// All API interactions support a Go context, which allow you to pass cancellation signals and deadlines.\n// If you don't need a context, `context.Background()` would be the right choice for the following examples.\n// If you want to learn more about how context helps you to build reliable APIs, see: https://go.dev/blog/context\nctx := context.Background()\n```\n\n#### Migrate `NewClient` to `New`\n\nIf you have used `NewClient` before and want to migrate to `New`, please see the [release notes for v3.13.0](https://github.com/joeig/go-powerdns/releases/tag/v3.13.0).\n\n### Get/add/change/delete zones\n\n```go\nzones, err := pdns.Zones.List(ctx)\nzone, err := pdns.Zones.Get(ctx, \"example.com\")\nexport, err := pdns.Zones.Export(ctx, \"example.com\")\nzone, err := pdns.Zones.AddNative(ctx, \"example.com\", true, \"\", false, \"foo\", \"foo\", true, []string{\"ns.foo.tld.\"})\nerr := pdns.Zones.Change(ctx, \"example.com\", \u0026zone)\nerr := pdns.Zones.Delete(ctx, \"example.com\")\n```\n\n### Add/change/delete resource records\n\n```go\nerr := pdns.Records.Add(ctx, \"example.com\", \"www.example.com\", powerdns.RRTypeAAAA, 60, []string{\"::1\"})\nerr := pdns.Records.Change(ctx, \"example.com\", \"www.example.com\", powerdns.RRTypeAAAA, 3600, []string{\"::1\"})\nerr := pdns.Records.Delete(ctx, \"example.com\", \"www.example.com\", powerdns.RRTypeA)\nrecords, err := pdns.Records.Get(ctx, \"example.com\", \"www.example.com\", powerdns.RRTypePtr(powerdns.RRTypeA))\n```\n\n### Request server information and statistics\n\n```go\nstatistics, err := pdns.Statistics.List(ctx)\nservers, err := pdns.Servers.List(ctx)\nserver, err := pdns.Servers.Get(ctx, \"localhost\")\n```\n\n### Handle DNSSEC cryptographic material\n\n```go\ncryptokeys, err := pdns.Cryptokeys.List(ctx)\ncryptokey, err := pdns.Cryptokeys.Get(ctx, \"example.com\", \"1337\")\nerr := pdns.Cryptokeys.Delete(ctx, \"example.com\", \"1337\")\n```\n\n### Create/change/delete TSIG keys\n\n```go\ntsigkey, err := pdns.TSIGKeys.Create(ctx, \"examplekey\", \"hmac-sha256\", \"\")\ntsigkey, err := pdns.TSIGKeys.Change(ctx, \"examplekey.\", powerdns.TSIGKey{Key: powerdns.String(\"newkey\")})\ntsigkeys, err := pdns.TSIGKeys.List(ctx)\ntsigkey, err := pdns.TSIGKeys.Get(ctx, \"examplekey.\")\nerr := pdns.TSIGKeys.Delete(ctx, \"examplekey.\")\n```\n\n### More examples\n\nThere are several examples on [pkg.go.dev](https://pkg.go.dev/github.com/joeig/go-powerdns/v3#pkg-examples).\n\n### Documentation\n\nSee [pkg.go.dev](https://pkg.go.dev/github.com/joeig/go-powerdns/v3) for a full reference.\n\n## Setup\n\n### Requirements\n\n#### Tested PowerDNS versions\n\nSupported versions of PowerDNS Authoritative Server (\"API v1\"):\n\n* 4.8\n* 4.9\n* 5.0\n\nVersion 4.1, 4.2 and 4.3 are probably working fine, but are officially [end-of-life](https://repo.powerdns.com/).\nBe aware that there are breaking changes in \"API v1\" between PowerDNS 3.x, 4.0 and 4.1.\n\n#### Tested Go versions\n\nIn accordance with [Go's version support policy](https://golang.org/doc/devel/release.html#policy), this module is being tested with the following Go releases:\n\n* 1.24\n* 1.25\n\n## Contribution\n\nThis API client has not been completed yet, so feel free to contribute.\nThe [OpenAPI specification](https://github.com/PowerDNS/pdns/blob/master/docs/http-api/swagger/authoritative-api-swagger.yaml) is a good reference.\n\nYou can use Docker Compose to launch a PowerDNS authoritative server including a generic SQLite3 backend, DNSSEC support and some optional fixtures:\n\n```bash\ndocker-compose -f docker-compose-v4.9.yml up\ndocker-compose -f docker-compose-v4.9.yml exec powerdns sh init_docker_fixtures.sh\n```\n\nIt's also possible to target mocks against this server, or any other PowerDNS instance which is running on `http://localhost:8080`.\n\n```bash\nmake test-without-mocks\n```\n\nThe mocks assume there is a vHost/Server ID called `localhost` and API key `apipw`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgo-powerdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeig%2Fgo-powerdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgo-powerdns/lists"}