mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
implement a more intuitive address validation API
This commit is contained in:
parent
556a6e2f99
commit
f2fa98c0dd
14 changed files with 352 additions and 437 deletions
|
@ -56,7 +56,7 @@ var _ = Describe("0-RTT", func() {
|
|||
tlsConf := getTLSConfig()
|
||||
if serverConf == nil {
|
||||
serverConf = getQuicConfig(&quic.Config{
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
})
|
||||
serverConf.Versions = []protocol.VersionNumber{version}
|
||||
}
|
||||
|
@ -197,9 +197,9 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -255,9 +255,9 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -452,8 +452,8 @@ var _ = Describe("0-RTT", func() {
|
|||
It("doesn't reject 0-RTT when the server's transport stream limit increased", func() {
|
||||
const maxStreams = 1
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(getQuicConfig(&quic.Config{
|
||||
MaxIncomingUniStreams: maxStreams,
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
MaxIncomingUniStreams: maxStreams,
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
}))
|
||||
|
||||
tracer := newPacketTracer()
|
||||
|
@ -461,10 +461,10 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
MaxIncomingUniStreams: maxStreams + 1,
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
MaxIncomingUniStreams: maxStreams + 1,
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -498,8 +498,8 @@ var _ = Describe("0-RTT", func() {
|
|||
It("rejects 0-RTT when the server's stream limit decreased", func() {
|
||||
const maxStreams = 42
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(getQuicConfig(&quic.Config{
|
||||
MaxIncomingStreams: maxStreams,
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
MaxIncomingStreams: maxStreams,
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
}))
|
||||
|
||||
tracer := newPacketTracer()
|
||||
|
@ -507,10 +507,10 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
MaxIncomingStreams: maxStreams - 1,
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
MaxIncomingStreams: maxStreams - 1,
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -537,9 +537,9 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -560,16 +560,16 @@ var _ = Describe("0-RTT", func() {
|
|||
func(addFlowControlLimit func(*quic.Config, uint64)) {
|
||||
tracer := newPacketTracer()
|
||||
firstConf := getQuicConfig(&quic.Config{
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
})
|
||||
addFlowControlLimit(firstConf, 3)
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(firstConf)
|
||||
|
||||
secondConf := getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
})
|
||||
addFlowControlLimit(secondConf, 100)
|
||||
ln, err := quic.ListenAddrEarly(
|
||||
|
@ -722,9 +722,9 @@ var _ = Describe("0-RTT", func() {
|
|||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
RequireAddressValidation: func(net.Addr) bool { return false },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue