- Saved searches
- Use saved searches to filter your results more quickly
- rustutam/DNS-server
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- merrychap/dns-cache
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- jayvdb/dns-cache
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- SemyonMakhaev/dns-server
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
rustutam/DNS-server
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Асбапов Рустам Русланович, КН-202
Этот репозиторий содержит код для кэширующего DNS-сервера, написанного на языке Python. Кэширующий DNS-сервер предоставляет механизм кэширования DNS-запросов и ответов, что позволяет ускорить процесс разрешения DNS-имен и уменьшить нагрузку на сеть
Как работает кэширующий DNS-сервер
Кэширующий DNS-сервер реализует следующую логику работы:
- Ожидание входящих DNS-запросов от клиентов.
- Извлечение запрошенного домена из DNS-запроса.
- Проверка наличия записи в кэше для данного домена.
- Если запись присутствует в кэше и ее срок действия (TTL) не истек, сервер возвращает клиенту ответ, основанный на кэшированной записи.
- Если запись отсутствует в кэше или истек срок ее действия, сервер отправляет запрос на резолвер верхнего уровня, такой как публичные DNS-серверы, для получения актуальных данных.
- Полученный ответ от резолвера верхнего уровня сохраняется в кэше и отправляется клиенту.
Для запуска сервера выполните следующие шаги:
- Откройте командную строку (терминал) и перейдите в каталог, где находится файл main.py .
- Запустите сервер, выполнив следующую команду:
По умолчанию, сервер будет слушать на адресе 127.0.0.1 и порту 53 .
Ниже представлен пример работы сервера с использованием утилиты nslookup и скриншот результатов:
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
⚓ Implementation of a caching DNS server. All operations are correspond to RFC 1035
License
merrychap/dns-cache
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Implementation of a caching DNS Server
This is an implementation of a UDP caching DNS server written in Python3. All written operations are correspond to RFC 1035
To run a server use the next command:
Argument | Description |
---|---|
-h, —help | Show this help message and exit |
-p P | Port for running a server |
-f F | Address of a forwarder written in format IP:Port. Port can be omitted |
For example, you run a server on 9090 port. Then you can make queries to it by typing the next command (get A records from google.com):
dig +notcp @127.0.0.1 -p 9090 google.com A
$ python3 dns.py -p 9090 -f 8.8.8.8 [+] Server is configurated [+] Server is running on 9090 port 2017-05-09 20:14:50 -- [*] 127.0.0.1 A google.com. forwader 2017-05-09 20:14:51 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:52 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:52 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:52 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:53 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:53 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:14:54 -- [*] 127.0.0.1 A google.com. cache 2017-05-09 20:15:02 -- [*] 127.0.0.1 A ya.ru. forwader 2017-05-09 20:15:03 -- [*] 127.0.0.1 A ya.ru. cache 2017-05-09 20:15:05 -- [*] 127.0.0.1 NS ya.ru. forwader 2017-05-09 20:15:06 -- [*] 127.0.0.1 NS ya.ru. cache
About
⚓ Implementation of a caching DNS server. All operations are correspond to RFC 1035
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
DNS lookup cache for Python using dnspython
License
jayvdb/dns-cache
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
dns-cache is a Python client side DNS caching framework utilising dnspython v1.15+ for DNS and supports various local key stores, and provides caching of lookup failures, and configurable expiration of cached responses.
Some reasons to use a client side cache include:
- processing data containing many repeated invalid domains,
- running a local DNS caching service is not practical or appropriate,
- adding reporting of DNS activity performed within a job.
The recommended way to install dns-cache is by using pip as follows:
To quickly benefit from client side dns-caching in your existing application, install the system resolver.
import dns_cache import requests dns_cache.override_system_resolver() for i in range(10): requests.get('http://www.coala.io/')
If you have a fast dns proxy, 10 requests will possibly show no performance improvement. Even 100 may not perform better in this contrived example.
However when many parts of a system are performing lookups on the same DNS records, or where sessions are being closed and new ones created and need to access the same DNS records, the difference becomes more noticable, especially in jobs which takes hours to run.
For long running jobs, use the min_ttl argument to increase the default if 5 minutes isnt sufficient. It can be set to dns_cache.NO_EXPIRY for a ttl of one week, which is not recommended except when accompanied with custom cache expiration logic.
Multiple key stores are supported, and their dependencies need to added separately as required.
- pickle and pickle4 backport: dns_cache.pickle.PickableCache
- diskcache : dns_cache.diskcache.DiskCache
- stash.py : dns_cache.stash.StashCache
- sqlitedict : dns_cache.sqlitedict.SqliteDictCache
- disk_dict : dns_cache.disk_dict.DiskDictCache (Python 2.7 only)
stash.py support uses pickle or jsonpickle on Python 3, however only jsonpickle works on Python 2.7.
The following classes can be used separately or together.
- dns_cache.resolver.AggressiveCachingResolver : indexes all qnames in the response, increasing the number of keys, but reducing the number of requests and cached responses when several related records are requested, such as a HTTP redirect from www.foo.com to foo.com (or vis versa) where one is a CNAME point to the other.
- dns_cache.resolver.ExceptionCachingResolver : caches lookup failures.
- dns_cache.hosts.HostsCache : preloads hosts (e.g. /etc/hosts ) into a cache
Note: dns_cache.override_system_resolver() can be used to install a custom resolver or cache , which may be derived from the above classes or your own implementation from scratch. It preloads /etc/hosts .
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
SemyonMakhaev/dns-server
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
The program binds a given host and 53 port, so user should have administrator privillages. The program also nesessary takes a forwarder address and port because it’s cache is empty in the moment after launch.
Server receives clients requests and looks for requested names in it’s cache. If there is a record in the cache and this record is actual (a records TTL is not exceeded), server sends a response to client. In the opposit case server sends this request to it’s forwarder and takes the forwarder information to answer to the client and to write it to cache.
Server keeps records in it’s cache by domain names. It also keeps a response package, a time of this record making and it’s TTL for each of record. Server changes information about deprecated records.
By default cache record TTL is set to 15 minutes. It can be changed in configurations of the file cache_record.py
Server can be stoped any time during it works by typing a special command: «close». Closing command can be changed in configurations of a main file.
For a help message showing use —help or -h argument.