refactor: make packet API stronger