net: implement ResolveIPAddr with stub for lookupProtocol, take #2

This is a rework of PR#24 based on review comments.  The rework mostly
involved moving changes to the proper files, aligning with upstream Go
src/net file layout.
This commit is contained in:
Scott Feldman
2025-01-04 16:12:24 -08:00
committed by Ron Evans
parent e4c3cdf599
commit 4927c84aa4
3 changed files with 70 additions and 0 deletions
+17
View File
@@ -63,6 +63,23 @@ func (a *IPAddr) opAddr() Addr {
return a
}
// ResolveIPAddr returns an address of IP end point.
//
// The network must be an IP network name.
//
// If the host in the address parameter is not a literal IP address,
// ResolveIPAddr resolves the address to an address of IP end point.
// Otherwise, it parses the address as a literal IP address.
// The address parameter can use a host name, but this is not
// recommended, because it will return at most one of the host name's
// IP addresses.
//
// See func [Dial] for a description of the network and address
// parameters.
func ResolveIPAddr(network, address string) (*IPAddr, error) {
return nil, errors.New("ResolveIPAddr not implemented")
}
// IPConn is the implementation of the Conn and PacketConn interfaces
// for IP network connections.
type IPConn struct {