host.go
func (h Host) ToString() (out string) {
	out += fmt.Sprintf("%s is %s\n", h.Address, h.State)
	if len(h.Hostnames) != 0 {
		out += "Hostnames:\n"
		for _, hostname := range h.Hostnames {
			out += fmt.Sprintf("  %s/%s\n", hostname.Name, hostname.Type)
		}
	}
	if len(h.Ports) != 0 {
		out += "Ports:\n"
		for _, port := range h.Ports {
			for _, line := range strings.Split(port.ToString(), "\n") {
				if line != "" {
					out += fmt.Sprintf("  %s\n", line)
				}
			}
		}
	}
	return
}
func (h Host) ToString() (out string) {
	out += fmt.Sprintf("%s is %s\n", h.Address, h.State)
	if len(h.Hostnames) != 0 {
		out += "Hostnames:\n"
		for _, hostname := range h.Hostnames {
			out += fmt.Sprintf("  %s/%s\n", hostname.Name, hostname.Type)
		}
	}
	if len(h.Ports) != 0 {
		out += "Ports:\n"
		for _, port := range h.Ports {
			for _, line := range strings.Split(port.ToString(), "\n") {
				if line != "" {
					out += fmt.Sprintf("  %s\n", line)
				}
			}
		}
	}
	return
}
func ( h Host ) ToString ( ) ( out string ) { out += fmt . Sprintf ( " \n " , h . Address , h . State ) if len ( h . Hostnames ) != 0 { out += " \n " for _ , hostname := range h . Hostnames { out += fmt . Sprintf ( " \n " , hostname . Name , hostname . Type ) } } if len ( h . Ports ) != 0 { out += " \n " for _ , port := range h . Ports { for _ , line := range strings . Split ( port . ToString ( ) , " \n " ) { if line != " " { out += fmt . Sprintf ( " \n " , line ) } } } } return }
// ToString converts the host into a nicely formatted string
ToString converts the host into a nicely formatted string