Files
shadowsocks-libev/src/plugin.h
T
anonymous-contributor 98c51cd0d5 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>
2017-02-01 18:18:43 +08:00

78 lines
2.4 KiB
C

/*
* acl.h - Define the ACL interface
*
* Copyright (C) 2013 - 2016, Max Lv <max.c.lv@gmail.com>
*
* This file is part of the shadowsocks-libev.
*
* shadowsocks-libev is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* shadowsocks-libev is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with shadowsocks-libev; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _PLUGIN_H
#define _PLUGIN_H
#define PLUGIN_EXIT_ERROR -2
#define PLUGIN_EXIT_NORMAL -1
#define PLUGIN_RUNNING 0
enum plugin_mode {
MODE_CLIENT,
MODE_SERVER
};
/*
* XXX: Since we have SS plugins and obfsproxy support, for now we will
* do extra check against the plugin name.
* For obfsproxy, we will not follow the SS specified protocol and
* do special routine for obfsproxy.
* This may change when the protocol is finally settled
*
* Main function to start a plugin.
*
* @plugin: name of the plugin
* search from PATH and current directory.
* @plugin_opts: Special options for plugin
* @remote_host:
* CLIENT mode:
* The remote server address, which also runs corresponding plugin
* SERVER mode:
* The real listen address, which plugin will listen to
* @remote_port:
* CLIENT mode:
* The remote server port, which corresponding plugin is listening to
* SERVER mode:
* The real listen port, which plugin will listen to
* @local_host:
* Where ss-libev will connect/listen to.
* Normally localhost for both modes.
* @local_port:
* Where ss-libev will connect/listen to.
* Internal user port.
* @mode:
* Indicates which mode the plugin should run at.
*/
int start_plugin(const char *plugin,
const char *plugin_opts,
const char *remote_host,
const char *remote_port,
const char *local_host,
const char *local_port,
enum plugin_mode mode);
uint16_t get_local_port();
void stop_plugin();
int is_plugin_running();
#endif // _PLUGIN_H