1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

REFACTOR: Add Joined and Segmented accessors to TXT, and other cleanups (#2628)

This commit is contained in:
Tom Limoncelli
2023-11-18 10:37:46 -05:00
committed by GitHub
parent 32fe2753d8
commit 8040e7bba2
10 changed files with 31 additions and 114 deletions

View File

@@ -17,6 +17,11 @@ func SplitSingleLongTxt(records []*models.RecordConfig) {
}
}
// Segment returns the string as 255-octet segments, the last being the remainder.
func Segment(s string) []string {
return splitChunks(s, 255)
}
func splitChunks(buf string, lim int) []string {
var chunk string
chunks := make([]string, 0, len(buf)/lim+1)