3// From go1.21 and onwards.
13func formatAlert(alert uint8) string {
14 s := fmt.Sprintf("alert-%d", alert)
15 err := tls.AlertError(alert) // Since go1.21.0
16 // crypto/tls returns messages like "tls: short message" or "tls: alert(321)".
17 if str := err.Error(); !strings.Contains(str, "alert(") {
18 s += "-" + strings.ReplaceAll(strings.TrimPrefix(str, "tls: "), " ", "-")