mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
remove unneeded version parameter from proxy constructor
This commit is contained in:
parent
8ac77be934
commit
2367ab35bb
6 changed files with 10 additions and 13 deletions
|
@ -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"),
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue