The acronym "STUN" stands for two definitions with two different meanings as follows:
STUN - Simple Traversal of User Datagram Protocol (UDP) ---> RFC 3489 published in 2003 - works only with static NAT to establish a direct connectivity between two endponts. It does not work with PAT.
STUN - Session Traversal Utilities for NAT (STUN) ---> RFC 5389 (2008) and RFC 8489 (2020) - new version of STUN released to be compatible with PAT. And to be compatible with PAT, TURN (Traversal Using Relays around NAT ) was added to offer a relayed point for two endpoints behind PAT.
Finally, Interactive Connectivity Establishment (ICE), defined in RFC 8445, is a framework that combines STUN and TURN to discover optimal path between two endpoints directly if they are statically nated or indirectly If they are nated with PAT, the communication will be through a relay server.
STUN will allow two endpoints to discover the following IPs:
1-Their private IPs called Host Address,.
2-Their public IPs called Server Reflexive Address
3-The relay server's IP called Relayed Address.
Then ICE will first check the optimal communication, first directly using the Host Address, then using the Server Reflexive Address if the two endpoints are statically nated and finally through the Relayed Address if the two endpoints are behind PAT.
Regards
Redouane