Browse Source

Merge pull request #1710 from lucas-clemente/proxy-remove-version

remove unneeded version parameter from proxy constructor
Marten Seemann 1 month ago
parent
commit
2cb72ad098

+ 1 - 1
integrationtests/self/drop_test.go

@@ -38,7 +38,7 @@ var _ = Describe("Drop Tests", func() {
 		)
 		Expect(err).ToNot(HaveOccurred())
 		serverPort := ln.Addr().(*net.UDPAddr).Port
-		proxy, err = quicproxy.NewQuicProxy("localhost:0", version, &quicproxy.Opts{
+		proxy, err = quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
 			RemoteAddr: fmt.Sprintf("localhost:%d", serverPort),
 			DelayPacket: func(dir quicproxy.Direction, packetCount uint64) time.Duration {
 				return 5 * time.Millisecond // 10ms RTT

+ 1 - 1
integrationtests/self/handshake_drop_test.go

@@ -41,7 +41,7 @@ var _ = Describe("Handshake drop tests", func() {
 		)
 		Expect(err).ToNot(HaveOccurred())
 		serverPort := ln.Addr().(*net.UDPAddr).Port
-		proxy, err = quicproxy.NewQuicProxy("localhost:0", version, &quicproxy.Opts{
+		proxy, err = quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
 			RemoteAddr: fmt.Sprintf("localhost:%d", serverPort),
 			DropPacket: dropCallback,
 		},

+ 1 - 1
integrationtests/self/handshake_rtt_test.go

@@ -43,7 +43,7 @@ var _ = Describe("Handshake RTT tests", func() {
 		server, err = quic.ListenAddr("localhost:0", testdata.GetTLSConfig(), serverConfig)
 		Expect(err).ToNot(HaveOccurred())
 		// start the proxy
-		proxy, err = quicproxy.NewQuicProxy("localhost:0", protocol.VersionWhatever, &quicproxy.Opts{
+		proxy, err = quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
 			RemoteAddr:  server.Addr().String(),
 			DelayPacket: func(_ quicproxy.Direction, _ uint64) time.Duration { return rtt / 2 },
 		})

+ 1 - 1
integrationtests/self/rtt_test.go

@@ -54,7 +54,7 @@ var _ = Describe("non-zero RTT", func() {
 						close(done)
 					}()
 					serverPort := ln.Addr().(*net.UDPAddr).Port
-					proxy, err := quicproxy.NewQuicProxy("localhost:0", version, &quicproxy.Opts{
+					proxy, err := quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
 						RemoteAddr: fmt.Sprintf("localhost:%d", serverPort),
 						DelayPacket: func(d quicproxy.Direction, p uint64) time.Duration {
 							return rtt / 2

+ 1 - 4
integrationtests/tools/proxy/proxy.go

@@ -85,8 +85,6 @@ type Opts struct {
 type QuicProxy struct {
 	mutex sync.Mutex
 
-	version protocol.VersionNumber
-
 	conn       *net.UDPConn
 	serverAddr *net.UDPAddr
 
@@ -100,7 +98,7 @@ type QuicProxy struct {
 }
 
 // NewQuicProxy creates a new UDP proxy
-func NewQuicProxy(local string, version protocol.VersionNumber, opts *Opts) (*QuicProxy, error) {
+func NewQuicProxy(local string, opts *Opts) (*QuicProxy, error) {
 	if opts == nil {
 		opts = &Opts{}
 	}
@@ -133,7 +131,6 @@ func NewQuicProxy(local string, version protocol.VersionNumber, opts *Opts) (*Qu
 		serverAddr:  raddr,
 		dropPacket:  packetDropper,
 		delayPacket: packetDelayer,
-		version:     version,
 		logger:      utils.DefaultLogger.WithPrefix("proxy"),
 	}
 

+ 5 - 5
integrationtests/tools/proxy/proxy_test.go

@@ -38,7 +38,7 @@ var _ = Describe("QUIC Proxy", func() {
 
 	Context("Proxy setup and teardown", func() {
 		It("sets up the UDPProxy", func() {
-			proxy, err := NewQuicProxy("localhost:0", protocol.VersionWhatever, nil)
+			proxy, err := NewQuicProxy("localhost:0", nil)
 			Expect(err).ToNot(HaveOccurred())
 			Expect(proxy.clientDict).To(HaveLen(0))
 
@@ -57,7 +57,7 @@ var _ = Describe("QUIC Proxy", func() {
 				return strings.Contains(b.String(), "proxy.(*QuicProxy).runProxy")
 			}
 
-			proxy, err := NewQuicProxy("localhost:0", protocol.VersionWhatever, nil)
+			proxy, err := NewQuicProxy("localhost:0", nil)
 			Expect(err).ToNot(HaveOccurred())
 			port := proxy.LocalPort()
 			Expect(isProxyRunning()).To(BeTrue())
@@ -92,7 +92,7 @@ var _ = Describe("QUIC Proxy", func() {
 			Expect(err).ToNot(HaveOccurred())
 			defer serverConn.Close()
 
-			proxy, err := NewQuicProxy("localhost:0", protocol.VersionWhatever, &Opts{RemoteAddr: serverConn.LocalAddr().String()})
+			proxy, err := NewQuicProxy("localhost:0", &Opts{RemoteAddr: serverConn.LocalAddr().String()})
 			Expect(err).ToNot(HaveOccurred())
 			Expect(isConnRunning()).To(BeFalse())
 
@@ -107,7 +107,7 @@ var _ = Describe("QUIC Proxy", func() {
 		})
 
 		It("has the correct LocalAddr and LocalPort", func() {
-			proxy, err := NewQuicProxy("localhost:0", protocol.VersionWhatever, nil)
+			proxy, err := NewQuicProxy("localhost:0", nil)
 			Expect(err).ToNot(HaveOccurred())
 
 			Expect(proxy.LocalAddr().String()).To(Equal("127.0.0.1:" + strconv.Itoa(proxy.LocalPort())))
@@ -128,7 +128,7 @@ var _ = Describe("QUIC Proxy", func() {
 
 		startProxy := func(opts *Opts) {
 			var err error
-			proxy, err = NewQuicProxy("localhost:0", protocol.VersionWhatever, opts)
+			proxy, err = NewQuicProxy("localhost:0", opts)
 			Expect(err).ToNot(HaveOccurred())
 			clientConn, err = net.DialUDP("udp", nil, proxy.LocalAddr().(*net.UDPAddr))
 			Expect(err).ToNot(HaveOccurred())