code: func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle {
  	return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
  		w.Header().Set("Access-Control-Allow-Origin", "*")
  		w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
  
  		ctx := context.Background()
  
  		if id := params.ByName("nodeid"); id != "" {
  			var nodeID enode.ID
  			var node *Node
  			if nodeID.UnmarshalText([]byte(id)) == nil {
  				node = s.network.GetNode(nodeID)
  			} else {
  				node = s.network.GetNodeByName(id)
  			}
  			if node == nil {
  				http.NotFound(w, req)
  				return
  			}
  			ctx = context.WithValue(ctx, "node", node)
  		}
  
  		if id := params.ByName("peerid"); id != "" {
  			var peerID enode.ID
  			var peer *Node
  			if peerID.UnmarshalText([]byte(id)) == nil {
  				peer = s.network.GetNode(peerID)
  			} else {
  				peer = s.network.GetNodeByName(id)
  			}
  			if peer == nil {
  				http.NotFound(w, req)
  				return
  			}
  			ctx = context.WithValue(ctx, "peer", peer)
  		}
  
  		handler(w, req.WithContext(ctx))
  	}
  }
docs: // wrapHandler returns a httprouter.Handle which wraps a http.HandlerFunc by
  // populating request.Context with any objects from the URL params