A cross-platform C++ library for working with the P2P format is freely available here.
The source code of PeerGuardian Linux is in a public git repository. See here if you want to work on the code.
The (outdated) PeerGuardian OSX code is also in a git repository here.
The old deprecated PG Windows code is in cvs and subversion repositories. PG Windows has been superseeded by PeerBlock. See there.