Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
add e2e and enable hole punching
Antonio Ojea09f567d9ab4d
diff --git a/cmd/sam-node/node.go b/cmd/sam-node/node.goindex e5f3f04b..41f00b47 100644--- a/cmd/sam-node/node.go+++ b/cmd/sam-node/node.go@@ -189,6 +189,7 @@ func NewSamNode(ctx context.Context, privKey crypto.PrivKey, hubPubKey ed25519.Plibp2p.EnableAutoNATv2(),libp2p.ForceReachabilityPrivate(),libp2p.EnableRelay(),+ libp2p.EnableHolePunching(),libp2p.ConnectionManager(cm),libp2p.AddrsFactory(func(addrs []multiaddr.Multiaddr) []multiaddr.Multiaddr {if allowLoopback {diff --git a/tests/e2e/relay.bats b/tests/e2e/relay.batsindex 5bb12e04..e9b71502 100644--- a/tests/e2e/relay.bats+++ b/tests/e2e/relay.bats@@ -44,3 +44,44 @@ teardown() {run mesh_wait_for_log "${MESH_PREFIX}-node-1" "Enabling Relay Service" 20[[ "$status" -eq 0 ]]}++@test "nodes in isolated networks discover and connect via relay" {+ run mesh_start_mock_oidc+ [[ "$status" -eq 0 ]]++ run mesh_start_hub+ [[ "$status" -eq 0 ]]++ local MESH_NETWORK_2="${MESH_PREFIX}-2-net"+ docker network create "${MESH_NETWORK_2}"++ docker network connect --alias sam-hub "${MESH_NETWORK_2}" "${MESH_PREFIX}-hub"+ docker network connect --alias mock-oidc "${MESH_NETWORK_2}" "${MESH_PREFIX}-oidc"++ run mesh_start_node "1" "--enable-relay=true --log-level=debug"+ [[ "$status" -eq 0 ]]++ OLD_NET=$MESH_NETWORK+ MESH_NETWORK=$MESH_NETWORK_2+ run mesh_start_node "2" "--log-level=debug"+ [[ "$status" -eq 0 ]]+ MESH_NETWORK=$OLD_NET++ run mesh_wait_for_log "${MESH_PREFIX}-node-1" "PeerID:" 20+ [[ "$status" -eq 0 ]]+ run mesh_wait_for_log "${MESH_PREFIX}-node-2" "PeerID:" 20+ [[ "$status" -eq 0 ]]++ # Node 1 should eventually see 1 peer (node 2) besides the hub+ run mesh_wait_for_node_count "1" 1 30+ [[ "$status" -eq 0 ]]++ # Node 2 should eventually see 1 peer (node 1) besides the hub+ OLD_NET=$MESH_NETWORK+ MESH_NETWORK=$MESH_NETWORK_2+ run mesh_wait_for_node_count "2" 1 30+ [[ "$status" -eq 0 ]]+ MESH_NETWORK=$OLD_NET++ docker network rm "${MESH_NETWORK_2}" >/dev/null 2>&1 || true+}