code: func (c *cmd) registerMonitor(client *api.Client) (*RegisterMonitor, error) {
  	if c.service == "" || c.listen == "" {
  		return nil, fmt.Errorf("-register may only be specified with -service and -listen")
  	}
  
  	host, port, err := c.listenParts()
  	if err != nil {
  		return nil, err
  	}
  
  	m := NewRegisterMonitor()
  	m.Logger = c.logger
  	m.Client = client
  	m.Service = c.service
  	m.IDSuffix = c.registerId
  	m.LocalAddress = host
  	m.LocalPort = port
  	return m, nil
  }
docs: // registerMonitor returns the registration monitor ready to be started.