socks5proxy.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _SOCKS5PROXY_H_
  2. #define _SOCKS5PROXY_H_
  3. #include <openssl/evp.h>
  4. #include <stdint.h>
  5. #define SLITHEEN_ID_LEN 28
  6. #define SLITHEEN_SUPER_SECRET_SIZE 28
  7. #define SLITHEEN_SUPER_CONST "SLITHEEN_SUPER_ENCRYPT"
  8. #define SLITHEEN_SUPER_CONST_SIZE 22
  9. int proxy_data(int sockfd, uint16_t stream_id, int32_t pipefd);
  10. void *demultiplex_data();
  11. int super_decrypt(uint8_t *data);
  12. int generate_super_keys(uint8_t *secret);
  13. struct __attribute__ ((__packed__)) slitheen_hdr {
  14. uint64_t counter;
  15. uint16_t stream_id;
  16. uint16_t len;
  17. uint16_t garbage;
  18. uint16_t zeros;
  19. };
  20. #define SLITHEEN_HEADER_LEN 16
  21. struct __attribute__ ((__packed__)) slitheen_up_hdr{
  22. uint16_t stream_id;
  23. uint16_t len;
  24. };
  25. typedef struct connection_st{
  26. int32_t pipe_fd;
  27. uint16_t stream_id;
  28. struct connection_st *next;
  29. } connection;
  30. typedef struct connection_table_st{
  31. connection *first;
  32. } connection_table;
  33. static connection_table *connections;
  34. typedef struct super_data_st {
  35. //EVP_CIPHER_CTX *header_ctx;
  36. //EVP_CIPHER_CTX *body_ctx;
  37. uint8_t *header_key;
  38. uint8_t *body_key;
  39. EVP_MD_CTX *body_mac_ctx;
  40. } super_data;
  41. static super_data *super;
  42. typedef struct data_block_st {
  43. uint64_t count;
  44. uint8_t *data;
  45. struct data_block_st *next;
  46. } data_block;
  47. #endif /* _SOCKS5PROXY_H_ */