func GetHostnameTls(data []byte) (string, error) {
	if len(data) == 0 || data[0] != 0x16 {
		return "", fmt.Errorf("Doesn't look like a TLS Client Hello")
	}

	extensions, err := GetExtensionBlock(data)
	if err != nil {
		return "", err
	}
	sn, err := GetSNBlock(extensions)
	if err != nil {
		return "", err
	}
	sni, err := GetSNIBlock(sn)
	if err != nil {
		return "", err
	}
	return string(sni), nil
}
/* This function is basically all most folks want to invoke out of this
 * jumble of bits. This will take an incoming TLS Client Hello (including
 * all the fuzzy bits at the beginning of it - fresh out of the socket) and
 * go ahead and give us the SNI Name they want. */
This function is basically all most folks want to invoke out of this
jumble of bits. This will take an incoming TLS Client Hello (including
all the fuzzy bits at the beginning of it - fresh out of the socket) and
go ahead and give us the SNI Name they want.
/ * This function is basically all most folks want to invoke out of this * jumble of bits . This will take an incoming TLS Client Hello ( including * all the fuzzy bits at the beginning of it - fresh out of the socket ) and * go ahead and give us the SNI Name they want . * /
func GetHostnameTls(data []byte) (string, error) {
	if len(data) == 0 || data[0] != 0x16 {
		return "", fmt.Errorf("Doesn't look like a TLS Client Hello")
	}
	extensions, err := GetExtensionBlock(data)
	if err != nil {
		return "", err
	}
	sn, err := GetSNBlock(extensions)
	if err != nil {
		return "", err
	}
	sni, err := GetSNIBlock(sn)
	if err != nil {
		return "", err
	}
	return string(sni), nil
}
func GetHostnameTls ( data [ ] byte ) ( string , error ) { if len ( data ) == 0 || data [ 0 ] != 0x16 { return " " , fmt . Errorf ( " " ) } extensions , err := GetExtensionBlock ( data ) if err != nil { return " " , err } sn , err := GetSNBlock ( extensions ) if err != nil { return " " , err } sni , err := GetSNIBlock ( sn ) if err != nil { return " " , err } return string ( sni ) , nil }
This function is basically all most folks want to invoke out of this
jumble of bits.
This function is basically all most folks want to invoke out of this jumble of bits .