use a prefix to distinguish IPs and net.Addrs in source address tokens

This commit is contained in:
Marten Seemann 2017-05-24 01:04:19 +08:00
parent 87df63dd5f
commit afc9b11715
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
2 changed files with 13 additions and 13 deletions

View file

@ -173,8 +173,6 @@ var _ = Describe("Server Crypto Setup", func() {
BeforeEach(func() {
var err error
remoteAddr := &net.UDPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 1234}
validSTK, err = mockStkSource{}.NewToken(remoteAddr.IP)
Expect(err).NotTo(HaveOccurred())
expectedInitialNonceLen = 32
expectedFSNonceLen = 64
aeadChanged = make(chan protocol.EncryptionLevel, 2)
@ -206,6 +204,8 @@ var _ = Describe("Server Crypto Setup", func() {
Expect(err).NotTo(HaveOccurred())
cs = csInt.(*cryptoSetupServer)
cs.stkGenerator.stkSource = &mockStkSource{}
validSTK, err = cs.stkGenerator.NewToken(remoteAddr)
Expect(err).NotTo(HaveOccurred())
sourceAddrValid = true
cs.acceptSTKCallback = func(_ net.Addr, _ *STK) bool { return sourceAddrValid }
cs.keyDerivation = mockKeyDerivation