Download the PHP package karelwintersky/arris.toolkit.firewall without Composer
On this page you can find all versions of the php package karelwintersky/arris.toolkit.firewall. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download karelwintersky/arris.toolkit.firewall
More information about karelwintersky/arris.toolkit.firewall
Files in karelwintersky/arris.toolkit.firewall
Download karelwintersky/arris.toolkit.firewall
More information about karelwintersky/arris.toolkit.firewall
Files in karelwintersky/arris.toolkit.firewall
Vendor karelwintersky
Package arris.toolkit.firewall
Short Description Library providing IP filtering features
License MIT
Package arris.toolkit.firewall
Short Description Library providing IP filtering features
License MIT
Please rate this library. Is it a good library?
Informations about the package arris.toolkit.firewall
Arris.Toolkit.Firewall
Readme in Russian - README.RU.md
Library providing IP filtering features
Type | Syntax | Details |
---|---|---|
IPV4 | 192.168.0.1 |
|
Range | 192.168.0.0-192.168.1.60 |
Includes all IPs from 192.168.0.0 to 192.168.0.255 and from 192.168.1.0 to 198.168.1.60 |
Wild card | 192.168.0.* |
IPs starting with 192.168.0 Same as IP Range 192.168.0.0-192.168.0.255 |
CIDR Mask | 192.168.0.0/24 |
IPs starting with 192.168.0 Same as 192.168.0.0-192.168.0.255 and 192.168.0.* and 192.168.0.0/255.255.255.0 |
NB! Range like 192.168.0.0/255.255.255.0
with subnet mask not supported (as deprecated)!
Basic usage
Use composer:
Constructor
defaultState
- rule for range*.*.*.*
. Default false, i.e. FORBIDDEN. Allowed options:null
(equal to false)true|false
FireWallState::FORBIDDEN
илиFireWallState::ALLOWED
deferred_range_sorting
- use lazy range sorting:true
: at validate() call; use it if you test only one IP at once, most cases)false
: at addAnyList() call; use it if you test a lot if IPs with one ruleset
Add ranges
addWhiteList()
- add range to White list (Allowed), alias ofaddAllowed()
addBlackList()
- add range to Black List (Forbidden), alias ofaddDenied()
Argument is string or array of strings
192.168.0.1
- alone IP192.168.0.0-192.168.1.60
- range192.168.0.*
- wildcard range (allowed range*
, that is equal to*.*.*.*
)192.168.0.0/24
- CIDR range
Range 192.168.0.0/255.255.255.0
not supported now.
addRange(range, type)
- type is FireWallState enum value
Сomplex and redundant example
Nuances
- when ranges overlap, the one with the lower power is "stronger"
- when ranges of equal power overlap, the result is not defined (most likely, the one that was declared earlier will be used)
How does it work?
- We set IP ranges (white and black)
- Whether the full range (
*.*.*.*
) belongs to the black/white list depends on the settings - Range powers are calculated
- Ranges are sorted by power
- The shortest range is found that includes the tested IP
- The type of this range is the state for the IP - ALLOWED or FORBIDDEN
License
Firewall is licensed under the MIT license.
All versions of arris.toolkit.firewall with dependencies
PHP Build Version
Package Version
Requires
php Version
8.*
The package karelwintersky/arris.toolkit.firewall contains the following files
Loading the files please wait ....