Browse Source

update documents

pull/405/head
Max Lv 9 years ago
parent
commit
5292700bbc
2 changed files with 23 additions and 19 deletions
  1. 28
      src/server.c
  2. 14
      src/udprelay.c

28
src/server.c

@ -528,27 +528,27 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
/*
* Shadowsocks TCP Relay Header:
*
* +------+----------+----------+---------------------+
* | ATYP | DST.ADDR | DST.PORT | Poly1305 |
* +------+----------+----------+---------------------+
* | 1 | Variable | 2 | 16 |
* +------+----------+----------+---------------------+
* +------+----------+----------+----------------+
* | ATYP | DST.ADDR | DST.PORT | HMAC-SHA1 |
* +------+----------+----------+----------------+
* | 1 | Variable | 2 | 20 |
* +------+----------+----------+----------------+
*
* If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (Poly1305) and Hash (BLAKE2b) are enabled.
* If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (HMAC-SHA1) is enabled.
*
* The key of Poly1305 is BLAKE2b(IV + KEY) and the input is the whole header.
* The key of HMAC-SHA1 is (IV + KEY) and the input is the whole header.
*/
/*
* Shadowsocks TCP Request Chunk (Optional, no hash check for response's payload):
* Shadowsocks TCP Request's Chunk Authentication (Optional, no hash check for response's payload):
*
* +------+---------+-------------+------+
* | LEN | BLAKE2b | DATA | ...
* +------+---------+-------------+------+
* | 2 | 4 | Variable | ...
* +------+---------+-------------+------+
* +------+-----------+-------------+------+
* | LEN | HMAC-SHA1 | DATA | ...
* +------+-----------+-------------+------+
* | 2 | 20 | Variable | ...
* +------+-----------+-------------+------+
*
* The key of BLAKE2b is (IV + CHUNK ID)
* The key of HMAC-SHA1 is (IV + CHUNK ID)
*/
int offset = 0;

14
src/udprelay.c

@ -869,11 +869,15 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
* +----+------+------+----------+----------+----------+
*
* shadowsocks UDP Request (before encrypted)
* +------+----------+----------+----------+
* | ATYP | DST.ADDR | DST.PORT | DATA |
* +------+----------+----------+----------+
* | 1 | Variable | 2 | Variable |
* +------+----------+----------+----------+
* +------+----------+----------+----------+-------------+
* | ATYP | DST.ADDR | DST.PORT | DATA | HMAC-SHA1 |
* +------+----------+----------+----------+-------------+
* | 1 | Variable | 2 | Variable | 20 |
* +------+----------+----------+----------+-------------+
*
* If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (HMAC-SHA1) is enabled.
*
* The key of HMAC-SHA1 is (IV + KEY) and the input is the whole packet.
*
* shadowsocks UDP Response (before encrypted)
* +------+----------+----------+----------+

Loading…
Cancel
Save