Documentation
¶
Overview ¶
Package srv simplify connecting to services by resolving SRV query and then connect to it in order of priority.
A complete list of Service Name and Transport Protocol Port Number is found at: http://www.iana.org/assignments/service-names-port-numbers
Index ¶
- func Dial(protocol, address string) (net.Conn, error)
- func DialSRV(service, protocol, domain string) (net.Conn, error)
- func DialTCP(localAddr *net.TCPAddr, address string) (*net.TCPConn, error)
- func DialUDP(localAddr *net.UDPAddr, address string) (*net.UDPConn, error)
- func Lookup(protocol, address string) ([]net.Addr, error)
- func LookupSRV(service, protocol, domain string) ([]net.Addr, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial resolves a DNS SRV query of the given address. Then it will attempt to connect to the service in order priority.
Values for protocol are "tcp" or "udp", address is in the form: domain:service
Examples:
conn, err := Dial("tcp", "example.com:xmpp-client") conn, err := Dial("udp", "example.com:stun")
func DialSRV ¶
DialSRV resolves a DNS SRV query of the given service, protocol and domain name. Then it will attempt to connect to the service in order priority.
Values for protocol are "tcp" or "udp".
Examples:
conn, err := DialSRV("xmpp-client", "tcp", "example.com") conn, err := DialSRV("stun", "udp", "example.com")
func DialTCP ¶
DialTCP resolves and connects the given address.
Address is in the form: domain:service. If localAddr is not nil, it is used as the local address for the connection.
Examples:
conn, err := DialTCP(nil, "example.com:xmpp-client")
func DialUDP ¶
DialUDP resolves and connects the given address.
Address is in the form: domain:service. If localAddr is not nil, it is used as the local address for the connection.
Examples:
conn, err := DialUDP(nil, "example.com:stun")
func Lookup ¶
Lookup resolves a SRV query of the given protocol and address
Values for protocol are "tcp" or "udp" address is in the form: domain:service
Examples:
Lookup("tcp", "example.com:xmpp-client") Lookup("udp", "example.com:stun")
The returned records are net.Addr containing the CNAME and port of the service, sorted by priority and randomized by weight within a priority.
func LookupSRV ¶
LookupSRV resolves a SRV query of the given service, protocol, and domain name. Values for protocol are "tcp" or "udp"
LookupSRV constructs the DNS name to look up following RFC 2782. That is, it looks up _service._proto.name. To accommodate services publishing SRV records under non-standard names.
The returned records are net.Addr containing the CNAME and port of the service, sorted by priority and randomized by weight within a priority.
Types ¶
This section is empty.