get ip adress of a server

So basically I've made just a small datapack for a multiple proxy server thingy. And whilst I could manually enter the ip all the time it would be easier if just could pull the ip adress from the current connected network (Not the player) and automatically add it. sumthing along the lines of transfer "ip adress of connected network" 25565 "player" Or is that just not possible? (I don't know anything about datapacks at all and i was unable to find any docs that could have helped me)
Continue to help post