Skip to content

Commit 3440753

Browse files
committed
feat: add new provider - Porkbun
1 parent 3bdc80a commit 3440753

File tree

6 files changed

+379
-0
lines changed

6 files changed

+379
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
- [Infomaniak](#infomaniak)
5555
- [Hetzner](#hetzner)
5656
- [OVH](#ovh)
57+
- [Porkbun](#porkbun)
5758
- [Dynu](#dynu)
5859
- [IONOS](#ionos)
5960
- [TransIP](#transip)
@@ -113,6 +114,7 @@
113114
| [Infomaniak][infomaniak] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
114115
| [Hetzner][hetzner] | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
115116
| [OVH][ovh] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
117+
| [Porkbun][porkbun] | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
116118
| [Dynu][dynu] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
117119
| [IONOS][ionos] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
118120
| [TransIP][transip] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
@@ -134,6 +136,7 @@
134136
[infomaniak]: https://www.infomaniak.com/
135137
[hetzner]: https://hetzner.com/
136138
[ovh]: https://www.ovh.com
139+
[porkbun]: https://porkbun.com/
137140
[dynu]: https://www.dynu.com/
138141
[ionos]: https://www.ionos.com/
139142
[transip]: https://www.transip.net/
@@ -825,6 +828,32 @@ More info: [help.ovhcloud.com](https://help.ovhcloud.com/csm/en-gb-api-getting-s
825828

826829
</details>
827830

831+
#### Porkbun
832+
For Porkbun, you need to provide your API key as `login_token` and secret key as `password`.
833+
Get your API credentials from [Porkbun API Management](https://porkbun.com/account/api).
834+
835+
<details>
836+
<summary>Example</summary>
837+
838+
```json
839+
{
840+
"provider": "Porkbun",
841+
"login_token": "pk1_your_api_key",
842+
"password": "sk1_your_secret_key",
843+
"domains": [
844+
{
845+
"domain_name": "example.com",
846+
"sub_domains": ["@", "www", "test"]
847+
}
848+
],
849+
"resolver": "8.8.8.8",
850+
"ip_urls": ["https://api.ipify.org"],
851+
"ip_type": "IPv4",
852+
"interval": 300
853+
}
854+
```
855+
</details>
856+
828857
#### Dynu
829858

830859
For Dynu, you need to configure the `password`, config 1 default domain & subdomain.

README_CN.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
- [Infomaniak](#infomaniak)
5353
- [Hetzner](#hetzner)
5454
- [OVH](#ovh)
55+
- [Porkbun](#porkbun)
5556
- [Dynu](#dynu)
5657
- [IONOS](#ionos)
5758
- [TransIP](#transip)
@@ -111,6 +112,7 @@
111112
| [Infomaniak][infomaniak] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
112113
| [Hetzner][hetzner] | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
113114
| [OVH][ovh] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
115+
| [Porkbun][porkbun] | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
114116
| [Dynu][dynu] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
115117
| [IONOS][ionos] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
116118
| [TransIP][transip] | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: |
@@ -132,6 +134,7 @@
132134
[infomaniak]: https://www.infomaniak.com/
133135
[hetzner]: https://hetzner.com/
134136
[ovh]: https://www.ovh.com
137+
[porkbun]: https://porkbun.com/
135138
[dynu]: https://www.dynu.com/
136139
[ionos]: https://www.ionos.com/
137140
[transip]: https://www.transip.net/
@@ -823,6 +826,32 @@ GoDNS Linode 处理程序目前对 Linode DNS 记录使用固定的 30 秒 TTL
823826

824827
</details>
825828

829+
#### Porkbun
830+
对于 Porkbun,您需要提供 API 密钥作为 `login_token` 和秘密密钥作为 `password`
831+
[Porkbun API 管理](https://porkbun.com/account/api) 获取您的 API 凭据。
832+
833+
<details>
834+
<summary>示例</summary>
835+
836+
```json
837+
{
838+
"provider": "Porkbun",
839+
"login_token": "pk1_your_api_key",
840+
"password": "sk1_your_secret_key",
841+
"domains": [
842+
{
843+
"domain_name": "example.com",
844+
"sub_domains": ["@", "www", "test"]
845+
}
846+
],
847+
"resolver": "8.8.8.8",
848+
"ip_urls": ["https://api.ipify.org"],
849+
"ip_type": "IPv4",
850+
"interval": 300
851+
}
852+
```
853+
</details>
854+
826855
#### Dynu
827856

828857
对于 Dynu,您需要配置 `password`,配置 1 个默认域名和子域名。

internal/provider/factory.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/TimothyYe/godns/internal/provider/loopiase"
2121
"github.com/TimothyYe/godns/internal/provider/noip"
2222
"github.com/TimothyYe/godns/internal/provider/ovh"
23+
"github.com/TimothyYe/godns/internal/provider/porkbun"
2324
"github.com/TimothyYe/godns/internal/provider/scaleway"
2425
"github.com/TimothyYe/godns/internal/provider/strato"
2526
"github.com/TimothyYe/godns/internal/provider/transip"
@@ -144,6 +145,8 @@ func createProvider(providerName string, conf *settings.Settings) (IDNSProvider,
144145
provider = &ionos.DNSProvider{}
145146
case utils.TRANSIP:
146147
provider = &transip.DNSProvider{}
148+
case utils.PORKBUN:
149+
provider = &porkbun.DNSProvider{}
147150
default:
148151
return nil, fmt.Errorf("unknown provider '%s'", providerName)
149152
}

0 commit comments

Comments
 (0)