Skip to content

Redirects

Aleksandr Zenkov edited this page Oct 12, 2024 · 20 revisions

Verlihub allows to redirect incoming users or users already in the hub. Starting from Verlihhub 0.9.8e redirect system has been changed so make sure to read correct section.

Custom redirects

Verlihub since version 0.9.8e let you create custom redirects. The big difference from old redirect system is that users can be redirected to different hub address depending on events happening in the hub. For example in some cases you would like to redirect banned users to an hub and redirect users, who cannot join the hub because it is full, to another one.

These are the commands available to use with custom redirects:

!lstredirect : List of available redirects

!addredirect <host:port> [ -e <enable/disable> ] [ -a <time start> ] [ -z <time end> ] [ -c <:cc:> ] [ -f <flags> ] [ -s <unsecure/secure/any> ] [ -g <share> ] : Add a new redirect. See below for more information regarding these parameters

!modredirect <host:port> [ -e <enable/disable> ] [ -a <time start> ] [ -z <time end> ] [ -c <:cc:> ] [ -f <flags> ] [ -s <unsecure/secure/any> ] [ -g <share> ] : Change an existing redirect. See below for more information regarding these parameters

!delredirect <host:port> : Remove a redirect

!hredirect : Show an help message and a lit of available redirect flags

Here there is a explanation of command parameters:

  • host:port: the address of the hub with port to redirect the users (for ex. myhub.no-ip.org:4511). If your address is on port 411 then it is optional
  • -e <enable/disable>: use 1 to enable the redirect or 0 to disable it; if this parameter is not given, default value is 1
  • -a : define what time should redirect be enabled at. Format: hh. Default: 00
  • -z : define what time should redirect be disable at. Format: hh. Default: 00
  • -c <:cc:>: Specify what country does redirect apply to
  • -f <flags>: this is a flag bitset of the hub events. These will govern how Verlihub chooses the redirect
  • -s <no/secure/any>: use 0 to enable the redirect unsecure, 1 for secure, or 2 for either unsecure or secure. This option will redirect client depending if connecting through dchub:// or nmdcs://
  • -g : the share size in GB. Default: 0

This is a table with the available flag values:

Bit Event Description
0 For any reason
1 Ban and kick
2 Hub is full
4 Too low or too high share
8 Wrong or unknown tag
16 Wrong password
32 Invalid key
64 Hub is busy
128 Too fast reconnect
256 Bad nick, already used, too short, etc
512 Clone detection
1024 Same user connects twice

To specify more events for a single redirect, you can use the bit of the event. For example suppose you want to redirect all banned users (bit 1) and those who do not follow hub rules (bit 4) to address foobar.myaddress.org. The value for the flag option will be 5 (1+4):

!addredirect foobar.myadress.org -f 5

If there is no redirect set for an event, Verlihub chooses the redirects with flag 0. For example suppose there are just two redirect, one to myhub.no-ip.org:4511 with flag 2 and the other to redirect.no-ip.org with flag 0. If you kick an user, there is no redirect with event flag 1 (ban and kick), so Verlihub redirects him to redirect.no-ip.org

If there are more than one redirect with same flag, Verlihub chooses randomly.

The default redirects are hardcoded into default_custom_redirects.sql and can't be deleted without modifying the file. Simply disable these using !modredirect hub.verlihub.net:7777 -e 0.

Old style redirects (Verlihub <= 0.9.8d RC2)

You can set up to 10 redirects where Verlihub redirects every disconnected user. The choice is made randomly among all of them although the first slot is likely to be chosen more often then the others.

In order to enable extra redirect slots you must set the redir_host_max variable accordingly. For example if you have set redirect from slot 0 to 3, you should set redir_host_max to 3 and not to 4 (this would enable the empty slot redir_host4 leaving open the possibility of dead user connections).

It is important that you set a redirect host for your hub although this is not imperative. Please be warned if you have a busy hub and you wish to disable redirects by setting the first redirect slot to your own hub address, keep in mind that the users you are trying to redirect have already been rejected by your hub. Leaving these users in a connection loop will not help your hub stability.

You can disable redirects using this command:

!set redir_host_max -1

To set up redirect use:

!set redir_host# <address:port>

where # indicated the redirect number (from 0 to 9) and the address of the hub where you want to redirect users