1// Copyright 2009 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package runner 6 7import "strconv" 8 9type alert uint8 10 11const ( 12 // alert level 13 alertLevelWarning = 1 14 alertLevelError = 2 15) 16 17const ( 18 alertCloseNotify alert = 0 19 alertEndOfEarlyData alert = 1 20 alertUnexpectedMessage alert = 10 21 alertBadRecordMAC alert = 20 22 alertDecryptionFailed alert = 21 23 alertRecordOverflow alert = 22 24 alertDecompressionFailure alert = 30 25 alertHandshakeFailure alert = 40 26 alertNoCertificate alert = 41 27 alertBadCertificate alert = 42 28 alertUnsupportedCertificate alert = 43 29 alertCertificateRevoked alert = 44 30 alertCertificateExpired alert = 45 31 alertCertificateUnknown alert = 46 32 alertIllegalParameter alert = 47 33 alertUnknownCA alert = 48 34 alertAccessDenied alert = 49 35 alertDecodeError alert = 50 36 alertDecryptError alert = 51 37 alertProtocolVersion alert = 70 38 alertInsufficientSecurity alert = 71 39 alertInternalError alert = 80 40 alertInappropriateFallback alert = 86 41 alertUserCanceled alert = 90 42 alertNoRenegotiation alert = 100 43 alertMissingExtension alert = 109 44 alertUnsupportedExtension alert = 110 45 alertUnrecognizedName alert = 112 46 alertBadCertificateStatusResponse alert = 113 47 alertUnknownPSKIdentity alert = 115 48 alertCertificateRequired alert = 116 49) 50 51var alertText = map[alert]string{ 52 alertCloseNotify: "close notify", 53 alertEndOfEarlyData: "end of early data", 54 alertUnexpectedMessage: "unexpected message", 55 alertBadRecordMAC: "bad record MAC", 56 alertDecryptionFailed: "decryption failed", 57 alertRecordOverflow: "record overflow", 58 alertDecompressionFailure: "decompression failure", 59 alertHandshakeFailure: "handshake failure", 60 alertNoCertificate: "no certificate", 61 alertBadCertificate: "bad certificate", 62 alertUnsupportedCertificate: "unsupported certificate", 63 alertCertificateRevoked: "revoked certificate", 64 alertCertificateExpired: "expired certificate", 65 alertCertificateUnknown: "unknown certificate", 66 alertIllegalParameter: "illegal parameter", 67 alertUnknownCA: "unknown certificate authority", 68 alertAccessDenied: "access denied", 69 alertDecodeError: "error decoding message", 70 alertDecryptError: "error decrypting message", 71 alertProtocolVersion: "protocol version not supported", 72 alertInsufficientSecurity: "insufficient security level", 73 alertInternalError: "internal error", 74 alertInappropriateFallback: "inappropriate fallback", 75 alertUserCanceled: "user canceled", 76 alertNoRenegotiation: "no renegotiation", 77 alertMissingExtension: "missing extension", 78 alertUnsupportedExtension: "unsupported extension", 79 alertBadCertificateStatusResponse: "bad certificate status response", 80 alertUnrecognizedName: "unrecognized name", 81 alertUnknownPSKIdentity: "unknown PSK identity", 82 alertCertificateRequired: "certificate required", 83} 84 85func (e alert) String() string { 86 s, ok := alertText[e] 87 if ok { 88 return s 89 } 90 return "alert(" + strconv.Itoa(int(e)) + ")" 91} 92 93func (e alert) Error() string { 94 return e.String() 95} 96