Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: net: add IPConn methods to send/recv with netip.Addr #54262

Open
bradfitz opened this issue Aug 4, 2022 · 1 comment
Open

proposal: net: add IPConn methods to send/recv with netip.Addr #54262

bradfitz opened this issue Aug 4, 2022 · 1 comment

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Aug 4, 2022

net.UDPConn has:

func (c *UDPConn) WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error)
func (c *UDPConn) WriteMsgUDPAddrPort(b, oob []byte, addr netip.AddrPort) (n, oobn int, err error)
func (c *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error)
func (c *UDPConn) ReadMsgUDPAddrPort(b, oob []byte) (n, oobn, flags int, addr netip.AddrPort, err error)

I propose we also add methods on IPConn, like:

func (c *IPConn) ReadFromIPAddr(b []byte) (int, netip.Addr, error)
func (c *IPConn) ReadMsgIPAddr(b, oob []byte) (n, oobn, flags int, addr netip.Addr, err error)
func (c *IPConn) WriteMsgIPAddr(b, oob []byte, addr netip.Addr) (n, oobn int, err error)
func (c *IPConn) WriteToIPAddr(b []byte, addr netip.Addr) (int, error)

/cc @andrew-d @josharian

@gopherbot gopherbot added this to the Proposal milestone Aug 4, 2022
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Aug 4, 2022
@bradfitz
Copy link
Contributor Author

But: the "Addr" suffix in the proposed new method names is potentially ambiguous in the same way as raised in #54234 (comment) (that is, there's a net.Addr type in addition to the netip.Addr that this is supposed to be about)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

2 participants