|
|
@ -77,7 +77,7 @@ var ( |
|
|
|
errAlreadyDialing = errors.New("already dialing") |
|
|
|
errAlreadyDialing = errors.New("already dialing") |
|
|
|
errAlreadyConnected = errors.New("already connected") |
|
|
|
errAlreadyConnected = errors.New("already connected") |
|
|
|
errRecentlyDialed = errors.New("recently dialed") |
|
|
|
errRecentlyDialed = errors.New("recently dialed") |
|
|
|
errNotWhitelisted = errors.New("not contained in netrestrict whitelist") |
|
|
|
errNetRestrict = errors.New("not contained in netrestrict list") |
|
|
|
errNoPort = errors.New("node does not provide TCP port") |
|
|
|
errNoPort = errors.New("node does not provide TCP port") |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -133,7 +133,7 @@ type dialConfig struct { |
|
|
|
self enode.ID // our own ID
|
|
|
|
self enode.ID // our own ID
|
|
|
|
maxDialPeers int // maximum number of dialed peers
|
|
|
|
maxDialPeers int // maximum number of dialed peers
|
|
|
|
maxActiveDials int // maximum number of active dials
|
|
|
|
maxActiveDials int // maximum number of active dials
|
|
|
|
netRestrict *netutil.Netlist // IP whitelist, disabled if nil
|
|
|
|
netRestrict *netutil.Netlist // IP netrestrict list, disabled if nil
|
|
|
|
resolver nodeResolver |
|
|
|
resolver nodeResolver |
|
|
|
dialer NodeDialer |
|
|
|
dialer NodeDialer |
|
|
|
log log.Logger |
|
|
|
log log.Logger |
|
|
@ -402,7 +402,7 @@ func (d *dialScheduler) checkDial(n *enode.Node) error { |
|
|
|
return errAlreadyConnected |
|
|
|
return errAlreadyConnected |
|
|
|
} |
|
|
|
} |
|
|
|
if d.netRestrict != nil && !d.netRestrict.Contains(n.IP()) { |
|
|
|
if d.netRestrict != nil && !d.netRestrict.Contains(n.IP()) { |
|
|
|
return errNotWhitelisted |
|
|
|
return errNetRestrict |
|
|
|
} |
|
|
|
} |
|
|
|
if d.history.contains(string(n.ID().Bytes())) { |
|
|
|
if d.history.contains(string(n.ID().Bytes())) { |
|
|
|
return errRecentlyDialed |
|
|
|
return errRecentlyDialed |
|
|
|