code: func (sa *discoverySecurityAdapter) SignMessage(m *proto.GossipMessage, internalEndpoint string) *proto.Envelope {
  	signer := func(msg []byte) ([]byte, error) {
  		return sa.mcs.Sign(msg)
  	}
  	if m.IsAliveMsg() && time.Now().Before(sa.includeIdentityPeriod) {
  		m.GetAliveMsg().Identity = sa.identity
  	}
  	sMsg := &proto.SignedGossipMessage{
  		GossipMessage: m,
  	}
  	e, err := sMsg.Sign(signer)
  	if err != nil {
  		sa.logger.Warningf("Failed signing message: %+v", errors.WithStack(err))
  		return nil
  	}
  
  	if internalEndpoint == "" {
  		return e
  	}
  	e.SignSecret(signer, &proto.Secret{
  		Content: &proto.Secret_InternalEndpoint{
  			InternalEndpoint: internalEndpoint,
  		},
  	})
  	return e
  }
docs: // SignMessage signs an AliveMessage and updates its signature field