mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-05 16:23:52 +02:00
MINOR: lua: add ip addresses and network manipulation function
Add two functions core.parse_addr() and core.match_addr() where are used for matching networks.
This commit is contained in:
committed by
Willy Tarreau
parent
65192f35d2
commit
62fec75183
@@ -582,6 +582,28 @@ Core class
|
||||
Give back the hand at the HAProxy scheduler. It is used when the LUA
|
||||
processing consumes a lot of processing time.
|
||||
|
||||
.. js:function:: core.parse_addr(address)
|
||||
|
||||
**context**: body, init, task, action, sample-fetch, converter
|
||||
|
||||
:param network: is a string describing an ipv4 or ipv6 address and optionally
|
||||
its network length, like this: "127.0.0.1/8" or "aaaa::1234/32".
|
||||
:returns: a userdata containing network or nil if an error occurs.
|
||||
|
||||
Parse ipv4 or ipv6 adresses and its facultative associated network.
|
||||
|
||||
.. js:function:: core.match_addr(addr1, addr2)
|
||||
|
||||
**context**: body, init, task, action, sample-fetch, converter
|
||||
|
||||
:param addr1: is an address created with "core.parse_addr".
|
||||
:param addr2: is an address created with "core.parse_addr".
|
||||
:returns: boolean, true if the network of the addresses matche, else returns
|
||||
false.
|
||||
|
||||
Match two networks. For example "127.0.0.1/32" matchs "127.0.0.0/8". The order
|
||||
of network is not important.
|
||||
|
||||
.. _proxy_class:
|
||||
|
||||
Proxy class
|
||||
|
||||
Reference in New Issue
Block a user