]>
git.proxmox.com Git - pmg-api.git/blob - PMG/RuleDB/IPNet.pm
1 package PMG
::RuleDB
::IPNet
;
9 use PMG
::RuleDB
::WhoRegex
;
11 use base
qw(PMG::RuleDB::WhoRegex);
26 my ($type, $address, $ogroup) = @_;
28 my $class = ref($type) || $type;
30 $address //= '127.0.0.1/32';
32 my $self = $class->SUPER::new
($address, $ogroup);
38 my ($self, $addr, $ip) = @_;
41 # use queue->{xforward}->{addr} for from match
42 # dont know what to do in To match
46 my $cidr = Net
::CIDR
::Lite-
>new;
47 $cidr->add($self->{address
});
49 return $cidr->find($ip);
57 description
=> "Network address in CIDR notation.",
58 type
=> 'string', format
=> 'CIDR',
66 return { cidr
=> $self->{address
} };
70 my ($self, $param) = @_;
72 $self->{address
} = $param->{cidr
};
79 =head1 PMG::RuleDB::IPNet
81 A WHO object to check sender IP addresses.
87 An IP address/network (CIDR representation).
91 $obj = PMG::RuleDB::IPNet->new ('192.168.2.0/20');