Skip to content
This repository was archived by the owner on Jan 24, 2020. It is now read-only.

Commit af233b6

Browse files
clalbusyajo
authored andcommitted
Allow to specify timeout values using ENV vars (#2)
* Allow to specify timeout values using ENV vars * Cleanup README formatting * Sort env vars in alphabetical order * Read config values straight from environment * Revert code formatting Signed-off-by: Andrejs Volkovs <[email protected]>
1 parent 4a763c1 commit af233b6

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed

Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ ENV NAMESERVERS="208.67.222.222 8.8.8.8 208.67.220.220 8.8.4.4" \
1212
LISTEN=:100 \
1313
PRE_RESOLVE=0 \
1414
TALK=talk:100 \
15+
TIMEOUT_CLIENT=5s \
16+
TIMEOUT_CLIENT_FIN=5s \
17+
TIMEOUT_CONNECT=5s \
18+
TIMEOUT_SERVER=5s \
19+
TIMEOUT_SERVER_FIN=5s \
20+
TIMEOUT_TUNNEL=5s \
1521
UDP=0 \
1622
VERBOSE=0
1723

README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ and it must be written in the format used by the [`bind`][] directive.
4242
By default (`:100`), it listens in every connection at port 100 (port 100?
4343
that's stupid!... Yes, read the title :point_up::expressionless:).
4444

45-
### `NAMESERVERS`
45+
#### `$NAMESERVERS`
4646

4747
Default: `208.67.222.222 8.8.8.8 208.67.220.220 8.8.4.4` to use OpenDNS and Google DNS resolution servers by default.
4848

4949
Only used when [pre-resolving](#pre-resolve) is enabled.
5050

51-
### `PRE_RESOLVE`
51+
#### `$PRE_RESOLVE`
5252

5353
Default: `0`
5454

@@ -65,6 +65,42 @@ required by [HAProxy][]'s [`server`][] directive.
6565

6666
By default (`talk:100`), it talks to a host named `talk` in port 100 too.
6767

68+
#### `$TIMEOUT_CLIENT`
69+
70+
Default: `5s`
71+
72+
This variable sets the maximum inactivity time on the client side.
73+
74+
#### `$TIMEOUT_CLIENT_FIN`
75+
76+
Default: `5s`
77+
78+
This variable sets the inactivity timeout on the client side for half-closed connections.
79+
80+
#### `$TIMEOUT_CONNECT`
81+
82+
Default: `5s`
83+
84+
This variable sets the maximum time to wait for a connection attempt to a server to succeed.
85+
86+
#### `$TIMEOUT_SERVER`
87+
88+
Default: `5s`
89+
90+
This variable sets the maximum inactivity time on the server side.
91+
92+
#### `$TIMEOUT_SERVER_FIN`
93+
94+
Default: `5s`
95+
96+
This variable sets the inactivity timeout on the server side for half-closed connection.
97+
98+
#### `$TIMEOUT_TUNNEL`
99+
100+
Default: `5s`
101+
102+
This variable sets the maximum inactivity time on the client and server side for tunnels.
103+
68104
### Multi-proxy mode
69105

70106
This image supports proxying multiple ports at once, but keep in mind

magic-entrypoint.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
defaults
3030
log global
3131
mode tcp
32-
timeout client 5s
33-
timeout client-fin 5s
34-
timeout connect 5s
35-
timeout server 5s
36-
timeout server-fin 5s
37-
timeout tunnel 5s
32+
timeout client env(TIMEOUT_CLIENT)
33+
timeout client-fin env(TIMEOUT_CLIENT_FIN)
34+
timeout connect env(TIMEOUT_CONNECT)
35+
timeout server env(TIMEOUT_SERVER)
36+
timeout server-fin env(TIMEOUT_SERVER_FIN)
37+
timeout tunnel env(TIMEOUT_TUNNEL)
3838
"""
3939

4040
if len(LISTENS) != len(TALKS):

0 commit comments

Comments
 (0)