better documentation

This commit is contained in:
Miek Gieben 2011-07-31 14:33:13 +02:00
parent 4925a831aa
commit faaf0d6b8f

View File

@ -125,7 +125,7 @@ type Client struct {
// LocalAddr string // Local address to use // LocalAddr string // Local address to use
} }
// Create a new client, with some defaults. // NewClient creates a new client, with Net set to "udp" and Attempts to 1.
func NewClient() *Client { func NewClient() *Client {
c := new(Client) c := new(Client)
c.Net = "udp" c.Net = "udp"
@ -179,7 +179,7 @@ func (w *reply) Write(m *Msg) {
} }
// Do performs an asynchronous query. The result is returned on the // Do performs an asynchronous query. The result is returned on the
// channel set in the c. // channel set in the c. If no channel is set DefaultQueryChan is used.
func (c *Client) Do(m *Msg, a string) { func (c *Client) Do(m *Msg, a string) {
if c.ChannelQuery == nil { if c.ChannelQuery == nil {
DefaultQueryChan <- &Request{Client: c, Addr: a, Request: m} DefaultQueryChan <- &Request{Client: c, Addr: a, Request: m}
@ -188,8 +188,8 @@ func (c *Client) Do(m *Msg, a string) {
} }
} }
// Perform an synchronous query. Send the message m to the address // Exchange performs an synchronous query. It sends the message m to the address
// contained in a and wait for an reply. // contained in a and waits for an reply.
func (c *Client) Exchange(m *Msg, a string) *Msg { func (c *Client) Exchange(m *Msg, a string) *Msg {
w := new(reply) w := new(reply)
w.client = c w.client = c