p2p/enode: mock DNS resolver in URL parsing test (#20252)
This commit is contained in:
@ -18,6 +18,7 @@ package enode
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"errors"
|
||||
"net"
|
||||
"reflect"
|
||||
"strings"
|
||||
@ -27,6 +28,15 @@ import (
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
lookupIPFunc = func(name string) ([]net.IP, error) {
|
||||
if name == "node.example.org" {
|
||||
return []net.IP{{33, 44, 55, 66}}, nil
|
||||
}
|
||||
return nil, errors.New("no such host")
|
||||
}
|
||||
}
|
||||
|
||||
var parseNodeTests = []struct {
|
||||
input string
|
||||
wantError string
|
||||
|
Reference in New Issue
Block a user