message: crash if message type is unrecognised
peer: add endpoint type