I know there is the method IP.get_local_addresses() to get a list of ip addresses, but how could you filter out only the global ones?
On linux you have a command ip -6 addr show scope global, which can be used to obtain the global ipv6 addresses, is there anything similar that can be done from within godot.
Doing a Google search it seems like global ipv6 addresses have a reserved range. So you could probably just do a little parsing to see which are in range of being global.
To get the user’s public IP address (IPv4 or IPv6), you need to contact a web server and read the response data. Services like ipinfo.io have an API for that.