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

Commit

Permalink
Allow to specify timeout values using ENV vars (#2)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
clalbus authored and yajo committed Jan 14, 2019
1 parent 4a763c1 commit af233b6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ ENV NAMESERVERS="208.67.222.222 8.8.8.8 208.67.220.220 8.8.4.4" \
LISTEN=:100 \
PRE_RESOLVE=0 \
TALK=talk:100 \
TIMEOUT_CLIENT=5s \
TIMEOUT_CLIENT_FIN=5s \
TIMEOUT_CONNECT=5s \
TIMEOUT_SERVER=5s \
TIMEOUT_SERVER_FIN=5s \
TIMEOUT_TUNNEL=5s \
UDP=0 \
VERBOSE=0

Expand Down
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ and it must be written in the format used by the [`bind`][] directive.
By default (`:100`), it listens in every connection at port 100 (port 100?
that's stupid!... Yes, read the title :point_up::expressionless:).

### `NAMESERVERS`
#### `$NAMESERVERS`

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.

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

### `PRE_RESOLVE`
#### `$PRE_RESOLVE`

Default: `0`

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

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

#### `$TIMEOUT_CLIENT`

Default: `5s`

This variable sets the maximum inactivity time on the client side.

#### `$TIMEOUT_CLIENT_FIN`

Default: `5s`

This variable sets the inactivity timeout on the client side for half-closed connections.

#### `$TIMEOUT_CONNECT`

Default: `5s`

This variable sets the maximum time to wait for a connection attempt to a server to succeed.

#### `$TIMEOUT_SERVER`

Default: `5s`

This variable sets the maximum inactivity time on the server side.

#### `$TIMEOUT_SERVER_FIN`

Default: `5s`

This variable sets the inactivity timeout on the server side for half-closed connection.

#### `$TIMEOUT_TUNNEL`

Default: `5s`

This variable sets the maximum inactivity time on the client and server side for tunnels.

### Multi-proxy mode

This image supports proxying multiple ports at once, but keep in mind
Expand Down
12 changes: 6 additions & 6 deletions magic-entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
defaults
log global
mode tcp
timeout client 5s
timeout client-fin 5s
timeout connect 5s
timeout server 5s
timeout server-fin 5s
timeout tunnel 5s
timeout client env(TIMEOUT_CLIENT)
timeout client-fin env(TIMEOUT_CLIENT_FIN)
timeout connect env(TIMEOUT_CONNECT)
timeout server env(TIMEOUT_SERVER)
timeout server-fin env(TIMEOUT_SERVER_FIN)
timeout tunnel env(TIMEOUT_TUNNEL)
"""

if len(LISTENS) != len(TALKS):
Expand Down

0 comments on commit af233b6

Please sign in to comment.