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.

77 lines
2.4 KiB

Obfsproxy standalone mode (#1156) * ss-libev: Introduce mode parameter for start_plugin Since obfsproxy handles client and server in different ways, no matter standalone or manged mode, so introduce the mode for start_plugin() to support obfsproxy. With more comments added to plugin.h for later developers. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: Move SS protocol plugin initialization code to start_ss_plugin Move SS protocol plugin initialization to start_ss_plugin() function, as the support for obfsproxy will not use that environment. Also, remove the use of get_current_dir_name() which is a glibc extension, such macro hack will just make code less readable. Not to mention it already screw up code folding of vim. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: Introduce obfsproxy standalone mode support as plugin Now shadowsocks-libev supports to use obfsproxy as plugin. Currently we only support to use standalone(proxy) mode of obfsproxy, as managed mode needs to use SOCKS5 as upstream forward, while ss-libev doesn't support it yet. And the output from plugin is just trashed for now. Support to pipe them into stdout/stderr will be added later. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: doc: Fix wrong cmdline parameter for plugin options Command line option for plugin options is "--plugin-opts", not the json option "--plugin_opts" Fix it. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp>
8 years ago
Obfsproxy standalone mode (#1156) * ss-libev: Introduce mode parameter for start_plugin Since obfsproxy handles client and server in different ways, no matter standalone or manged mode, so introduce the mode for start_plugin() to support obfsproxy. With more comments added to plugin.h for later developers. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: Move SS protocol plugin initialization code to start_ss_plugin Move SS protocol plugin initialization to start_ss_plugin() function, as the support for obfsproxy will not use that environment. Also, remove the use of get_current_dir_name() which is a glibc extension, such macro hack will just make code less readable. Not to mention it already screw up code folding of vim. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: Introduce obfsproxy standalone mode support as plugin Now shadowsocks-libev supports to use obfsproxy as plugin. Currently we only support to use standalone(proxy) mode of obfsproxy, as managed mode needs to use SOCKS5 as upstream forward, while ss-libev doesn't support it yet. And the output from plugin is just trashed for now. Support to pipe them into stdout/stderr will be added later. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp> * ss-libev: doc: Fix wrong cmdline parameter for plugin options Command line option for plugin options is "--plugin-opts", not the json option "--plugin_opts" Fix it. Signed-off-by: Adam Anonymous <anonymous_temp_mail@yahoo.co.jp>
8 years ago
8 years ago
  1. /*
  2. * acl.h - Define the ACL interface
  3. *
  4. * Copyright (C) 2013 - 2017, Max Lv <max.c.lv@gmail.com>
  5. *
  6. * This file is part of the shadowsocks-libev.
  7. *
  8. * shadowsocks-libev is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * shadowsocks-libev is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with shadowsocks-libev; see the file COPYING. If not, see
  20. * <http://www.gnu.org/licenses/>.
  21. */
  22. #ifndef _PLUGIN_H
  23. #define _PLUGIN_H
  24. #define PLUGIN_EXIT_ERROR -2
  25. #define PLUGIN_EXIT_NORMAL -1
  26. #define PLUGIN_RUNNING 0
  27. enum plugin_mode {
  28. MODE_CLIENT,
  29. MODE_SERVER
  30. };
  31. /*
  32. * XXX: Since we have SS plugins and obfsproxy support, for now we will
  33. * do extra check against the plugin name.
  34. * For obfsproxy, we will not follow the SS specified protocol and
  35. * do special routine for obfsproxy.
  36. * This may change when the protocol is finally settled
  37. *
  38. * Main function to start a plugin.
  39. *
  40. * @plugin: name of the plugin
  41. * search from PATH and current directory.
  42. * @plugin_opts: Special options for plugin
  43. * @remote_host:
  44. * CLIENT mode:
  45. * The remote server address, which also runs corresponding plugin
  46. * SERVER mode:
  47. * The real listen address, which plugin will listen to
  48. * @remote_port:
  49. * CLIENT mode:
  50. * The remote server port, which corresponding plugin is listening to
  51. * SERVER mode:
  52. * The real listen port, which plugin will listen to
  53. * @local_host:
  54. * Where ss-libev will connect/listen to.
  55. * Normally localhost for both modes.
  56. * @local_port:
  57. * Where ss-libev will connect/listen to.
  58. * Internal user port.
  59. * @mode:
  60. * Indicates which mode the plugin should run at.
  61. */
  62. int start_plugin(const char *plugin,
  63. const char *plugin_opts,
  64. const char *remote_host,
  65. const char *remote_port,
  66. const char *local_host,
  67. const char *local_port,
  68. enum plugin_mode mode);
  69. uint16_t get_local_port();
  70. void stop_plugin();
  71. int is_plugin_running();
  72. #endif // _PLUGIN_H