Skip to content

A simple package for resolving SRV records being served by SkyDNS

License

Notifications You must be signed in to change notification settings

levenlabs/go-srvclient

Repository files navigation

go-srvclient

GoDoc Report

A simple package for resolving DNS SRV records, according to the algorithm set forth in that project's README. It simply takes in a hostname and does a SRV request against it. It wil then look at all the returned entries and make a weighted random choice of one of them, returning a string which is the "host:port" of the picked entry.

Does not work on Windows.

Install

go get github.com/levenlabs/go-srvclient

Example

package main

import "github.com/levenlabs/go-srvclient"

func main() {
  addr, err := srvclient.SRV("foo.skydns.local")
  if err != nil {
    fmt.Fatal(err)
  }

  log.Printf("%s was chosen!", addr)
}

Binary client

This project also has an installable binary client which can be easily used. It can be installed with:

go install github.com/levenlabs/go-srvclient/srvclient

And used like so:

# srvclient some.host.name
8.9.10.11:1213

About

A simple package for resolving SRV records being served by SkyDNS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages