func reversedLabelsToIPv6(labels []string) net.IP {
	var buf strings.Builder

	// If there aren't the right number of labels, it isn't an IPv6 address.
	if len(labels) != rdnsIPv6Labels {
		return nil
	}

	// An IPv6 address is represented as eight groups of two bytes separated
	// by `:` in hex form. Since each label in the rDNS form is one nibble we need
	// four label components per IPv6 address component group.
	for i := len(labels) - 1; i >= 0; i -= 4 {
		buf.WriteString(labels[i])
		buf.WriteString(labels[i-1])
		buf.WriteString(labels[i-2])
		buf.WriteString(labels[i-3])
		if i > 4 {
			buf.WriteString(":")
		}
	}
	return net.ParseIP(buf.String())
}
func reversedLabelsToIPv6(labels []string) net.IP {
	var buf strings.Builder

	
	if len(labels) != rdnsIPv6Labels {
		return nil
	}

	
	
	
	for i := len(labels) - 1; i >= 0; i -= 4 {
		buf.WriteString(labels[i])
		buf.WriteString(labels[i-1])
		buf.WriteString(labels[i-2])
		buf.WriteString(labels[i-3])
		if i > 4 {
			buf.WriteString(":")
		}
	}
	return net.ParseIP(buf.String())
}
func reversedLabelsToIPv6 ( labels [ ] string ) net . IP { var buf strings . Builder // If there aren't the right number of labels, it isn't an IPv6 address. if len ( labels ) != rdnsIPv6Labels { return nil } // An IPv6 address is represented as eight groups of two bytes separated // by `:` in hex form. Since each label in the rDNS form is one nibble we need // four label components per IPv6 address component group. for i := len ( labels ) - 1 ; i >= 0 ; i -= 4 { buf . WriteString ( labels [ i ] ) buf . WriteString ( labels [ i - 1 ] ) buf . WriteString ( labels [ i - 2 ] ) buf . WriteString ( labels [ i - 3 ] ) if i > 4 { buf . WriteString ( " " ) } } return net . ParseIP ( buf . String ( ) ) }
// reversedLabelsToIPv6 reverses the provided labels (assumed to be 32 labels,
// one per nibble of an IPv6 address) and constructs an IPv6 address, returning
// the result of calling net.ParseIP for the constructed address.
reversedLabelsToIPv6 reverses the provided labels ( assumed to be 32 labels one per nibble of an IPv6 address ) and constructs an IPv6 address returning the result of calling net . ParseIP for the constructed address .