Add HTTP/TLS obfuscating. [SIP001] (#1009)

Add experimental HTTP/TLS obfuscating as an **optional extension** of shadowsocks protocol.

More discussions can be found here: https://github.com/shadowsocks/shadowsocks-org/issues/26

As this feature is still a SIP (Shadowsocks Improvement Proposal), it's very unstable and experimental. So, 

1. Don't enable it unless you know what it is.
2. Be very careful when using it in production environment.
This commit is contained in:
Max Lv
2016-12-27 02:53:25 -06:00
committed by GitHub
parent 9b2b394249
commit 8cb4f81eba
45 changed files with 2214 additions and 419 deletions
+23
View File
@@ -229,4 +229,27 @@ void *ss_realloc(void *ptr, size_t new_size);
ptr = NULL; \
} while (0)
#if BYTE_ORDER == BIG_ENDIAN
#define CT_HTONS(n) (n)
#define CT_NTOHS(n) (n)
#define CT_HTONL(n) (n)
#define CT_NTOHL(n) (n)
#else
#define CT_HTONS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
#define CT_NTOHS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
#define CT_HTONL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))
#define CT_NTOHL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))
#endif
#endif // _UTILS_H