• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

README.mdD23-Nov-20231.8 KiB6747

protocol_lws_raw_proxy.cD23-Nov-202314.6 KiB591412

README.md

1# raw-proxy plugin
2
3## Enabling for build
4
5```
6$ cmake .. -DLWS_ROLE_RAW_PROXY=1
7```
8
9## configuration pvo
10
11|pvo|value meaning|
12|---|---|
13|onward|The onward proxy destination, in the form `ipv4:addr[:port]`|
14
15## Note for vhost selection
16
17Notice that since it proxies the packets "raw", there's no SNI or Host:
18header to resolve amongst multiple vhosts on the same listen port.  So the
19vhost you associate with this protocol must be alone on its own port.
20
21It's also possible to apply this or other role + protocols as a fallback after
22http[s] processing rejected the first packet from an incoming connection.
23See `./READMEs/README-http-fallback.md`
24
25## Note for packet size
26
27For throughput, since often one side is localhost that can handle larger
28packets easily, you should create the context used with this plugin with
29
30```
31	info.pt_serv_buf_size = 8192;
32```
33
34lwsws already does this.
35
36## Using with C
37
38See the minimal example `./minimal-example/raw/minimal-raw-proxy` for
39a working example of a vhost that accepts connections and then
40proxies them using this plugin.  The example is almost all boilerplate
41for setting up the context and the pvo.
42
43## Using with lwsws
44
45For a usage where the plugin "owns" the whole vhost, you should enable the
46plugin protocol on the vhost as usual, and specify the "onward" pvo with:
47
48```
49                "ws-protocols": [{
50                        "raw-proxy": {
51                         "status": "ok",
52                         "onward": "ipv4:remote.address.com:port"
53                        }
54                 }],
55```
56
57and then define the vhost with:
58
59```
60    "apply-listen-accept": "1",
61    "listen-accept-role": "raw-proxy",
62    "listen-accept-protocol": "raw-proxy"
63```
64
65which tells it to apply the role and protocol as soon as a connection is
66accepted on the vhost.
67