Skip to content

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

@bradfitz

Description

@bradfitz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions