code: func (network *network) hostnameToIP(rname string) net.IP {
  	var matchedIP net.IP
  
  	match := network.RegexMatchIP.FindStringSubmatch(rname)
  	if len(match) != 2 {
  		return nil
  	}
  
  	if network.IPnet.IP.To4() != nil {
  		matchedIP = net.ParseIP(match[1])
  	} else {
  		// TODO: can probably just allocate a []byte and use that.
  		var buf bytes.Buffer
  		// convert back to an valid ipv6 string with colons
  		for i := 0; i < 8*4; i += 4 {
  			buf.WriteString(match[1][i : i+4])
  			if i < 28 {
  				buf.WriteString(":")
  			}
  		}
  		matchedIP = net.ParseIP(buf.String())
  	}
  
  	// No valid ip or it does not belong to this network
  	if matchedIP == nil || !network.IPnet.Contains(matchedIP) {
  		return nil
  	}
  
  	return matchedIP
  }
docs: // hostnameToIP converts the hostname back to an ip, based on the template
  // returns nil if there is no IP found.