Add per-network 'vhost' and 'vhostv6' config variables

This commit is contained in:
Valentin Lorentz 2024-05-21 21:19:14 +02:00
parent 4898926f20
commit 5b2b38ab37
2 changed files with 13 additions and 2 deletions

View File

@ -419,6 +419,15 @@ def registerNetwork(name, password='', ssl=True, sasl_username='',
registry.String('', _("""Determines what user modes the bot will request registry.String('', _("""Determines what user modes the bot will request
from the server when it first connects. If empty, defaults to from the server when it first connects. If empty, defaults to
supybot.protocols.irc.umodes"""))) supybot.protocols.irc.umodes""")))
registerGlobalValue(network, 'vhost',
registry.String('', _("""Determines what vhost the bot will bind to before
connecting a server (IRC, HTTP, ...) via IPv4. If empty, defaults to
supybot.protocols.irc.vhost""")))
registerGlobalValue(network, 'vhostv6',
registry.String('', _("""Determines what vhost the bot will bind to before
connecting a server (IRC, HTTP, ...) via IPv6. If empty, defaults to
supybot.protocols.irc.vhostv6""")))
sasl = registerGroup(network, 'sasl') sasl = registerGroup(network, 'sasl')
registerGlobalValue(sasl, 'username', registry.String(sasl_username, registerGlobalValue(sasl, 'username', registry.String(sasl_username,
_("""Determines what SASL username will be used on %s. This should _("""Determines what SASL username will be used on %s. This should

View File

@ -312,8 +312,10 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
address, address,
port=self.currentServer.port, port=self.currentServer.port,
socks_proxy=socks_proxy, socks_proxy=socks_proxy,
vhost=conf.supybot.protocols.irc.vhost(), vhost=self.networkGroup.get('vhost')()
vhostv6=conf.supybot.protocols.irc.vhostv6(), or conf.supybot.protocols.irc.vhost(),
vhostv6=self.networkGroup.get('vhostv6')()
or conf.supybot.protocols.irc.vhostv6(),
) )
except socket.error as e: except socket.error as e:
drivers.log.connectError(self.currentServer, e) drivers.log.connectError(self.currentServer, e)