diff --git a/client.go b/client.go index 2525a97d..b31c6708 100644 --- a/client.go +++ b/client.go @@ -30,8 +30,6 @@ type client struct { session packetHandler } -var errHostname = errors.New("Invalid hostname") - var ( errCloseSessionForNewVersion = errors.New("closing session in order to recreate it with a new version") ) diff --git a/congestion/bandwidth.go b/congestion/bandwidth.go index 2c7ff238..e76ea161 100644 --- a/congestion/bandwidth.go +++ b/congestion/bandwidth.go @@ -12,12 +12,8 @@ type Bandwidth uint64 const ( // BitsPerSecond is 1 bit per second BitsPerSecond Bandwidth = 1 - // KBitsPerSecond is 1000 bits per second - KBitsPerSecond = 1000 * BitsPerSecond // BytesPerSecond is 1 byte per second BytesPerSecond = 8 * BitsPerSecond - // KBytesPerSecond is 1000 bytes per second - KBytesPerSecond = 1000 * BytesPerSecond ) // BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta diff --git a/handshake/connection_parameters_manager.go b/handshake/connection_parameters_manager.go index 89e13516..fc712185 100644 --- a/handshake/connection_parameters_manager.go +++ b/handshake/connection_parameters_manager.go @@ -2,7 +2,6 @@ package handshake import ( "bytes" - "errors" "sync" "time" @@ -55,8 +54,6 @@ type connectionParametersManager struct { var _ ConnectionParametersManager = &connectionParametersManager{} -var errTagNotInConnectionParameterMap = errors.New("ConnectionParametersManager: Tag not found in ConnectionsParameter map") - // ErrMalformedTag is returned when the tag value cannot be read var ( ErrMalformedTag = qerr.Error(qerr.InvalidCryptoMessageParameter, "malformed Tag value") diff --git a/handshake/crypto_setup_client_test.go b/handshake/crypto_setup_client_test.go index cbee71d9..1d16700c 100644 --- a/handshake/crypto_setup_client_test.go +++ b/handshake/crypto_setup_client_test.go @@ -2,14 +2,9 @@ package handshake import ( "bytes" - "crypto/ecdsa" - "crypto/rsa" - "crypto/x509" "encoding/binary" - "encoding/pem" "errors" "fmt" - "os" "time" "github.com/lucas-clemente/quic-go/crypto" @@ -20,27 +15,6 @@ import ( . "github.com/onsi/gomega" ) -// taken from https://golang.org/src/crypto/tls/generate_cert.go -func pemBlockForKey(priv interface{}) *pem.Block { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)} - case *ecdsa.PrivateKey: - b, err := x509.MarshalECPrivateKey(k) - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to marshal ECDSA private key: %v", err) - os.Exit(2) - } - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} - default: - return nil - } -} - -func pemBlockForCert(certDER []byte) *pem.Block { - return &pem.Block{Type: "CERTIFICATE", Bytes: certDER} -} - type keyDerivationValues struct { forwardSecure bool sharedSecret []byte diff --git a/handshake/crypto_setup_server_test.go b/handshake/crypto_setup_server_test.go index 736efe1d..11a44f52 100644 --- a/handshake/crypto_setup_server_test.go +++ b/handshake/crypto_setup_server_test.go @@ -81,8 +81,6 @@ func (m *mockAEAD) Open(dst, src []byte, packetNumber protocol.PacketNumber, ass return nil, errors.New("authentication failed") } -func (mockAEAD) DiversificationNonce() []byte { return nil } - var expectedInitialNonceLen int var expectedFSNonceLen int diff --git a/packet_packer_test.go b/packet_packer_test.go index e7081b7d..4d1c6df8 100644 --- a/packet_packer_test.go +++ b/packet_packer_test.go @@ -33,8 +33,6 @@ func (m *mockCryptoSetup) GetSealerWithEncryptionLevel(protocol.EncryptionLevel) return append(src, bytes.Repeat([]byte{0}, 12)...) }, nil } -func (m *mockCryptoSetup) LockForSealing() {} -func (m *mockCryptoSetup) UnlockForSealing() {} func (m *mockCryptoSetup) HandshakeComplete() bool { return m.handshakeComplete } func (m *mockCryptoSetup) DiversificationNonce() []byte { return m.divNonce diff --git a/protocol/protocol.go b/protocol/protocol.go index a7a82d79..e250881f 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -33,9 +33,6 @@ type ByteCount uint64 // MaxByteCount is the maximum value of a ByteCount const MaxByteCount = math.MaxUint64 -// CryptoStreamID is the ID of the crypto stream -const CryptoStreamID StreamID = 1 - // MaxReceivePacketSize maximum packet size of any QUIC packet, based on // ethernet's max size, minus the IP and UDP headers. IPv6 has a 40 byte header, // UDP adds an additional 8 bytes. This is a total overhead of 48 bytes. diff --git a/server.go b/server.go index 7f91c1a7..af4b7e6b 100644 --- a/server.go +++ b/server.go @@ -25,8 +25,7 @@ type packetHandler interface { type server struct { config *Config - conn net.PacketConn - connMutex sync.Mutex + conn net.PacketConn certChain crypto.CertChain scfg *handshake.ServerConfig diff --git a/streams_map.go b/streams_map.go index 0b9f1453..c2fa76b4 100644 --- a/streams_map.go +++ b/streams_map.go @@ -31,9 +31,7 @@ type streamsMap struct { newStream newStreamLambda - maxOutgoingStreams uint32 numOutgoingStreams uint32 - maxIncomingStreams uint32 numIncomingStreams uint32 }