refactor Peering & RecoveryState & add PGInterface

draft

Signed-off-by: Loic Dachary <loic@dachary.org>