在Go中,如何从打开的TCPConn *中检索IP地址?

I have a TCPConn* that I've accepted from a TCPListener.acceptTCP. I'd like to get only the IP address (no port information) as a string or IP. What is the correct (i.e. minimal casting/string manipulation) way to accomplish that?

To get the IP, as an IP object, the most straightforward way should be

tcpconn.RemoteAddr().(*net.TCPAddr).IP

There is nothing wrong with using type assertions, and in cases like this it's actually expected.