add ToIP to complement ToNetAddr
The specific implementations of net.Addr are internal implementation details of this package, and a downstream consumner shouldn't relay on the internal use of net.IPAddr / net.TCPAddr to implement that interface for direct extraction of IP. The consumer would instead need to go through a round of string conversion to retreive IP safely. Adding an IP extraction function to the interface here will allow the IP to be retreived more efficiently.
Showing
Please register or sign in to comment