code: func (a *Agent) removeProxyLocked(proxyID string, persist bool) error {
  	// Validate proxyID
  	if proxyID == "" {
  		return fmt.Errorf("proxyID missing")
  	}
  
  	// Remove the proxy from the local state
  	p, err := a.State.RemoveProxy(proxyID)
  	if err != nil {
  		return err
  	}
  
  	// Remove the proxy service as well. The proxy ID is also the ID
  	// of the servie, but we might as well use the service pointer.
  	if err := a.removeServiceLocked(p.Proxy.ProxyService.ID, persist); err != nil {
  		return err
  	}
  
  	if persist && a.config.DataDir != "" {
  		return a.purgeProxy(proxyID)
  	}
  
  	return nil
  }
docs: // removeProxyLocked stops and removes a local proxy instance.
  //
  // It is assumed that this function is called while holding the proxyLock already