diff --git a/tools/network/cloudflare/createRecord.go b/tools/network/cloudflare/createRecord.go index efaa840575..d115e8b059 100644 --- a/tools/network/cloudflare/createRecord.go +++ b/tools/network/cloudflare/createRecord.go @@ -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"` @@ -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 diff --git a/tools/network/cloudflare/updateRecord.go b/tools/network/cloudflare/updateRecord.go index 269c48f11a..7ad2b188f1 100644 --- a/tools/network/cloudflare/updateRecord.go +++ b/tools/network/cloudflare/updateRecord.go @@ -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