dnscontrol
dnscontrol copied to clipboard
CLOUDFLAREAPI: Enable CanUseLOC
Enables LOC records with the Cloudflare provider for #2798.
Draft PR as this currently doesn't work.
Some advice: Update createRecDiff2()
in rest.go
to include LOC records. Create a function called cfLocData()
similar to how SRV records are handled.
CC @systemcrash
I've done some research and now I think I can give a (hopefully!) more useful recommendation.
Rather than derive those fields and store them in RecordConfig, those fields should be derived "on demand" when needed. That is, the cloudflare createRecDiff2() function should generate those additional fields.
This would have a few benefits:
- It doesn't increase the memory size of RecordConfig.
- It better supports other providers, who may have a different set of fields they need.
- It maintains the ideal that RecordConfig is the desired state, and each provider does what's needed for their native implementation. For example, TXT records are stored as one big string. If a provider wants them as 255-octet chunks, it's their responsibility to do the chunking and un-chunking behind the scenes. This converstion is usually done in functions with names like toNative() and toRC(). In Cloudflare's case, the conversion isn't isolated but it part of createRecDiff2() and other functions.
- This won't require additional CPU, and might require less CPU since the conversion will only be done if an LOC record changes.
- If there are helper functions that will be useful to many providers, put them in t_loc.go.
Hope that helps, Tom