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 alertUnexpectedMessage alert = 10 20 alertBadRecordMAC alert = 20 21 alertDecryptionFailed alert = 21 22 alertRecordOverflow alert = 22 23 alertDecompressionFailure alert = 30 24 alertHandshakeFailure alert = 40 25 alertNoCertificate alert = 41 26 alertBadCertificate alert = 42 27 alertUnsupportedCertificate alert = 43 28 alertCertificateRevoked alert = 44 29 alertCertificateExpired alert = 45 30 alertCertificateUnknown alert = 46 31 alertIllegalParameter alert = 47 32 alertUnknownCA alert = 48 33 alertAccessDenied alert = 49 34 alertDecodeError alert = 50 35 alertDecryptError alert = 51 36 alertProtocolVersion alert = 70 37 alertInsufficientSecurity alert = 71 38 alertInternalError alert = 80 39 alertInappropriateFallback alert = 86 40 alertUserCanceled alert = 90 41 alertNoRenegotiation alert = 100 42 alertMissingExtension alert = 109 43 alertUnsupportedExtension alert = 110 44 alertUnrecognizedName alert = 112 45 alertBadCertificateStatusResponse alert = 113 46 alertUnknownPSKIdentity alert = 115 47 alertCertificateRequired alert = 116 48 alertNoApplicationProtocol alert = 120 49) 50 51var alertText = map[alert]string{ 52 alertCloseNotify: "close notify", 53 alertUnexpectedMessage: "unexpected message", 54 alertBadRecordMAC: "bad record MAC", 55 alertDecryptionFailed: "decryption failed", 56 alertRecordOverflow: "record overflow", 57 alertDecompressionFailure: "decompression failure", 58 alertHandshakeFailure: "handshake failure", 59 alertNoCertificate: "no certificate", 60 alertBadCertificate: "bad certificate", 61 alertUnsupportedCertificate: "unsupported certificate", 62 alertCertificateRevoked: "revoked certificate", 63 alertCertificateExpired: "expired certificate", 64 alertCertificateUnknown: "unknown certificate", 65 alertIllegalParameter: "illegal parameter", 66 alertUnknownCA: "unknown certificate authority", 67 alertAccessDenied: "access denied", 68 alertDecodeError: "error decoding message", 69 alertDecryptError: "error decrypting message", 70 alertProtocolVersion: "protocol version not supported", 71 alertInsufficientSecurity: "insufficient security level", 72 alertInternalError: "internal error", 73 alertInappropriateFallback: "inappropriate fallback", 74 alertUserCanceled: "user canceled", 75 alertNoRenegotiation: "no renegotiation", 76 alertMissingExtension: "missing extension", 77 alertUnsupportedExtension: "unsupported extension", 78 alertBadCertificateStatusResponse: "bad certificate status response", 79 alertUnrecognizedName: "unrecognized name", 80 alertUnknownPSKIdentity: "unknown PSK identity", 81 alertCertificateRequired: "certificate required", 82 alertNoApplicationProtocol: "no application protocol", 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