Does Gossipsub optimize for latency

So I am working on a p2p project and I am considering using libp2p. However, I am concerned that gossipsub will add to much overhead because as far ad I can tell peers are selected randomly Instead of by latency.

Here is what my general setup looks like. I have a bunch of nodes grouped together in buildings. Ideally nodes should prioritize talking to nodes with the lowest latency. It is possible that I missed something but as far as I can tell the nodes would be spread out.

It does not optimize for latency in peer selection, as this is likeky to create a disconnected overlay (you need those far links).

– vyzo

In libp2p is it possible to differentiate between peers on the same local network (mDNS) and peers in the public internet?

What I am trying to do is have a local latency focused local network and then a occasional sync with a peer not on the local network.

Edit:

Would this be possible to do with topics? Say I have a few nodes that are close together and they all subscribe to a topic in gossipsub. Would this mean that most of the network traffic would stay in that area assuming the topic doesn’t span outside of that physical area?