]>
git.proxmox.com Git - pmg-api.git/blob - src/PMG/RuleDB/IPNet.pm
1 package PMG
::RuleDB
::IPNet
;
9 use PMG
::RuleDB
::WhoRegex
;
11 use base
qw(PMG::RuleDB::WhoRegex);
22 my ($type, $address, $ogroup) = @_;
24 my $class = ref($type) || $type;
26 $address //= '127.0.0.1/32';
28 my $self = $class->SUPER::new
($address, $ogroup);
34 my ($self, $addr, $ip) = @_;
38 my $cidr = Net
::CIDR
::Lite-
>new;
39 $cidr->add($self->{address
});
41 return $cidr->find($ip);
49 description
=> "Network address in CIDR notation.",
50 type
=> 'string', format
=> 'CIDR',
58 return { cidr
=> $self->{address
} };
62 my ($self, $param) = @_;
64 $self->{address
} = $param->{cidr
};
71 =head1 PMG::RuleDB::IPNet
73 A WHO object to check sender IP addresses.
79 An IP address/network (CIDR representation).
83 $obj = PMG::RuleDB::IPNet->new ('192.168.2.0/20');