haproxy/examples
Aurelien DARRAGON c75c41c35f EXAMPLES: fix IPV6 support for lua mailers script
While this used to work fine with legacy mailers, IPV6 server support
for lua mailers script was overlooked so it is currently broken.

Indeed, within the lua script, server address was parsed as an IPV4
address to extract both ip and port and pass them to smtp_send_email()
function from Thierry FOURNIER.

From lua point of view: when fetching server address from
ProxyMailers.mailservers, server ip and port are not separated. Each
server address is represented using haproxy server address custom-format
(the one used to specify server addresses within haproxy config,
see 11. Address formats in haproxy configuration manual):

It is a string that contains both proto hint, ip and port.
(Such addresses are manipulated using str2sa_range() and sa2str()
in haproxy's code)

Parsing these custom-format addresses from lua to support multiple address
families is feasible since the format is properly documented in haproxy
configuration.

However, to keep things simple, and given that smtp_send_email() relies
on Socket.connect() function to set-up the tcp connection:

Socket.connect() already supports the full server address custom-format
when no explicit port argument is provided. Thus with minor code changes
we're able to pass the server string as it is.

With this, IPV6 smtp servers from mailers section are now automatically
supported when using lua mailers script.
2023-05-09 11:53:28 +02:00
..
errorfiles
lua EXAMPLES: fix IPV6 support for lua mailers script 2023-05-09 11:53:28 +02:00
basic-config-edge.cfg
content-sw-sample.cfg
haproxy.init
option-http_proxy.cfg
quick-test.cfg
socks4.cfg
transparent_proxy.cfg
wurfl-example.cfg