Commit 45c43554 authored by Zou Nengren's avatar Zou Nengren Committed by Miek Gieben

make Prot to method (#3500)

Signed-off-by: default avatarzouyee <zounengren@cmss.chinamobile.com>
parent 13fca023
...@@ -111,15 +111,11 @@ func (r *Request) RemoteAddr() string { return r.W.RemoteAddr().String() } ...@@ -111,15 +111,11 @@ func (r *Request) RemoteAddr() string { return r.W.RemoteAddr().String() }
func (r *Request) LocalAddr() string { return r.W.LocalAddr().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. // Proto gets the protocol used as the transport. This will be udp or tcp.
func (r *Request) Proto() string { return Proto(r.W) } func (r *Request) Proto() string {
if _, ok := r.W.RemoteAddr().(*net.UDPAddr); ok {
// 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 {
return "udp" return "udp"
} }
if _, ok := w.RemoteAddr().(*net.TCPAddr); ok { if _, ok := r.W.RemoteAddr().(*net.TCPAddr); ok {
return "tcp" return "tcp"
} }
return "udp" return "udp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment