refurbish internal netdever interface to use netip types instead of net.IP

This commit is contained in:
soypat
2023-11-29 11:49:00 -08:00
committed by Ron Evans
parent 7c11b88ce6
commit f3548296e1
4 changed files with 25 additions and 16 deletions
+6 -5
View File
@@ -3,6 +3,7 @@
package net
import (
"net/netip"
"time"
)
@@ -48,18 +49,18 @@ type netdever interface {
// GetHostByName returns the IP address of either a hostname or IPv4
// address in standard dot notation
GetHostByName(name string) (IP, error)
GetHostByName(name string) (netip.Addr, error)
// GetIPAddr returns IP address assigned to the interface, either by
// DHCP or statically
GetIPAddr() (IP, error)
Addr() (netip.Addr, error)
// Berkely Sockets-like interface, Go-ified. See man page for socket(2), etc.
Socket(domain int, stype int, protocol int) (int, error)
Bind(sockfd int, ip IP, port int) error
Connect(sockfd int, host string, ip IP, port int) error
Bind(sockfd int, ip netip.AddrPort) error
Connect(sockfd int, host string, ip netip.AddrPort) error
Listen(sockfd int, backlog int) error
Accept(sockfd int, ip IP, port int) (int, error)
Accept(sockfd int, ip netip.AddrPort) (int, error)
Send(sockfd int, buf []byte, flags int, deadline time.Time) (int, error)
Recv(sockfd int, buf []byte, flags int, deadline time.Time) (int, error)
Close(sockfd int) error