it's being said that a peer to peer network is not server-based for routing and processing data and only uses server for getting the up to dated nodes addresses (probably their internet IP address) to connect to other node directly without no intermediate server. so my question is, how computer(node) A can establish a connection with node B over the internet. the IPs that ISP gives to us is invalid and isn't reachable. so how does this p2p work with these invalid node IP address over internet?
the IPs that ISP gives to us is invalid and isn't reachable.
That can't be true. When the public IP address is invalid you can't do anything with the connection.
Many P2P networks use a directory server like you seem to describe to find each other. Often, destination NAT/reverse NAT/port forwarding is additionally required to connect to hosts behind a router using source NAT (assuming IPv4 is used).