mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
middleware/proxy: multiple enhancements (#145)
Add port 53 in the proxy host if not specified. Check if the host is actually an IP address (v4 or v6) Remove the http headers and other TODOs
This commit is contained in:
@@ -53,13 +53,15 @@ func (s *State) RemoteAddr() string {
|
||||
return s.W.RemoteAddr().String()
|
||||
}
|
||||
|
||||
// Proto gets the protocol used as the transport. This
|
||||
// will be udp or tcp.
|
||||
func (s *State) Proto() string {
|
||||
if _, ok := s.W.RemoteAddr().(*net.UDPAddr); ok {
|
||||
// Proto gets the protocol used as the transport. This will be udp or tcp.
|
||||
func (s *State) Proto() string { return Proto(s.W) }
|
||||
|
||||
// Proto gets the protocol used as the transport. This will be udp or tcp.
|
||||
func Proto(w dns.ResponseWriter) string {
|
||||
if _, ok := w.RemoteAddr().(*net.UDPAddr); ok {
|
||||
return "udp"
|
||||
}
|
||||
if _, ok := s.W.RemoteAddr().(*net.TCPAddr); ok {
|
||||
if _, ok := w.RemoteAddr().(*net.TCPAddr); ok {
|
||||
return "tcp"
|
||||
}
|
||||
return "udp"
|
||||
|
||||
Reference in New Issue
Block a user