IP

Shieldon\Firewall\Component\Ip

  • 반환 self
$ip = new \Shieldon\Firewall\Component\Ip();
$shieldon->setComponent($ip);

inRange($ip, $range)

  • 매개변수 string $ip - IPV4 및 IPV6 형식의 확인할 IP
  • 매개변수 mixed $range - IP/CIDR 넷마스크
  • 반환 bool
$result = $ip->inRange('123.22.33.44', '123.22.33.1/24');

// true

setAllowedItems($ips)

  • 매개변수 array $ips - IP 주소의 컬렉션
  • 반환 void
$ip = new \Shieldon\Firewall\Component\Ip();

$allowedIps = [
    '123.22.33.44',
    '88.22.33.55',
];

$ip->setAllowedItems($allowedIps);
$shieldon->setComponent($ip);

setAllowedItem($ip)

  • 매개변수 string $ip - 단일 IP 주소
  • 반환 void
$ip = new \Shieldon\Firewall\Component\Ip();
$ip->setAllowedItem('123.22.33.44');
$shieldon->setComponent($ip);

getAllowedItems()

  • 반환 array
$ip = new \Shieldon\Firewall\Component\Ip();
$list = $ip->getAllowedItems();

// ['123.22.33.44', '123.22.33.43', 'xxx.xxx.xxx.xxx']

setDeniedItems($ips)

  • 매개변수 array $ips - IP 배열
  • 반환 void
$ip = new \Shieldon\Firewall\Component\Ip();

$deniedIps = [
    '123.22.33.44',
    '88.22.33.55',
];

$ip->setDenieddList($deniedIps);
$shieldon->setComponent($ip);

setDeniedItem($ip)

  • 매개변수 string $ip - 단일 IP 주소
  • 반환 void
$ip = new \Shieldon\Firewall\Component\Ip();
$ip->setDeniedItem('123.22.33.44');
$shieldon->setComponent($ip);

getDeniedItems()

  • 반환 array
$ip = new \Shieldon\Firewall\Component\Ip();
$list = $ip->getDeniedItems();

// ['123.22.33.44', '123.22.33.43', 'xxx.xxx.xxx.xxx']