https://github.com/orlo/dns-hostname-expansion
PHP library for expanding a DNS record into multiple hostnames
https://github.com/orlo/dns-hostname-expansion
library php php8
Last synced: 5 months ago
JSON representation
PHP library for expanding a DNS record into multiple hostnames
- Host: GitHub
- URL: https://github.com/orlo/dns-hostname-expansion
- Owner: orlo
- License: mit
- Created: 2024-12-04T12:34:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-06T08:56:18.000Z (over 1 year ago)
- Last Synced: 2025-09-19T23:00:08.990Z (10 months ago)
- Topics: library, php, php8
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TL;DR ?
ElasticSearch (for example) needs a list of hosts to talk to, for instance :
* https://host1:9200
* https://host2:9200 etc
This allows you to have a single DNS record (e.g. in Route53) which responds with multiple A records, which then get formatted into an appropriate list, e.g
* DNS record: elasticsearch.test.org resolves to 1.2.3.4, 1.2.3.5, 1.2.4.6
* Becomes: https://1.2.3.4:9200, https://1.2.3.5:9200, https://1.2.3.6:9200
The prefix + suffix used in decoration are configurable and could be omitted.
In the event DNS lookup fails, we fall back to returning the passed in host - e.g. https://elasticsearch.test.org:9200
# Usage
* composer require orlo/dns-hostname-expansion
* ...
```php