func (s *Server) handle(h ProtocolHandler, c net.Conn, header []byte, readErr error) { proxy := utils.NewProxyConn(c, header, readErr) x, err := h.Handle(proxy) if err != nil { s.Logger("Handling %v as %v failed: %v", c.RemoteAddr(), h, err) } if x != nil { if s.Logger != nil { s.Logger("Handling %v as %v (transport)", c.RemoteAddr(), h) } s.HandleConnection(x) } else { if s.Logger != nil { s.Logger("Handling %v as %v", c.RemoteAddr(), h) } } }
func (s *Server) handle(h Protocol, c net.Conn, hints []interface{}, header []byte, readErr error) { proxy := utils.NewProxyConn(c, header, readErr) proxy.SetHints(hints) transport, err := h.Handle(proxy) if err != nil { s.Logger("Handling %v as %v failed: %v", c.RemoteAddr(), h, err) } if transport != nil { if s.Logger != nil { s.Logger("Handling %v as %v (transport)", c.RemoteAddr(), h) } if x, ok := transport.(utils.HintedConn); ok { hints = x.Hints() } s.HandleConn(transport, hints) } else { if s.Logger != nil { s.Logger("Handling %v as %v", c.RemoteAddr(), h) } } }