Skip to content

Commit

Permalink
fix hook name
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 30, 2020
1 parent 5812a06 commit dab746c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions broker/src/tunneldigger_broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def create_tunnel(self, broker, address, uuid, remote_tunnel_id, client_features
return False

# Rate limit creation of new tunnels with the same IP address.
# Runs broker.tunnel-connection-threshold hook if threshold exceeded:
# Runs broker.connection-rate-limit hook if threshold exceeded:
if self.connection_rate_limit_per_ip_count > 0 and self.connection_rate_limit_per_ip_time > 0:
if address[0] not in self.last_tunnel_created_per_ip:
# Create deque with max size if IP address does not exist in dict
Expand All @@ -108,7 +108,7 @@ def create_tunnel(self, broker, address, uuid, remote_tunnel_id, client_features
int(delta),
))
broker.hook_manager.run_hook(
'broker.tunnel-connection-threshold',
'broker.connection-rate-limit',
address[0],
address[1],
uuid,
Expand Down
2 changes: 1 addition & 1 deletion broker/src/tunneldigger_broker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
event_loop=event_loop,
log_arguments=config.getboolean('log', 'log_ip_addresses'),
)
for hook in ('session.up', 'session.pre-down', 'session.down', 'session.mtu-changed', 'broker.tunnel-connection-threshold'):
for hook in ('session.up', 'session.pre-down', 'session.down', 'session.mtu-changed', 'broker.connection-rate-limit'):
try:
script = config.get('hooks', hook).strip()
if not script:
Expand Down
2 changes: 1 addition & 1 deletion docs/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ There are currently four different hooks, namely:
* ``session.mtu-changed`` is called after the broker's path MTU discovery determines that the tunnel's MTU has changed
and should be adjusted (example is found under ``scripts/mtu_changed.sh``)

* ``broker.tunnel-connection-threshold`` is called when a IP address tries to connect ``connection_rate_limit_per_ip_count``
* ``broker.connection-rate-limit`` is called when a IP address tries to connect ``connection_rate_limit_per_ip_count``
times within ``connection_rate_limit_per_ip_time`` seconds.

Please look at all the example hook scripts carefully and try to understand
Expand Down

0 comments on commit dab746c

Please sign in to comment.