Add RemoteAddr() to the RequestWriter interface
This commit is contained in:
parent
2385ca18a3
commit
2574856aa6
17
client.go
17
client.go
|
@ -15,7 +15,11 @@ type QueryHandler interface {
|
|||
// The RequestWriter interface is used by a DNS query handler to
|
||||
// construct a DNS request.
|
||||
type RequestWriter interface {
|
||||
// Write returns the request message and the reply back to the client.
|
||||
// RemoteAddr returns the net.Addr of the server
|
||||
RemoteAddr() net.Addr
|
||||
// TsigStatus returns the TSIG validation status.
|
||||
TsigStatus() error
|
||||
// Write returns the request message and the reply back to the client (i.e. your Go code).
|
||||
Write(*Msg) error
|
||||
// Send sends the message to the server.
|
||||
Send(*Msg) error
|
||||
|
@ -25,8 +29,6 @@ type RequestWriter interface {
|
|||
Close() error
|
||||
// Dials calls the server.
|
||||
Dial() error
|
||||
// TsigStatus returns the TSIG validation status.
|
||||
TsigStatus() error
|
||||
}
|
||||
|
||||
// hijacked connections...?
|
||||
|
@ -222,6 +224,15 @@ func (w *reply) Write(m *Msg) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (w *reply) RemoteAddr() net.Addr {
|
||||
if w.conn == nil {
|
||||
return nil
|
||||
} else {
|
||||
return w.conn.RemoteAddr()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Do performs an asynchronous query. The result is returned on the
|
||||
// QueryChan channel set in the *Client c. Basic use pattern for
|
||||
// sending message m to the server listening on port 53 on localhost
|
||||
|
|
Loading…
Reference in New Issue