func StartMonitor(cfg MonitorConfig) error {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	w := &Monitor{
		MonitorConfig: cfg,
	}
	// If an applicable lock is already in force, close the connection immediately.
	if lockErr := w.LockWatcher.CheckLockInForce(w.LockingMode, w.LockTargets...); lockErr != nil {
		w.handleLockInForce(lockErr)
		return nil
	}
	lockWatch, err := w.LockWatcher.Subscribe(w.Context, w.LockTargets...)
	if err != nil {
		return trace.Wrap(err)
	}
	go w.start(lockWatch)
	return nil
}
// StartMonitor starts a new monitor.
StartMonitor starts a new monitor.
// StartMonitor starts a new monitor .
func StartMonitor(cfg MonitorConfig) error {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	w := &Monitor{
		MonitorConfig: cfg,
	}
	if lockErr := w.LockWatcher.CheckLockInForce(w.LockingMode, w.LockTargets...); lockErr != nil {
		w.handleLockInForce(lockErr)
		return nil
	}
	lockWatch, err := w.LockWatcher.Subscribe(w.Context, w.LockTargets...)
	if err != nil {
		return trace.Wrap(err)
	}
	go w.start(lockWatch)
	return nil
}
func StartMonitor ( cfg MonitorConfig ) error { if err := cfg . CheckAndSetDefaults ( ) ; err != nil { return trace . Wrap ( err ) } w := & Monitor { MonitorConfig : cfg , } if lockErr := w . LockWatcher . CheckLockInForce ( w . LockingMode , w . LockTargets ... ) ; lockErr != nil { w . handleLockInForce ( lockErr ) return nil } lockWatch , err := w . LockWatcher . Subscribe ( w . Context , w . LockTargets ... ) if err != nil { return trace . Wrap ( err ) } go w . start ( lockWatch ) return nil }
StartMonitor starts a new monitor.
StartMonitor starts a new monitor .
// If an applicable lock is already in force, close the connection immediately.