You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * server.c - Define the config data structure
  3. *
  4. * Copyright (C) 2013 - 2015, Max Lv <max.c.lv@gmail.com>
  5. *
  6. * This file is part of the shadowsocks-libev.
  7. * shadowsocks-libev is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * shadowsocks-libev is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with shadowsocks-libev; see the file COPYING. If not, see
  19. * <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef _JCONF_H
  22. #define _JCONF_H
  23. #define MAX_PORT_NUM 1024
  24. #define MAX_REMOTE_NUM 10
  25. #define MAX_CONF_SIZE 128 * 1024
  26. #define MAX_DNS_NUM 4
  27. #define MAX_CONNECT_TIMEOUT 10
  28. #define MIN_UDP_TIMEOUT 10
  29. typedef struct {
  30. char *host;
  31. char *port;
  32. } ss_addr_t;
  33. typedef struct {
  34. char *port;
  35. char *password;
  36. } ss_port_password_t;
  37. typedef struct {
  38. int remote_num;
  39. ss_addr_t remote_addr[MAX_REMOTE_NUM];
  40. int port_password_num;
  41. ss_port_password_t port_password[MAX_PORT_NUM];
  42. char *remote_port;
  43. char *local_addr;
  44. char *local_port;
  45. char *password;
  46. char *method;
  47. char *timeout;
  48. int auth;
  49. int fast_open;
  50. int nofile;
  51. char *nameserver;
  52. } jconf_t;
  53. jconf_t *read_jconf(const char * file);
  54. void parse_addr(const char *str, ss_addr_t *addr);
  55. void free_addr(ss_addr_t *addr);
  56. #endif // _JCONF_H