stitch sends node updates from src Conn as peer updates to dst Conn. Sort of like the Coordinator would, but without actually needing a Coordinator.
(t *testing.T, dst, src *tailnet.Conn)
| 472 | // stitch sends node updates from src Conn as peer updates to dst Conn. Sort of |
| 473 | // like the Coordinator would, but without actually needing a Coordinator. |
| 474 | func stitch(t *testing.T, dst, src *tailnet.Conn) { |
| 475 | srcID := uuid.New() |
| 476 | src.SetNodeCallback(func(node *tailnet.Node) { |
| 477 | pn, err := tailnet.NodeToProto(node) |
| 478 | if !assert.NoError(t, err) { |
| 479 | return |
| 480 | } |
| 481 | err = dst.UpdatePeers([]*proto.CoordinateResponse_PeerUpdate{{ |
| 482 | Id: srcID[:], |
| 483 | Node: pn, |
| 484 | Kind: proto.CoordinateResponse_PeerUpdate_NODE, |
| 485 | }}) |
| 486 | assert.NoError(t, err) |
| 487 | }) |
| 488 | // ensures we don't send callbacks after the test ends and connections are closed. |
| 489 | t.Cleanup(func() { |
| 490 | src.SetNodeCallback(nil) |
| 491 | }) |
| 492 | } |
| 493 | |
| 494 | func TestTailscaleServicePrefix(t *testing.T) { |
| 495 | t.Parallel() |
no test coverage detected