mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 20:05:43 +02:00
relay: add UNIX socket support (closes #733)
This commit is contained in:
committed by
Sébastien Helleu
parent
5f87112ec5
commit
ffefd1b785
@@ -3194,6 +3194,27 @@ websocket = new WebSocket("ws://server.com:9000/weechat");
|
||||
The port (9000 in example) is the port defined in Relay plugin.
|
||||
The URI must always end with "/weechat" (for _irc_ and _weechat_ protocols).
|
||||
|
||||
[[relay_unixsocket]]
|
||||
==== UNIX domain sockets
|
||||
|
||||
Using the protocol option "unix" with the "/relay add" command, you can
|
||||
listen using any protocol on a UNIX domain socket at a given path. For exmaple:
|
||||
|
||||
----
|
||||
/relay add unix.weechat /tmp/weesock
|
||||
----
|
||||
|
||||
will allow clients to connect using the WeeChat protocol to /tmp/weesock. This
|
||||
is particularly useful to allow SSH forwarding for relay clients, when other
|
||||
ports cannot be opened. Using OpenSSH:
|
||||
|
||||
----
|
||||
$ ssh -L9000:/tmp/weesock foo_host
|
||||
----
|
||||
|
||||
will then allow for local relay clients to connect on port 9000 to a WeeChat
|
||||
instance running on "foo_host".
|
||||
|
||||
[[relay_commands]]
|
||||
==== Commands
|
||||
|
||||
|
||||
@@ -1355,9 +1355,9 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
relay_clients = new_client;
|
||||
|
||||
weechat_printf_date_tags (NULL, 0, "relay_client",
|
||||
_("%s: new client on port %d: %s%s%s"),
|
||||
_("%s: new client on port/path %s: %s%s%s"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
server->path,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
new_client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
|
||||
extern struct t_config_file *relay_config_file;
|
||||
extern struct t_config_section *relay_config_section_port;
|
||||
extern struct t_config_section *relay_config_section_path;
|
||||
|
||||
extern struct t_config_option *relay_config_look_auto_open_buffer;
|
||||
extern struct t_config_option *relay_config_look_raw_messages;
|
||||
@@ -72,6 +73,7 @@ extern int relay_config_create_option_port (const void *pointer, void *data,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value);
|
||||
extern int relay_config_check_path_len (const char *path);
|
||||
extern int relay_config_init ();
|
||||
extern int relay_config_read ();
|
||||
extern int relay_config_write ();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@
|
||||
#define WEECHAT_PLUGIN_RELAY_SERVER_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#define RELAY_SERVER_GNUTLS_DH_BITS 1024
|
||||
#endif /* HAVE_GNUTLS */
|
||||
@@ -33,9 +32,14 @@ struct t_relay_server
|
||||
char *protocol_args; /* arguments used for protocol */
|
||||
/* example: server for irc protocol */
|
||||
int port; /* listening on this port */
|
||||
/* or UNIX socket, if negative. */
|
||||
char *path; /* listening on this path (UNIX) */
|
||||
/* contains string representation of */
|
||||
/* port if IP */
|
||||
int ipv4; /* IPv4 protocol enabled */
|
||||
int ipv6; /* IPv6 protocol enabled */
|
||||
int ssl; /* 1 if SSL is enabled */
|
||||
int un; /* 1 if UNIX socket */
|
||||
int sock; /* socket for connection */
|
||||
struct t_hook *hook_fd; /* hook for socket */
|
||||
time_t start_time; /* start time */
|
||||
@@ -49,18 +53,20 @@ extern struct t_relay_server *last_relay_server;
|
||||
|
||||
extern void relay_server_get_protocol_args (const char *protocol_and_string,
|
||||
int *ipv4, int *ipv6,
|
||||
int *ssl,
|
||||
int *ssl, int *un,
|
||||
char **protocol,
|
||||
char **protocol_args);
|
||||
extern struct t_relay_server *relay_server_search (const char *protocol_and_args);
|
||||
extern struct t_relay_server *relay_server_search_port (int port);
|
||||
extern struct t_relay_server *relay_server_search_path (const char *path);
|
||||
extern void relay_server_close_socket (struct t_relay_server *server);
|
||||
extern int relay_server_create_socket (struct t_relay_server *server);
|
||||
extern struct t_relay_server *relay_server_new (const char *protocol_string,
|
||||
enum t_relay_protocol protocol,
|
||||
const char *protocol_args,
|
||||
int port, int ipv4, int ipv6,
|
||||
int ssl);
|
||||
int port, const char *path,
|
||||
int ipv4, int ipv6,
|
||||
int ssl, int un);
|
||||
extern void relay_server_update_port (struct t_relay_server *server, int port);
|
||||
extern void relay_server_free (struct t_relay_server *server);
|
||||
extern void relay_server_free_all ();
|
||||
|
||||
Reference in New Issue
Block a user