diff options
author | 2019-12-06 19:21:34 +0800 | |
---|---|---|
committer | 2019-12-06 11:21:34 +0000 | |
commit | 45c43554a8fea6252986bbd50307ed6300894892 (patch) | |
tree | f5c44567c8a3520c58c2c245db38b6bd163a3053 /request | |
parent | 13fca02316b85168bbc56691aa0251b1df403407 (diff) | |
download | coredns-45c43554a8fea6252986bbd50307ed6300894892.tar.gz coredns-45c43554a8fea6252986bbd50307ed6300894892.tar.zst coredns-45c43554a8fea6252986bbd50307ed6300894892.zip |
make Prot to method (#3500)
Signed-off-by: zouyee <zounengren@cmss.chinamobile.com>
Diffstat (limited to 'request')
-rw-r--r-- | request/request.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/request/request.go b/request/request.go index 76bb6a787..7374b0bd6 100644 --- a/request/request.go +++ b/request/request.go @@ -111,15 +111,11 @@ func (r *Request) RemoteAddr() string { return r.W.RemoteAddr().String() } func (r *Request) LocalAddr() string { return r.W.LocalAddr().String() } // Proto gets the protocol used as the transport. This will be udp or tcp. -func (r *Request) Proto() string { return Proto(r.W) } - -// Proto gets the protocol used as the transport. This will be udp or tcp. -func Proto(w dns.ResponseWriter) string { - // FIXME(miek): why not a method on Request - if _, ok := w.RemoteAddr().(*net.UDPAddr); ok { +func (r *Request) Proto() string { + if _, ok := r.W.RemoteAddr().(*net.UDPAddr); ok { return "udp" } - if _, ok := w.RemoteAddr().(*net.TCPAddr); ok { + if _, ok := r.W.RemoteAddr().(*net.TCPAddr); ok { return "tcp" } return "udp" |