From 303e464579e2fc9961d4d9f4841e916f9aa8963f Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 8 Jun 2019 12:15:23 +0200 Subject: Move example configuration --- README.md | 2 +- plugins/backend_file.cfg | 11 +++++++++++ plugins/backend_file.md | 16 +++++++++++++--- websocksy.cfg | 11 ----------- 4 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 plugins/backend_file.cfg delete mode 100644 websocksy.cfg diff --git a/README.md b/README.md index 91524c8..fda4e08 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ In the `[core]` section, the following options are recognized: In the `[backend]` section, all options are passed directly to the backend and thus are dependent on the specific implementation. Backends should provide their own documentation files. -An [example configuration file](websocksy.cfg) using the `file` backend is available in the repository. +An [example configuration file](plugins/backend_file.cfg) using the `file` backend is available in the repository. ## Default backend diff --git a/plugins/backend_file.cfg b/plugins/backend_file.cfg new file mode 100644 index 0000000..e986405 --- /dev/null +++ b/plugins/backend_file.cfg @@ -0,0 +1,11 @@ +[core] +port = 8000 +backend = file + +[backend] +path = files/ +expression = %endpoint%.txt +expression = %cookie:session%.txt +expression = %header:X-Foo-Bar%.txt +expression = default.txt + diff --git a/plugins/backend_file.md b/plugins/backend_file.md index 7359c94..aefebf9 100644 --- a/plugins/backend_file.md +++ b/plugins/backend_file.md @@ -14,13 +14,21 @@ user-configurable templates which may use the following variables: All slashes in variable values are replaced by underscores to defend against directory traversal attacks. -If a specified file or variable does not exist (ie. the header or cookie is missing), the expression is skipped and the next one is evaluated. When the end of the template expression list is reached without a valid peer being found, the WebSocket connection will be rejected. +If a specified file or variable does not exist (ie. the header or cookie is missing), the expression is skipped and the next +one is evaluated. When the end of the template expression list is reached without a valid peer being found, the WebSocket connection +will be rejected. The files accessed via the expression list must contain lines of the form -` [] []` +` [] []` -If the WebSocket client indicates one or more supported subprotocol, the first line found in any of the traversed +For example: +``` +tcp://localhost:5900 binary auto +unix:///tmp/app.sock text text +``` + +If the WebSocket client indicates one or more supported subprotocols, the first line found in any of the traversed files matching any of the indicated protocols is used as the connection peer. The special value `*` for the protocol always matches the first indicated protocol. If the client does not indicate a subprotocol, the first configuration line read will be used. @@ -31,3 +39,5 @@ This backend accepts the following configuration options: * `path`: The base path for the template expression list. All template evaluations will be appended to this path. * `expression`: Adds a template expression to the list. Specify multiple times to extend the list. Expressions are evaluated in the order they are specified. + +An [example configuration file](backend_file.cfg) is provided in the repository. diff --git a/websocksy.cfg b/websocksy.cfg deleted file mode 100644 index e986405..0000000 --- a/websocksy.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[core] -port = 8000 -backend = file - -[backend] -path = files/ -expression = %endpoint%.txt -expression = %cookie:session%.txt -expression = %header:X-Foo-Bar%.txt -expression = default.txt - -- cgit v1.2.3