Skip to content
Dialer with SRV lookup
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.gitignore
LICENSE
README.md
dial.go
dial_test.go
http.go

README.md

koron-go/dialsrv

GoDoc CircleCI Go Report Card

Dialer with SRV lookup.

Sample codes

HTTP

import "github.com/koron-go/dialsrv"

// query SRV records for "_myservice._tcp.example.com" then make HTTP GET.
r, err := dialsrv.HTTPClient.Get("http://srv+myservice+example.com/")
// TODO: work with r and err as usual.
// GET from example.com without SRV.
r, err := dialsrv.HTTPClient.Get("http://example.com/")
// TODO: work with r and err as usual.
import "net/http"

// replace http.DefaultClient
http.DefaultClient = dialsrv.HTTPClient
r, err := http.Get("http://srv+myservice+example.com/")
// TODO: work with r and err as usual.

Dialer

import "net"
import "github.com/koron-go/dialsrv"

// wrap *net.Dialer with SRV record querying
d := dialsrv.New(&net.Dialer{/* net.Dialer with your configurations */})

Acceptable formats

  • srv+{service}+{hostname} - SRV for _{service}._{network}.{hostname}
  • srv+{hostname} - SRV for {hostname}
You can’t perform that action at this time.