Most flights from Canada pre-clear immigration in Canada, so unless you’re on one of the few flights that don’t, you’ll walk off the plane in BOS just like a domestic flight. And as long as you’re back at the airport an hour before your flight you’ll be fine.