-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from orvice/feat/aliyun-dns
aliyun dns support
- Loading branch information
Showing
8 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# ddns | ||
|
||
support dns: | ||
* cloudflare | ||
Support dns: | ||
|
||
* cloudflare | ||
* aliyun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
package dns | ||
|
||
import ( | ||
"github.com/libdns/alidns" | ||
"github.com/libdns/cloudflare" | ||
"github.com/libdns/libdns" | ||
"github.com/orvice/ddns/internal/config" | ||
) | ||
|
||
type LibDNS interface { | ||
libdns.RecordGetter | ||
libdns.RecordAppender | ||
libdns.RecordSetter | ||
} | ||
|
||
func New(conf *config.Config) LibDNS { | ||
switch conf.DNSProvider { | ||
case "cloudflare": | ||
return NewCloudFlare() | ||
case "aliyun": | ||
return NewAliyun() | ||
} | ||
return nil | ||
} | ||
|
||
// cloudflare | ||
func NewCloudFlare() LibDNS { | ||
provider := cloudflare.Provider{APIToken: config.GetConfig().CFToken} | ||
return &provider | ||
} | ||
|
||
// aliyun | ||
func NewAliyun() LibDNS { | ||
provider := alidns.Provider{ | ||
AccKeyID: config.GetConfig().AliyunAccessKeyID, | ||
AccKeySecret: config.GetConfig().AliyunAccessKeySecret, | ||
} | ||
return &provider | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters