Matthias Radestock
0b7d462adf
enforce a message size limit
...
so we do not allocate loads of memory when receiving (accidental or
deliberate) garbage
2015-07-20 23:51:04 +01:00
Matthias Radestock
6f8622a1a0
replace outermost framing on tcp connection
...
switch from gob to length-prefix encoding
2015-07-20 23:51:04 +01:00
Matthias Radestock
af049efb40
refactor: s/SimpleTCP{Sender,Receiver}/GobTCP{Sender,Receiver}
2015-07-20 23:51:02 +01:00
Matthias Radestock
ad4e4ce6b8
refactor: make 'inner' encoder/decoder explicit
2015-07-20 23:50:10 +01:00
Matthias Radestock
aaba681db1
remove dead code
2015-07-11 01:54:37 +01:00
David Wragg
a6a74001bd
Make TCPReceiver more closely mirror TCPSender
2015-07-08 08:53:53 +01:00
Alvaro Saurin
f6ffd604dd
Removed all the imports from "code.google.com"
2015-07-02 13:32:52 +02:00
Paul Bellamy
06101d134b
Running goimports
2015-06-17 15:32:08 +01:00
Adam Harrison
9149366919
Set high bit in TCP nonce to differentiate from UDP
2015-06-16 12:21:18 +01:00
Matthias Radestock
137776bcb2
remove decryptor shutdown
...
we only needed it because of the nonce channels
2015-04-30 14:47:16 +01:00
Matthias Radestock
e223899982
remove nonce transmission from protocol
2015-04-30 14:47:16 +01:00
Matthias Radestock
b365c3806b
replace random nonces with message sequence numbers in udp crypto
2015-04-30 14:47:16 +01:00
Matthias Radestock
696bfe464c
replace random nonces with message sequence numbers in tcp crypto
...
Since TCP is reliable, we do not need to transmit the nonce itself;
the recipient can simply construct the nonce from its own message
counter. Hence there is no message envelope and we can thus remove a
whole layer of encoding.
2015-04-30 14:47:16 +01:00
Matthias Radestock
e45ea65e45
tiny simplifying refactor
2015-04-27 15:51:25 +01:00
Matthias Radestock
b74348e59d
d'oh
2015-04-27 08:58:02 +01:00
Matthias Radestock
ce03f27044
refactor: use 'copy' instead of for loop for slice->array copy
2015-04-27 07:42:52 +01:00
Matthias Radestock
1de86f4312
cosmetic
2015-04-27 07:30:17 +01:00
Matthias Radestock
02a7875eb8
refactor: remove last dependency of crypto on LocalConnection
2015-04-27 07:27:31 +01:00
Matthias Radestock
ea4e84cdd3
refactor: (almost) remove dependency of crypto on LocalConnection
2015-04-27 07:14:30 +01:00
Matthias Radestock
29c02d2724
refactor: lift error handling out of Encryptor.Bytes()
...
in order to reduce dependency on LocalConnection
2015-04-27 07:12:21 +01:00
Matthias Radestock
fcd44c37e1
refactor: reduce coupling between connections and crypto
2015-04-27 06:13:41 +01:00
Matthias Radestock
ff49bb5125
document why we carry the DF flag in payload
2015-04-25 12:36:05 +01:00
Matthias Radestock
d82f60f18b
cosmetic
2015-04-25 12:06:20 +01:00
Matthias Radestock
d15575212a
refactor: no need to record 'df' in two places in state
2015-04-25 12:05:17 +01:00
Matthias Radestock
a5a91ebb33
do not shut down connections on PacketDecodingError
2015-04-15 21:52:56 +01:00
Matthias Radestock
502b59c703
refactor: rename
2015-03-28 19:52:10 +00:00
Matthias Radestock
9a462f9d87
refactor: simplify NewNaClEncryptor
...
- rely on default nil values on initialisation
- inline
2015-03-28 19:49:01 +00:00
Matthias Radestock
9992992ee4
refactor: extract helper from NaClDecryptor.decrypt
...
for easier comprehension
2015-03-28 19:44:04 +00:00
David Wragg
78c70023d8
Don't pass the sender UDPAddr through the crypto layer
...
The crypto layer doesn't need it, and the cost of an additional
closure allocation for each incoming UDP packet is modest.
Also, make the FrameConsumer the last parameter to IterateFrames.
It seems a more natural ordering.
2015-03-27 18:05:00 +00:00
David Wragg
0d30df165f
Eliminate UDPPacket
...
The Name field is not used anywhere, and once that's gone the remaining
pairing of the packet bytes and sender is not worth it.
2015-03-27 18:05:00 +00:00
David Wragg
4a1d3aeb96
Remove frameLen parameter to FrameConsumer
...
It's the same as len(frame)
2015-03-27 18:05:00 +00:00
David Wragg
bc45a363dd
Make Encryptor.AppendFrame more consistent with FrameConsumer
...
Also removes references to Peer type in crypto.go, to keep it agnostic
of higher-level concerns.
2015-03-27 18:05:00 +00:00
Matthias Radestock
e3ef5433cf
cosmetic: linting
2015-03-27 00:43:26 +00:00
David Wragg
5b66daf1e4
Remove some layers of indirection around FrameTooBigError handling
2015-03-05 15:13:30 +00:00
David Wragg
619ebc20a8
Don't pass password around as a pointer to a slice
...
A slice can be nil, so there is no reason for extra indirection to
represent the lack of a password.
2015-03-05 14:19:54 +00:00
Matthias Radestock
99525ebf85
refactor: LocalConnection.CheckFatal be gone!
...
use Shutdown instead, which is in the Connection interface, thus
further reducing dependency on LocalConnection.
2015-01-21 21:23:59 +00:00
Matthias Radestock
ac95d5ab29
rename and lift ProtocolMsg into API
2015-01-20 23:23:59 +00:00
Matthias Radestock
d089900632
fix crypto
2015-01-20 23:22:44 +00:00
Matthias Radestock
1181a0cb33
better APIs for sending protocol messages
...
no longer tagging requiring the caller to construct them
2015-01-20 22:31:16 +00:00
Matthias Radestock
62da72e26d
cosmetic: move a bunch of error types to where they belong
2015-01-20 21:01:50 +00:00
Matthias Radestock
be4dca5bf7
cosmetic: move crypto types from types.go into crypto.go
2015-01-20 20:27:59 +00:00
Matthias Radestock
d69854d9c5
cosmetic: turn some if-then-else into 'switch'
2015-01-17 19:19:47 +00:00
Matthias Radestock
7cfb79cfc1
close connection when failing to decrypt packets
...
Since we may never recover from that if nonces got out of sync.
Closes #274 .
2014-12-28 19:52:56 +00:00
Matthias Radestock
f792bf7ef8
don't log packet on decryption error
...
since that is expensive and clutters the logs
2014-12-28 19:09:41 +00:00
Matthias Radestock
801b2f6761
refactor for consistency
2014-12-13 10:19:17 +00:00
Matthias Radestock
4ddfc47448
don't trip over truncated udp packets
...
and log such events, plus any other errors during decoding, nicely,
including the connection on which this occured.
Closes #123 .
2014-10-15 21:03:15 +01:00
Matthias Radestock
a587fef9c4
fix package name following move
2014-10-15 15:20:49 +01:00
Matthias Radestock
e2fd1fda31
move router code
2014-10-15 15:07:42 +01:00