{"id":16506392,"url":"https://github.com/neomantra/srv-plz","last_synced_at":"2025-10-10T21:40:27.818Z","repository":{"id":64307418,"uuid":"465388902","full_name":"neomantra/srv-plz","owner":"neomantra","description":"SRV record extractor with custom resolver","archived":false,"fork":false,"pushed_at":"2023-04-16T17:30:54.000Z","size":21,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T14:21:23.304Z","etag":null,"topics":["srv"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neomantra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-02T16:43:38.000Z","updated_at":"2025-02-13T21:50:04.000Z","dependencies_parsed_at":"2024-06-20T11:01:52.207Z","dependency_job_id":"db436ba2-3807-4cf6-92ff-8b4c37449af0","html_url":"https://github.com/neomantra/srv-plz","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/neomantra/srv-plz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neomantra%2Fsrv-plz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neomantra%2Fsrv-plz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neomantra%2Fsrv-plz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neomantra%2Fsrv-plz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neomantra","download_url":"https://codeload.github.com/neomantra/srv-plz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neomantra%2Fsrv-plz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005419,"owners_count":26083883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["srv"],"created_at":"2024-10-11T15:19:31.560Z","updated_at":"2025-10-10T21:40:27.777Z","avatar_url":"https://github.com/neomantra.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# srv-plz - SRV record extractor\n\n## *Service Please!*\n\n`srv-plz` looks up a [DNS SRV record](https://en.wikipedia.org/wiki/SRV_record) from the specified DNS server\nand outputs the result.\n\n```\n$ SRV_DNS=127.0.0.1:8600 srv-plz example.service.consul\n```\n\n`srv-plz` includes support for injecting SRV records into invoked commands.  This is useful for enhancing tools like `curl` which do not support SRV records (it is on curl's [TODO list](https://curl.se/docs/todo.html#SRV_and_URI_DNS_records)).  Here we recursively resolve a [Consul](https://consul.io) query and invoke `curl` in a URL with the result: \n\n```\n$ SRV_DNS=127.0.0.1:8600 srv-plz example.service.consul -r -c -- curl https://%SRV%/health\n```\n\n## Usage\n\n```\n$ srv-plz --help\nusage:  srv-plz \u003coptions\u003e [service1 [service2 [...]]] [-- command]\n\nsrv-plz resolves DNS SRV records and outputs the result.\n\nThe resolver is specified with \"--dns \u003cIP:port\u003e\" argument or by setting\nthe SRV_DNS environment variable.  If only an IP address is set, port 53 is used.\n\nIf no DNS resolver is specified, the system resolver is used.\n\nThe default output is \"host:port\".  This may be customized with the --template\nargument.  Possible fields are Target, Port, Priority, and Weight.\nThe default template is \"{{.Target}}:{{.Port}}\\n\" for SRV records and \"{{.Target}}\\n\" for A/AAAA records.\n\nIf \"--command\" is flagged, each SRV record will be injected into the command\nspecified after \"--\", using \"%SRV%\" or the \"--match\" argument as a matcher.  Example:\n\n    srv-plz webserver.service.consul -r -c -- curl https://%SRV%/health\n\nArguments:\n  -a, --a                 Check A records, not SRV records\n  -6, --aaaa              Check AAAA records, not SRV records\n  -c, --command           for each record, invoke exec.Command on the args after '--', replacing %SRV% with its template\n  -d, --dns string        DNS resolver to use. Must be in form IP (using port 53) or IP:port\n  -h, --help              show help\n  -l, --limit uint32      only return N records (default 1)\n  -m, --match string      specify forward args after '--' to shell with \u003csrv\u003e replaced by the lookup (default \"%SRV%\")\n  -r, --recurse           recurse with the same resolver\n  -t, --template string   output using template (default \"{{.Target}}:{{.Port}}\")\n```\n\n----\n\n## Installing\n\nBinaries for multiple platforms are [released on GitHub](https://github.com/neomantra/srv-plz/releases) through [GitHub Actions](https://github.com/neomantra/srv-plz/actions).\n\nYou can also install for various platforms with [Homebrew](https://brew.sh) from [`neomantra/homebrew-tap`](https://github.com/neomantra/homebrew-tap):\n\n```\nbrew tap neomantra/homebrew-tap\nbrew install srv-plz\n```\n\n----\n\n## Example Usage\n\n### Lookup with system resolver, without or with recursion:\n\n```\n$ srv-plz _http._tcp.mxtoolbox.com\nmxtoolbox.com.:80\n\n$ srv-plz -r _http._tcp.mxtoolbox.com\n13.225.202.38:80\n```\n\n### Lookup with custom resolver, either via CLI or `SRV_DNS` environment variable:\n\n```\n$ srv-plz -d 10.4.20.69:8600 -r webserver.service.consul \n10.4.20.69:55420\n\n$ SRV_DNS=10.4.20.69:8600 srv-plz -r webserver.service.consul \n10.4.20.69:55420\n```\n\n### Lookup with a custom output template.  Note the shell expression `$'\\n'` is used to include a newline at the end.\n\n```\n$ srv-plz -d 10.4.20.69:8600 -r webserver.service.consul -t $'t:{{.Target}} p:{{.Port}} w:{{.Weight}} p:{{.Priority}}\\n'\nt:10.0.10.25 p:26877 w:1 p:1\n```\n\n### Check a URL with multiple records of multiple services using curl:\n\n```\n$ srv-plz -d consul.example.com:8600 -r -n 10 -c webserver.service.consul other.service.consul -- curl -s http://%SRV%/health\n```\n\n----\n\n## Building\n\nBuilding is performed with [task](https://taskfile.dev/):\n\n```\n$ task\ntask: [build] go build -o srv-plz cmd/srv-plz/main.go\n```\n\n----\n\n## Credits and License\n\nThanks to [github.com/miekg/dns](https://github.com/miekg/dns) for the heavy lifting.\n\nCopyright (c) 2022-2023 Neomantra BV.  Authored by Evan Wies.\n\nReleased under the [MIT License](https://en.wikipedia.org/wiki/MIT_License), see [LICENSE.txt](./LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneomantra%2Fsrv-plz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneomantra%2Fsrv-plz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneomantra%2Fsrv-plz/lists"}