Thanks dears,

 

From: Brian Candler [mailto:[email protected]] 
Sent: Monday, April 23, 2018 6:43 PM
To: Hamed Haghshenas <[email protected]>;
[email protected]
Subject: Re: [Pdns-users] define several IP Subnet for one service in GeoIP
backend

 

On 23/04/2018 10:36, Hamed Haghshenas wrote:

I know, it's work with your example but I have many client subnet in my
network about 150 subnets .

 

So a little hard to write every subnet in separated line,I want to find a
way to combine these in one line for every service .

The configuration is YAML, so it's very easy to write a script to convert
from some local representation (in whatever format is convenient for you to
maintain) to the format that PDNS requires.

 

#!/usr/bin/python
import yaml

s1 = yaml.load("""
193.178.201.0/24,188.158.188.0/24: tcar.geo.gadgetworld.ir
""")
s2 = {}

for k, v in s1.items():
    for i in k.split(","):
        s2[i] = v

print(yaml.dump(s2, default_flow_style=False))

_______________________________________________
Pdns-users mailing list
[email protected]
https://mailman.powerdns.com/mailman/listinfo/pdns-users

Reply via email to