go-libp2p
go-libp2p copied to clipboard
feat(simconn): Simulated Networks
This adds a new Simulated Link to extend the Simulated UDP Packet conn. Simulated links can emulate bandwidth and latency over a connection, and can be used to connect two simulated conns together.
This also adds a simulated network helper to easily create a libp2p network and route the various links.
As-is, this works as a simple real-time simulator that may lose precision as computation gets bigger. The real benefit is when this is combined with Go 1.24's new testing/synctest package that allows the simulated network to run as a discrete event simulator. For this use case, only QUIC is supported.
This should serve to replace mocknet with a more accurate environment.
In draft until I clean up the tests a bit and use it a bit more.