Let's say I have a private node A that has a public node B as its only trusted peer, and that I have access to B. Would it be possible to discover A's existence and IP from the list of B peers, or would it be indistinguishable from the rest of remote peers?
tezos-admin-client p2p stat on node B will list among other things, all active connections. The connections to private node will have the word
private near the end of the line.
Here is an example in sandbox where 127.0.0.1:19732 plays the node A (private and trusted):
$ tezos-admin-client p2p stat GLOBAL STATS ↗ 4.21 kiB (224 B/s) ↘ 1.70 kiB (89 B/s) CONNECTIONS ↗ idtiUgrLJUypeDGiYtgezGNfSCsuGf 127.0.0.1:19732 (SANDBOXED_TEZOS.0 (p2p: 0)) private KNOWN PEERS ⚌ 1 idtiUgrLJUypeDGiYtgezGNfSCsuGf ↗ 4.21 kiB (224 B/s) ↘ 1.70 kiB (89 B/s) KNOWN POINTS ⚏ 127.0.0.1:19730 ★ ⚏ 127.0.0.1:19737 ★ ⚏ 127.0.0.1:19731 ★ ⚏ 127.0.0.1:19736 ★ ⚏ 127.0.0.1:19738 ★ ⚏ 127.0.0.1:19739 ★ ⚏ 127.0.0.1:19734 ★ ⚌ 127.0.0.1:19732 idtiUgrLJUypeDGiYtgezGNfSCsuGf ★
Note also the stars in the KNOWN POINTS list which denotes trusted points. which tells us that node A is trusted by node B.
You could also use raw RPC and
jq utility to filter relevant results to get the active connections to private node :
tezos-client rpc get /network/connections | jq -c 'map(select(.remote_metadata|.private_node==true))'