tunnels_test.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. //go:build e2e_testing
  2. // +build e2e_testing
  3. package e2e
  4. import (
  5. "fmt"
  6. "net/netip"
  7. "testing"
  8. "time"
  9. "github.com/slackhq/nebula/cert"
  10. "github.com/slackhq/nebula/cert_test"
  11. "github.com/slackhq/nebula/e2e/router"
  12. "github.com/slackhq/nebula/header"
  13. "github.com/slackhq/nebula/udp"
  14. "github.com/stretchr/testify/assert"
  15. "gopkg.in/yaml.v3"
  16. )
  17. func TestDropInactiveTunnels(t *testing.T) {
  18. // The goal of this test is to ensure the shortest inactivity timeout will close the tunnel on both sides
  19. // under ideal conditions
  20. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version1, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  21. myControl, myVpnIpNet, myUdpAddr, _ := newSimpleServer(cert.Version1, ca, caKey, "me", "10.128.0.1/24", m{"tunnels": m{"drop_inactive": true, "inactivity_timeout": "5s"}})
  22. theirControl, theirVpnIpNet, theirUdpAddr, _ := newSimpleServer(cert.Version1, ca, caKey, "them", "10.128.0.2/24", m{"tunnels": m{"drop_inactive": true, "inactivity_timeout": "10m"}})
  23. // Share our underlay information
  24. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  25. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  26. // Start the servers
  27. myControl.Start()
  28. theirControl.Start()
  29. r := router.NewR(t, myControl, theirControl)
  30. r.Log("Assert the tunnel between me and them works")
  31. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  32. r.Log("Go inactive and wait for the tunnels to get dropped")
  33. waitStart := time.Now()
  34. for {
  35. myIndexes := len(myControl.GetHostmap().Indexes)
  36. theirIndexes := len(theirControl.GetHostmap().Indexes)
  37. if myIndexes == 0 && theirIndexes == 0 {
  38. break
  39. }
  40. since := time.Since(waitStart)
  41. r.Logf("my tunnels: %v; their tunnels: %v; duration: %v", myIndexes, theirIndexes, since)
  42. if since > time.Second*30 {
  43. t.Fatal("Tunnel should have been declared inactive after 5 seconds and before 30 seconds")
  44. }
  45. time.Sleep(1 * time.Second)
  46. r.FlushAll()
  47. }
  48. r.Logf("Inactive tunnels were dropped within %v", time.Since(waitStart))
  49. myControl.Stop()
  50. theirControl.Stop()
  51. }
  52. func TestCertUpgrade(t *testing.T) {
  53. // The goal of this test is to ensure the shortest inactivity timeout will close the tunnel on both sides
  54. // under ideal conditions
  55. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version1, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  56. caB, err := ca.MarshalPEM()
  57. if err != nil {
  58. panic(err)
  59. }
  60. ca2, _, caKey2, _ := cert_test.NewTestCaCert(cert.Version2, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  61. ca2B, err := ca2.MarshalPEM()
  62. if err != nil {
  63. panic(err)
  64. }
  65. caStr := fmt.Sprintf("%s\n%s", caB, ca2B)
  66. myCert, _, myPrivKey, _ := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "me", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.1/24")}, nil, []string{})
  67. _, myCert2Pem := cert_test.NewTestCertDifferentVersion(myCert, cert.Version2, ca2, caKey2)
  68. theirCert, _, theirPrivKey, _ := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "them", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.2/24")}, nil, []string{})
  69. theirCert2, _ := cert_test.NewTestCertDifferentVersion(theirCert, cert.Version2, ca2, caKey2)
  70. myControl, myVpnIpNet, myUdpAddr, myC := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{myCert}, myPrivKey, m{})
  71. theirControl, theirVpnIpNet, theirUdpAddr, _ := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{theirCert, theirCert2}, theirPrivKey, m{})
  72. // Share our underlay information
  73. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  74. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  75. // Start the servers
  76. myControl.Start()
  77. theirControl.Start()
  78. r := router.NewR(t, myControl, theirControl)
  79. defer r.RenderFlow()
  80. r.Log("Assert the tunnel between me and them works")
  81. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  82. r.Log("yay")
  83. //todo ???
  84. time.Sleep(1 * time.Second)
  85. r.FlushAll()
  86. mc := m{
  87. "pki": m{
  88. "ca": caStr,
  89. "cert": string(myCert2Pem),
  90. "key": string(myPrivKey),
  91. },
  92. //"tun": m{"disabled": true},
  93. "firewall": myC.Settings["firewall"],
  94. //"handshakes": m{
  95. // "try_interval": "1s",
  96. //},
  97. "listen": myC.Settings["listen"],
  98. "logging": myC.Settings["logging"],
  99. "timers": myC.Settings["timers"],
  100. }
  101. cb, err := yaml.Marshal(mc)
  102. if err != nil {
  103. panic(err)
  104. }
  105. r.Logf("reload new v2-only config")
  106. err = myC.ReloadConfigString(string(cb))
  107. assert.NoError(t, err)
  108. r.Log("yay, spin until their sees it")
  109. waitStart := time.Now()
  110. for {
  111. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  112. c := theirControl.GetHostInfoByVpnAddr(myVpnIpNet[0].Addr(), false)
  113. if c == nil {
  114. r.Log("nil")
  115. } else {
  116. version := c.Cert.Version()
  117. r.Logf("version %d", version)
  118. if version == cert.Version2 {
  119. break
  120. }
  121. }
  122. since := time.Since(waitStart)
  123. if since > time.Second*10 {
  124. t.Fatal("Cert should be new by now")
  125. }
  126. time.Sleep(time.Second)
  127. }
  128. r.RenderHostmaps("Final hostmaps", myControl, theirControl)
  129. myControl.Stop()
  130. theirControl.Stop()
  131. }
  132. func TestCertDowngrade(t *testing.T) {
  133. // The goal of this test is to ensure the shortest inactivity timeout will close the tunnel on both sides
  134. // under ideal conditions
  135. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version1, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  136. caB, err := ca.MarshalPEM()
  137. if err != nil {
  138. panic(err)
  139. }
  140. ca2, _, caKey2, _ := cert_test.NewTestCaCert(cert.Version2, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  141. ca2B, err := ca2.MarshalPEM()
  142. if err != nil {
  143. panic(err)
  144. }
  145. caStr := fmt.Sprintf("%s\n%s", caB, ca2B)
  146. myCert, _, myPrivKey, myCertPem := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "me", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.1/24")}, nil, []string{})
  147. myCert2, _ := cert_test.NewTestCertDifferentVersion(myCert, cert.Version2, ca2, caKey2)
  148. theirCert, _, theirPrivKey, _ := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "them", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.2/24")}, nil, []string{})
  149. theirCert2, _ := cert_test.NewTestCertDifferentVersion(theirCert, cert.Version2, ca2, caKey2)
  150. myControl, myVpnIpNet, myUdpAddr, myC := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{myCert2}, myPrivKey, m{})
  151. theirControl, theirVpnIpNet, theirUdpAddr, _ := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{theirCert, theirCert2}, theirPrivKey, m{})
  152. // Share our underlay information
  153. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  154. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  155. // Start the servers
  156. myControl.Start()
  157. theirControl.Start()
  158. r := router.NewR(t, myControl, theirControl)
  159. defer r.RenderFlow()
  160. r.Log("Assert the tunnel between me and them works")
  161. //assertTunnel(t, theirVpnIpNet[0].Addr(), myVpnIpNet[0].Addr(), theirControl, myControl, r)
  162. //r.Log("yay")
  163. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  164. r.Log("yay")
  165. //todo ???
  166. time.Sleep(1 * time.Second)
  167. r.FlushAll()
  168. mc := m{
  169. "pki": m{
  170. "ca": caStr,
  171. "cert": string(myCertPem),
  172. "key": string(myPrivKey),
  173. },
  174. "firewall": myC.Settings["firewall"],
  175. "listen": myC.Settings["listen"],
  176. "logging": myC.Settings["logging"],
  177. "timers": myC.Settings["timers"],
  178. }
  179. cb, err := yaml.Marshal(mc)
  180. if err != nil {
  181. panic(err)
  182. }
  183. r.Logf("reload new v1-only config")
  184. err = myC.ReloadConfigString(string(cb))
  185. assert.NoError(t, err)
  186. r.Log("yay, spin until their sees it")
  187. waitStart := time.Now()
  188. for {
  189. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  190. c := theirControl.GetHostInfoByVpnAddr(myVpnIpNet[0].Addr(), false)
  191. c2 := myControl.GetHostInfoByVpnAddr(theirVpnIpNet[0].Addr(), false)
  192. if c == nil || c2 == nil {
  193. r.Log("nil")
  194. } else {
  195. version := c.Cert.Version()
  196. theirVersion := c2.Cert.Version()
  197. r.Logf("version %d,%d", version, theirVersion)
  198. if version == cert.Version1 {
  199. break
  200. }
  201. }
  202. since := time.Since(waitStart)
  203. if since > time.Second*5 {
  204. r.Log("it is unusual that the cert is not new yet, but not a failure yet")
  205. }
  206. if since > time.Second*10 {
  207. r.Log("wtf")
  208. t.Fatal("Cert should be new by now")
  209. }
  210. time.Sleep(time.Second)
  211. }
  212. r.RenderHostmaps("Final hostmaps", myControl, theirControl)
  213. myControl.Stop()
  214. theirControl.Stop()
  215. }
  216. func TestCertMismatchCorrection(t *testing.T) {
  217. // The goal of this test is to ensure the shortest inactivity timeout will close the tunnel on both sides
  218. // under ideal conditions
  219. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version1, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  220. ca2, _, caKey2, _ := cert_test.NewTestCaCert(cert.Version2, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  221. myCert, _, myPrivKey, _ := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "me", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.1/24")}, nil, []string{})
  222. myCert2, _ := cert_test.NewTestCertDifferentVersion(myCert, cert.Version2, ca2, caKey2)
  223. theirCert, _, theirPrivKey, _ := cert_test.NewTestCert(cert.Version1, cert.Curve_CURVE25519, ca, caKey, "them", time.Now(), time.Now().Add(5*time.Minute), []netip.Prefix{netip.MustParsePrefix("10.128.0.2/24")}, nil, []string{})
  224. theirCert2, _ := cert_test.NewTestCertDifferentVersion(theirCert, cert.Version2, ca2, caKey2)
  225. myControl, myVpnIpNet, myUdpAddr, _ := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{myCert2}, myPrivKey, m{})
  226. theirControl, theirVpnIpNet, theirUdpAddr, _ := newServer([]cert.Certificate{ca, ca2}, []cert.Certificate{theirCert, theirCert2}, theirPrivKey, m{})
  227. // Share our underlay information
  228. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  229. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  230. // Start the servers
  231. myControl.Start()
  232. theirControl.Start()
  233. r := router.NewR(t, myControl, theirControl)
  234. defer r.RenderFlow()
  235. r.Log("Assert the tunnel between me and them works")
  236. //assertTunnel(t, theirVpnIpNet[0].Addr(), myVpnIpNet[0].Addr(), theirControl, myControl, r)
  237. //r.Log("yay")
  238. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  239. r.Log("yay")
  240. //todo ???
  241. time.Sleep(1 * time.Second)
  242. r.FlushAll()
  243. waitStart := time.Now()
  244. for {
  245. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  246. c := theirControl.GetHostInfoByVpnAddr(myVpnIpNet[0].Addr(), false)
  247. c2 := myControl.GetHostInfoByVpnAddr(theirVpnIpNet[0].Addr(), false)
  248. if c == nil || c2 == nil {
  249. r.Log("nil")
  250. } else {
  251. version := c.Cert.Version()
  252. theirVersion := c2.Cert.Version()
  253. r.Logf("version %d,%d", version, theirVersion)
  254. if version == theirVersion {
  255. break
  256. }
  257. }
  258. since := time.Since(waitStart)
  259. if since > time.Second*5 {
  260. r.Log("wtf")
  261. }
  262. if since > time.Second*10 {
  263. r.Log("wtf")
  264. t.Fatal("Cert should be new by now")
  265. }
  266. time.Sleep(time.Second)
  267. }
  268. r.RenderHostmaps("Final hostmaps", myControl, theirControl)
  269. myControl.Stop()
  270. theirControl.Stop()
  271. }
  272. func TestCrossStackRelaysWork(t *testing.T) {
  273. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version2, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  274. myControl, myVpnIpNet, _, _ := newSimpleServer(cert.Version2, ca, caKey, "me ", "10.128.0.1/24,fc00::1/64", m{"relay": m{"use_relays": true}})
  275. relayControl, relayVpnIpNet, relayUdpAddr, _ := newSimpleServer(cert.Version2, ca, caKey, "relay ", "10.128.0.128/24,fc00::128/64", m{"relay": m{"am_relay": true}})
  276. theirUdp := netip.MustParseAddrPort("10.0.0.2:4242")
  277. theirControl, theirVpnIpNet, theirUdpAddr, _ := newSimpleServerWithUdp(cert.Version2, ca, caKey, "them ", "fc00::2/64", theirUdp, m{"relay": m{"use_relays": true}})
  278. //myVpnV4 := myVpnIpNet[0]
  279. myVpnV6 := myVpnIpNet[1]
  280. relayVpnV4 := relayVpnIpNet[0]
  281. relayVpnV6 := relayVpnIpNet[1]
  282. theirVpnV6 := theirVpnIpNet[0]
  283. // Teach my how to get to the relay and that their can be reached via the relay
  284. myControl.InjectLightHouseAddr(relayVpnV4.Addr(), relayUdpAddr)
  285. myControl.InjectLightHouseAddr(relayVpnV6.Addr(), relayUdpAddr)
  286. myControl.InjectRelays(theirVpnV6.Addr(), []netip.Addr{relayVpnV6.Addr()})
  287. relayControl.InjectLightHouseAddr(theirVpnV6.Addr(), theirUdpAddr)
  288. // Build a router so we don't have to reason who gets which packet
  289. r := router.NewR(t, myControl, relayControl, theirControl)
  290. defer r.RenderFlow()
  291. // Start the servers
  292. myControl.Start()
  293. relayControl.Start()
  294. theirControl.Start()
  295. t.Log("Trigger a handshake from me to them via the relay")
  296. myControl.InjectTunUDPPacket(theirVpnV6.Addr(), 80, myVpnV6.Addr(), 80, []byte("Hi from me"))
  297. p := r.RouteForAllUntilTxTun(theirControl)
  298. r.Log("Assert the tunnel works")
  299. assertUdpPacket(t, []byte("Hi from me"), p, myVpnV6.Addr(), theirVpnV6.Addr(), 80, 80)
  300. t.Log("reply?")
  301. theirControl.InjectTunUDPPacket(myVpnV6.Addr(), 80, theirVpnV6.Addr(), 80, []byte("Hi from them"))
  302. p = r.RouteForAllUntilTxTun(myControl)
  303. assertUdpPacket(t, []byte("Hi from them"), p, theirVpnV6.Addr(), myVpnV6.Addr(), 80, 80)
  304. r.RenderHostmaps("Final hostmaps", myControl, relayControl, theirControl)
  305. //t.Log("finish up")
  306. //myControl.Stop()
  307. //theirControl.Stop()
  308. //relayControl.Stop()
  309. }
  310. func TestCloseTunnelAuthenticated(t *testing.T) {
  311. ca, _, caKey, _ := cert_test.NewTestCaCert(cert.Version1, cert.Curve_CURVE25519, time.Now(), time.Now().Add(10*time.Minute), nil, nil, []string{})
  312. myControl, myVpnIpNet, myUdpAddr, _ := newSimpleServer(cert.Version1, ca, caKey, "me", "10.128.0.1/24", m{"tunnels": m{"drop_inactive": true, "inactivity_timeout": "5s"}})
  313. theirControl, theirVpnIpNet, theirUdpAddr, _ := newSimpleServer(cert.Version1, ca, caKey, "them", "10.128.0.2/24", m{"tunnels": m{"drop_inactive": true, "inactivity_timeout": "10m"}})
  314. // Share our underlay information
  315. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  316. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  317. // Start the servers
  318. myControl.Start()
  319. theirControl.Start()
  320. r := router.NewR(t, myControl, theirControl)
  321. r.Log("Assert the tunnel between me and them works")
  322. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  323. r.Log("Close the tunnel")
  324. myControl.CloseTunnel(theirVpnIpNet[0].Addr(), false)
  325. r.FlushAll()
  326. waitStart := time.Now()
  327. for {
  328. myIndexes := len(myControl.GetHostmap().Indexes)
  329. theirIndexes := len(theirControl.GetHostmap().Indexes)
  330. if myIndexes == 0 && theirIndexes == 0 {
  331. break
  332. }
  333. since := time.Since(waitStart)
  334. r.Logf("my tunnels: %v; their tunnels: %v; duration: %v", myIndexes, theirIndexes, since)
  335. if since > time.Second*6 {
  336. t.Fatal("Tunnel should have been declared inactive after 2 seconds and before 6 seconds")
  337. }
  338. time.Sleep(1 * time.Second)
  339. //r.FlushAll()
  340. }
  341. r.Logf("Happy path success, tunnels were dropped within %v", time.Since(waitStart))
  342. myControl.InjectLightHouseAddr(theirVpnIpNet[0].Addr(), theirUdpAddr)
  343. theirControl.InjectLightHouseAddr(myVpnIpNet[0].Addr(), myUdpAddr)
  344. r.Log("Assert another tunnel between me and them works")
  345. assertTunnel(t, myVpnIpNet[0].Addr(), theirVpnIpNet[0].Addr(), myControl, theirControl, r)
  346. hi := myControl.GetHostInfoByVpnAddr(theirVpnIpNet[0].Addr(), false)
  347. if hi == nil {
  348. t.Fatal("There is no hostinfo for this tunnel")
  349. }
  350. myHi := theirControl.GetHostInfoByVpnAddr(myVpnIpNet[0].Addr(), false)
  351. if myHi == nil {
  352. t.Fatal("There is no hostinfo for my tunnel")
  353. }
  354. r.Log("It does")
  355. buf := make([]byte, 1024)
  356. hdr := header.H{
  357. Version: 1,
  358. Type: header.CloseTunnel,
  359. Subtype: 0,
  360. Reserved: 0,
  361. RemoteIndex: hi.RemoteIndex,
  362. MessageCounter: 5,
  363. }
  364. out, err := hdr.Encode(buf)
  365. if err != nil {
  366. t.Fatal(err)
  367. }
  368. pkt := &udp.Packet{
  369. To: hi.CurrentRemote,
  370. From: myHi.CurrentRemote,
  371. Data: out,
  372. }
  373. r.InjectUDPPacket(myControl, theirControl, pkt)
  374. r.Log("Injected bogus close tunnel. Let's see!")
  375. waitStart = time.Now()
  376. for {
  377. myIndexes := len(myControl.GetHostmap().Indexes)
  378. theirIndexes := len(theirControl.GetHostmap().Indexes)
  379. if myIndexes == 0 {
  380. t.Fatal("myIndexes should not be 0")
  381. }
  382. if theirIndexes == 0 {
  383. t.Fatal("theirIndexes should not be 0, they should have rejected this bogus packet")
  384. }
  385. since := time.Since(waitStart)
  386. r.Logf("my tunnels: %v; their tunnels: %v; duration: %v", myIndexes, theirIndexes, since)
  387. if since > time.Second*4 {
  388. t.Log("The tunnel would have been gone by now")
  389. break
  390. }
  391. time.Sleep(1 * time.Second)
  392. r.FlushAll()
  393. }
  394. myControl.Stop()
  395. theirControl.Stop()
  396. }