package upgrade // StatusCode maps the status codes (and description) type StatusCode uint16 const ( // SwitchingProtocols - handshake success SwitchingProtocols StatusCode = 101 // BadRequest - missing/malformed headers BadRequest StatusCode = 400 // Forbidden - invalid origin policy, TLS required Forbidden StatusCode = 403 // UpgradeRequired - invalid WS version UpgradeRequired StatusCode = 426 // NotFound - unserved or invalid URI NotFound StatusCode = 404 // Internal - custom error Internal StatusCode = 500 ) // String implements the Stringer interface func (sc StatusCode) String() string { switch sc { case SwitchingProtocols: return "Switching Protocols" case BadRequest: return "Bad Request" case Forbidden: return "Forbidden" case UpgradeRequired: return "Upgrade Required" case NotFound: return "Not Found" case Internal: return "Internal Server Error" default: return "Unknown Status Code" } }