go-ethereum: github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test Index | Files

package v4test

import "github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test"

Index

Package Files

discv4tests.go framework.go

Variables

var (
    // Remote node under test
    Remote string
    // IP where the first tester is listening, port will be assigned
    Listen1 string = "127.0.0.1"
    // IP where the second tester is listening, port will be assigned
    // Before running the test, you may have to `sudo ifconfig lo0 add 127.0.0.2` (on MacOS at least)
    Listen2 string = "127.0.0.2"
)
var AllTests = []utesting.Test{
    {Name: "Ping/Basic", Fn: BasicPing},
    {Name: "Ping/WrongTo", Fn: PingWrongTo},
    {Name: "Ping/WrongFrom", Fn: PingWrongFrom},
    {Name: "Ping/ExtraData", Fn: PingExtraData},
    {Name: "Ping/ExtraDataWrongFrom", Fn: PingExtraDataWrongFrom},
    {Name: "Ping/PastExpiration", Fn: PingPastExpiration},
    {Name: "Ping/WrongPacketType", Fn: WrongPacketType},
    {Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom},
    {Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof},
    {Name: "Findnode/BasicFindnode", Fn: BasicFindnode},
    {Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors},
    {Name: "Findnode/PastExpiration", Fn: FindnodePastExpiration},
    {Name: "Amplification/InvalidPongHash", Fn: FindnodeAmplificationInvalidPongHash},
    {Name: "Amplification/WrongIP", Fn: FindnodeAmplificationWrongIP},
}

func BasicFindnode Uses

func BasicFindnode(t *utesting.T)

BasicFindnode sends a FINDNODE request after performing the endpoint proof. The remote node should respond.

func BasicPing Uses

func BasicPing(t *utesting.T)

This test just sends a PING packet and expects a response.

func BondThenPingWithWrongFrom Uses

func BondThenPingWithWrongFrom(t *utesting.T)

This test verifies that the default behaviour of ignoring 'from' fields is unaffected by the bonding process. After bonding, it pings the target with a different from endpoint.

func FindnodeAmplificationInvalidPongHash Uses

func FindnodeAmplificationInvalidPongHash(t *utesting.T)

This test attempts to perform a traffic amplification attack against a 'victim' endpoint using FINDNODE. In this attack scenario, the attacker attempts to complete the endpoint proof non-interactively by sending a PONG with mismatching reply token from the 'victim' endpoint. The attack works if the remote node does not verify the PONG reply token field correctly. The attacker could then perform traffic amplification by sending many FINDNODE requests to the discovery node, which would reply to the 'victim' address.

func FindnodeAmplificationWrongIP Uses

func FindnodeAmplificationWrongIP(t *utesting.T)

This test attempts to perform a traffic amplification attack using FINDNODE. The attack works if the remote node does not verify the IP address of FINDNODE against the endpoint verification proof done by PING/PONG.

func FindnodePastExpiration Uses

func FindnodePastExpiration(t *utesting.T)

This test sends FINDNODE with an expiration timestamp in the past. The remote node should not respond.

func FindnodeWithoutEndpointProof Uses

func FindnodeWithoutEndpointProof(t *utesting.T)

This test just sends FINDNODE. The remote node should not reply because the endpoint proof has not completed.

func PingExtraData Uses

func PingExtraData(t *utesting.T)

This test sends a PING packet with additional data at the end and expects a PONG response. The remote node should respond because EIP-8 mandates ignoring additional trailing data.

func PingExtraDataWrongFrom Uses

func PingExtraDataWrongFrom(t *utesting.T)

This test sends a PING packet with additional data and wrong 'from' field and expects a PONG response.

func PingPastExpiration Uses

func PingPastExpiration(t *utesting.T)

This test sends a PING packet with an expiration in the past. The remote node should not respond.

func PingWrongFrom Uses

func PingWrongFrom(t *utesting.T)

This test sends a PING packet with wrong 'from' field and expects a PONG response.

func PingWrongTo Uses

func PingWrongTo(t *utesting.T)

This test sends a PING packet with wrong 'to' field and expects a PONG response.

func UnsolicitedNeighbors Uses

func UnsolicitedNeighbors(t *utesting.T)

This test sends an unsolicited NEIGHBORS packet after the endpoint proof, then sends FINDNODE to read the remote table. The remote node should not return the node contained in the unsolicited NEIGHBORS packet.

func WrongPacketType Uses

func WrongPacketType(t *utesting.T)

This test sends an invalid packet. The remote node should not respond.

Package v4test imports 11 packages (graph) and is imported by 1 packages. Updated 2020-07-17. Refresh now. Tools for package owners.