diff --git a/nsqd/buffer_pool_go13.go b/nsqd/buffer_pool.go similarity index 93% rename from nsqd/buffer_pool_go13.go rename to nsqd/buffer_pool.go index d2c4f6cc0..d47d06bf0 100644 --- a/nsqd/buffer_pool_go13.go +++ b/nsqd/buffer_pool.go @@ -1,5 +1,3 @@ -// +build go1.3 - package nsqd import ( diff --git a/nsqd/buffer_pool_go10.go b/nsqd/buffer_pool_go10.go deleted file mode 100644 index 2b50ee879..000000000 --- a/nsqd/buffer_pool_go10.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !go1.3 - -package nsqd - -import ( - "bytes" -) - -func bufferPoolGet() *bytes.Buffer { - return &bytes.Buffer{} -} - -func bufferPoolPut(b *bytes.Buffer) {} diff --git a/nsqd/client_tls_go10.go b/nsqd/client_tls_go10.go deleted file mode 100644 index 3a855ec61..000000000 --- a/nsqd/client_tls_go10.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !go1.3 - -package nsqd - -func (p *prettyConnectionState) GetVersion() string { - return "TLS1.0" -} diff --git a/nsqd/client_tls_go13.go b/nsqd/client_tls_go13.go deleted file mode 100644 index fa6823e65..000000000 --- a/nsqd/client_tls_go13.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build go1.3 - -package nsqd - -import ( - "crypto/tls" - "fmt" -) - -func (p *prettyConnectionState) GetVersion() string { - switch p.Version { - case tls.VersionSSL30: - return "SSL30" - case tls.VersionTLS10: - return "TLS1.0" - case tls.VersionTLS11: - return "TLS1.1" - case tls.VersionTLS12: - return "TLS1.2" - default: - return fmt.Sprintf("Unknown %d", p.Version) - } -} diff --git a/nsqd/client_v2.go b/nsqd/client_v2.go index 563f87b26..e53f17a73 100644 --- a/nsqd/client_v2.go +++ b/nsqd/client_v2.go @@ -267,54 +267,51 @@ type prettyConnectionState struct { tls.ConnectionState } -// taken from http://golang.org/src/pkg/crypto/tls/cipher_suites.go -// to be compatible with older versions -const ( - local_TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 - local_TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a - local_TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f - local_TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 - local_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007 - local_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009 - local_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a - local_TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 - local_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 - local_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 - local_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 - local_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f - local_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b -) - func (p *prettyConnectionState) GetCipherSuite() string { switch p.CipherSuite { - case local_TLS_RSA_WITH_RC4_128_SHA: + case tls.TLS_RSA_WITH_RC4_128_SHA: return "TLS_RSA_WITH_RC4_128_SHA" - case local_TLS_RSA_WITH_3DES_EDE_CBC_SHA: + case tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: return "TLS_RSA_WITH_3DES_EDE_CBC_SHA" - case local_TLS_RSA_WITH_AES_128_CBC_SHA: + case tls.TLS_RSA_WITH_AES_128_CBC_SHA: return "TLS_RSA_WITH_AES_128_CBC_SHA" - case local_TLS_RSA_WITH_AES_256_CBC_SHA: + case tls.TLS_RSA_WITH_AES_256_CBC_SHA: return "TLS_RSA_WITH_AES_256_CBC_SHA" - case local_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: + case tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: return "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" - case local_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: + case tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: return "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" - case local_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: + case tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: return "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" - case local_TLS_ECDHE_RSA_WITH_RC4_128_SHA: + case tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: return "TLS_ECDHE_RSA_WITH_RC4_128_SHA" - case local_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: + case tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: return "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" - case local_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: + case tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: return "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" - case local_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: + case tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: return "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" - case local_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: + case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: return "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" - case local_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: + case tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: return "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" } - return fmt.Sprintf("unkown %d", p.CipherSuite) + return fmt.Sprintf("Unknown %d", p.CipherSuite) +} + +func (p *prettyConnectionState) GetVersion() string { + switch p.Version { + case tls.VersionSSL30: + return "SSL30" + case tls.VersionTLS10: + return "TLS1.0" + case tls.VersionTLS11: + return "TLS1.1" + case tls.VersionTLS12: + return "TLS1.2" + default: + return fmt.Sprintf("Unknown %d", p.Version) + } } func (c *clientV2) IsReadyForMessages() bool {