Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: Fix Cloudflare SRV update utility after API change #6020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions tools/network/cloudflare/createRecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ type createDNSRecord struct {
// https://community.cloudflare.com/t/cloudflare-api-v4-srv-dns-creation-failure-in-php/25677/7
type createSRVRecord struct {
Type string `json:"type"`
Name string `json:"name"`
Data struct {
Name string `json:"name"`
TTL uint `json:"ttl"`
Service string `json:"service"`
Proto string `json:"proto"`
Weight uint `json:"weight"`
Port uint `json:"port"`
Priority uint `json:"priority"`
Expand Down Expand Up @@ -90,10 +88,8 @@ func createSRVRecordRequest(zoneID string, authToken string, name string, servic
requestJSON := createSRVRecord{
Type: "SRV",
}
requestJSON.Data.Name = name
requestJSON.Name = service + "." + protocol + "." + name
requestJSON.Data.TTL = ttl
requestJSON.Data.Service = service
requestJSON.Data.Proto = protocol
requestJSON.Data.Weight = weight
requestJSON.Data.Port = port
requestJSON.Data.Priority = priority
Expand Down
4 changes: 1 addition & 3 deletions tools/network/cloudflare/updateRecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ func updateSRVRecordRequest(zoneID string, authToken string, recordID string, na

requestJSON := createSRVRecord{
Type: "SRV",
Name: fmt.Sprintf("%s.%s.%s", service, protocol, name),
}
requestJSON.Data.Name = name
requestJSON.Data.TTL = ttl
requestJSON.Data.Service = service
requestJSON.Data.Proto = protocol
requestJSON.Data.Weight = weight
requestJSON.Data.Port = port
requestJSON.Data.Priority = priority
Expand Down
Loading