You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
895 B

#!/usr/bin/env python2
""" DNS server
This script contains the code for starting a DNS server.
import dns.server
if __name__ == "__main__":
# Parse arguments
import argparse
parser = argparse.ArgumentParser(description="DNS Server")
parser.add_argument("-c", "--caching", action="store_true",
help="Enable caching")
parser.add_argument("-t", "--ttl", metavar="time", type=int, default=0,
help="TTL value of cached entries (if > 0)")
parser.add_argument("-p", "--port", type=int, default=5353,
help="Port which server listens on")
args = parser.parse_args()
# Start server
server = dns.server.Server(args.port, args.caching, args.ttl)
server.add_zone("", "")
except KeyboardInterrupt: