Dirkjan Ochtman
2a13a2ae36
Add new Client::connect_with_tls_config() API method
2018-06-07 14:52:38 +02:00
Dirkjan Ochtman
b81937b522
Implement careful packetization and use stream buffers for TLS ( fixes #3 , #18 )
...
This is an unfortunately large commit that intertwines several things:
- Use stream buffers to mediate sending and receiving data
- Use regular stream data transfer for stream 0 (TLS)
- Carefully packetize outgoing messages
The packetization approach is basically to include all non-STREAM frames,
assuming for now that they will always fit into a packet. The packet
size is set conservatively at the maximum allowed path MTU (1232 bytes
for IPv6). Remaining bytes will be filled with STREAM frames.
Additionally, a connection can now queue more than one packet at a time.
2018-06-02 15:51:49 +02:00
Dirkjan Ochtman
37f4c9b4ee
Only send ACK frames after receiving non-ACK payloads
2018-06-02 15:47:35 +02:00
Dirkjan Ochtman
8770660228
Rename Streams::queue to Streams::control
2018-06-02 15:47:35 +02:00
Dirkjan Ochtman
6925b216ab
Make StreamRef id field public
2018-06-02 15:47:35 +02:00
Dirkjan Ochtman
64b8f3ba92
Always send long headers with two-byte payload length
2018-06-02 15:47:35 +02:00
Dirkjan Ochtman
c838c970e4
Change Streams::init_send() to return Result instead of Option
2018-06-02 15:23:49 +02:00
Dirkjan Ochtman
ddb73681d1
Open up stream 0 for both sides
2018-06-01 15:13:24 +02:00
Dirkjan Ochtman
c50495e111
Use Default::default() for Stream constructor
2018-06-01 15:12:30 +02:00
Dirkjan Ochtman
bb92fbb718
Derive Debug for Stream type
2018-06-01 15:11:42 +02:00
Dirkjan Ochtman
94b547c987
Address clippy suggestions
2018-05-31 13:18:52 +02:00
Dirkjan Ochtman
65bf02c924
Fix formatting with cargo fmt
2018-05-31 13:14:02 +02:00
Dirkjan Ochtman
4174627231
Remove final traces of Packet type
2018-05-31 13:13:36 +02:00
Dirkjan Ochtman
db77ec5c5e
Move PartialDecode::finish() implementation into ConnectionState::handle_partial()
2018-05-31 13:08:41 +02:00
Dirkjan Ochtman
eb3ec93934
Move packet encoding into ConnectionState::queue_packet()
2018-05-31 12:57:28 +02:00
Dirkjan Ochtman
c641646870
Build packets just in time
2018-05-31 12:05:37 +02:00
Dirkjan Ochtman
4cb49b6d78
Fix formatting with cargo fmt
2018-05-30 15:58:29 +02:00
Dirkjan Ochtman
e32f9d99cf
Handle errors from creating TLS server configuration
2018-05-30 15:58:23 +02:00
Dirkjan Ochtman
7db2c3753a
Use tokio::run() to run the example server
2018-05-30 15:55:24 +02:00
Dirkjan Ochtman
94f31ffef3
Fix client default local addresses to allow any interface
2018-05-30 15:47:55 +02:00
Dirkjan Ochtman
b6e436b514
Use current_thread::Runtime for running tests
2018-05-30 13:24:04 +02:00
Dirkjan Ochtman
aa1e2f9afa
Add utility methods to get Dir and Side from stream IDs
2018-05-29 16:57:31 +02:00
Dirkjan Ochtman
241b01d83a
Use handle_tls() method for initial packet
2018-05-29 14:55:38 +02:00
Dirkjan Ochtman
438cbe5a70
Make packetization code more functional
2018-05-29 14:44:53 +02:00
Dirkjan Ochtman
4790475ad7
Always send two byte payload lengths in short headers
2018-05-29 14:36:32 +02:00
Dirkjan Ochtman
4b1b157be7
Decide header type based on connection state
2018-05-29 14:36:32 +02:00
Dirkjan Ochtman
1035ca61cb
Improve error message on invalid connection state
2018-05-29 14:36:32 +02:00
Dirkjan Ochtman
ee6412d443
Add FinalHandshake state to connection state machine
2018-05-29 14:36:11 +02:00
Dirkjan Ochtman
92e8c4d06d
ConnectionState::decode_key() can now be private
2018-05-29 13:53:58 +02:00
Dirkjan Ochtman
9a2d032eb5
Trigger client initial packet creation from connect() method
2018-05-29 11:32:48 +02:00
Dirkjan Ochtman
2ad307fb52
Simplify Future implementation for Client
2018-05-29 11:32:48 +02:00
Dirkjan Ochtman
b3af4f3432
Simplify socket address literals
2018-05-29 09:37:11 +02:00
Dirkjan Ochtman
b452b06c00
Implement support for header-only negotiation packets
2018-05-29 09:16:00 +02:00
Dirkjan Ochtman
8952e53878
Implement more refined handling of packet number extraction
2018-05-29 09:13:55 +02:00
Dirkjan Ochtman
9045e9eacc
Refactor Client/ConnectFuture construction sequence
2018-05-28 17:11:14 +02:00
Dirkjan Ochtman
d08f36add7
Enable synchronous access to server send queue
2018-05-28 16:35:31 +02:00
Dirkjan Ochtman
19c79b6e66
Move handling of received packets into a separate method
2018-05-28 16:35:31 +02:00
Emeric Chevalier
cbaf2b5154
Switch decode fn from codec trait to return error
2018-05-28 16:11:20 +02:00
Dirkjan Ochtman
d9cf21ef18
Reformat without screwing up carefully formatted byte array
2018-05-28 15:13:56 +02:00
Dirkjan Ochtman
e21abf471b
Simplify server handling of Initial packets
2018-05-28 15:10:50 +02:00
Joseph Birr-Pixton
6e556e1b70
Ignore unknown TransportParameterIds when decoding
2018-05-28 15:10:27 +02:00
Dirkjan Ochtman
ba82eaa219
Change Server to spawn one task per connection ( fixes #7 )
...
The Connection owns the ConnectionState, the SocketAddr, and two channel
endpoints to communicate with the server.
With this setup, (a) the Server no longer blocks on processing incoming
packets, and (b) the server will make progress on sending queued packets
even if no packets are coming in.
2018-05-28 14:27:08 +02:00
Dirkjan Ochtman
adcb68121e
Fix and simplify decoding of padding frames
2018-05-28 14:25:12 +02:00
Dirkjan Ochtman
4ce89742ab
Fix formatting with cargo fmt
2018-05-28 12:10:41 +02:00
Dirkjan Ochtman
7a5fa3ea64
Merge packet building functions
2018-05-28 12:10:26 +02:00
Dirkjan Ochtman
52163298e8
Upgrade to rand-0.5
2018-05-22 16:42:28 +02:00
Dirkjan Ochtman
e19a548925
Improve ConnectFuture API for robustness ( fixes #9 )
2018-05-21 21:34:32 +02:00
Dirkjan Ochtman
945ea60c5a
Improve logging for server-sent messages
2018-05-21 21:19:02 +02:00
Dirkjan Ochtman
1e54ee7ee8
Improve robustness of encoded handshake test ( fixes #10 )
2018-05-21 21:18:10 +02:00
Dirkjan Ochtman
5ec14c185f
Move PeerData into conn_state module
2018-05-21 20:52:09 +02:00