p2p: remove term "whitelist" (#23295)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
3526f69047
commit
860184d542
@ -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
|
||||||
|
@ -41,7 +41,7 @@ type Config struct {
|
|||||||
PrivateKey *ecdsa.PrivateKey
|
PrivateKey *ecdsa.PrivateKey
|
||||||
|
|
||||||
// These settings are optional:
|
// These settings are optional:
|
||||||
NetRestrict *netutil.Netlist // network whitelist
|
NetRestrict *netutil.Netlist // list of allowed IP networks
|
||||||
Bootnodes []*enode.Node // list of bootstrap nodes
|
Bootnodes []*enode.Node // list of bootstrap nodes
|
||||||
Unhandled chan<- ReadPacket // unhandled packets are sent on this channel
|
Unhandled chan<- ReadPacket // unhandled packets are sent on this channel
|
||||||
Log log.Logger // if set, log messages go here
|
Log log.Logger // if set, log messages go here
|
||||||
|
@ -583,7 +583,7 @@ func (t *UDPv4) nodeFromRPC(sender *net.UDPAddr, rn v4wire.Node) (*node, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if t.netrestrict != nil && !t.netrestrict.Contains(rn.IP) {
|
if t.netrestrict != nil && !t.netrestrict.Contains(rn.IP) {
|
||||||
return nil, errors.New("not contained in netrestrict whitelist")
|
return nil, errors.New("not contained in netrestrict list")
|
||||||
}
|
}
|
||||||
key, err := v4wire.DecodePubkey(crypto.S256(), rn.ID)
|
key, err := v4wire.DecodePubkey(crypto.S256(), rn.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -353,7 +353,7 @@ func (srv *Server) RemovePeer(node *enode.Node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTrustedPeer adds the given node to a reserved whitelist which allows the
|
// AddTrustedPeer adds the given node to a reserved trusted list which allows the
|
||||||
// node to always connect, even if the slot are full.
|
// node to always connect, even if the slot are full.
|
||||||
func (srv *Server) AddTrustedPeer(node *enode.Node) {
|
func (srv *Server) AddTrustedPeer(node *enode.Node) {
|
||||||
select {
|
select {
|
||||||
@ -903,7 +903,7 @@ func (srv *Server) checkInboundConn(remoteIP net.IP) error {
|
|||||||
}
|
}
|
||||||
// Reject connections that do not match NetRestrict.
|
// Reject connections that do not match NetRestrict.
|
||||||
if srv.NetRestrict != nil && !srv.NetRestrict.Contains(remoteIP) {
|
if srv.NetRestrict != nil && !srv.NetRestrict.Contains(remoteIP) {
|
||||||
return fmt.Errorf("not whitelisted in NetRestrict")
|
return fmt.Errorf("not in netrestrict list")
|
||||||
}
|
}
|
||||||
// Reject Internet peers that try too often.
|
// Reject Internet peers that try too often.
|
||||||
now := srv.clock.Now()
|
now := srv.clock.Now()
|
||||||
|
Loading…
Reference in New Issue
Block a user