mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-22 07:29:01 +00:00
modify netif.Resolver to use net.DefaultResolver method set
This commit is contained in:
+7
-4
@@ -1,6 +1,7 @@
|
|||||||
package netif
|
package netif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
@@ -117,11 +118,13 @@ type Stack interface {
|
|||||||
SetSockOpt(sockfd int, level int, opt int, value interface{}) error
|
SetSockOpt(sockfd int, level int, opt int, value interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should have UseResolver package level function that replaces the Go Resolver?
|
// Resolver is implemented by DNS resolvers, notably Go's [net.DefaultResolver].
|
||||||
type Resolver interface {
|
type Resolver interface {
|
||||||
// GetHostByName returns the IP address of either a hostname or IPv4
|
// LookupNetIP looks up host using the local resolver.
|
||||||
// address in standard dot notation
|
// It returns a slice of that host's IP addresses of the type specified by
|
||||||
GetHostByName(name string) (netip.Addr, error)
|
// network.
|
||||||
|
// The network must be one of "ip", "ip4" or "ip6".
|
||||||
|
LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StackWifi is returned by `Probe` function for devices that communicate
|
// StackWifi is returned by `Probe` function for devices that communicate
|
||||||
|
|||||||
Reference in New Issue
Block a user