code: func (s *Server) handleRequest(req *Request, conn conn) error {
  	ctx := context.Background()
  
  	// Resolve the address if we have a FQDN
  	dest := req.DestAddr
  	if dest.FQDN != "" {
  		ctx_, addr, err := s.config.Resolver.Resolve(ctx, dest.FQDN)
  		if err != nil {
  			if err := sendReply(conn, hostUnreachable, nil); err != nil {
  				return fmt.Errorf("Failed to send reply: %v", err)
  			}
  			return fmt.Errorf("Failed to resolve destination '%v': %v", dest.FQDN, err)
  		}
  		ctx = ctx_
  		dest.IP = addr
  	}
  
  	// Apply any address rewrites
  	req.realDestAddr = req.DestAddr
  	if s.config.Rewriter != nil {
  		ctx, req.realDestAddr = s.config.Rewriter.Rewrite(ctx, req)
  	}
  
  	// Switch on the command
  	switch req.Command {
  	case ConnectCommand:
  		return s.handleConnect(ctx, conn, req)
  	case BindCommand:
  		return s.handleBind(ctx, conn, req)
  	case AssociateCommand:
  		return s.handleAssociate(ctx, conn, req)
  	default:
  		if err := sendReply(conn, commandNotSupported, nil); err != nil {
  			return fmt.Errorf("Failed to send reply: %v", err)
  		}
  		return fmt.Errorf("Unsupported command: %v", req.Command)
  	}
  }
docs: // handleRequest is used for request processing after authentication