Prefer QUIC fabric endpoints
This commit is contained in:
@@ -2781,7 +2781,10 @@ func meshOutboundSessionReportFromState(cfg config.Config, meshState *syntheticM
|
||||
}
|
||||
|
||||
func meshEndpointReport(cfg config.Config, identity state.Identity, meshState *syntheticMeshState, observedAt time.Time, candidates []mesh.PeerEndpointCandidate) map[string]any {
|
||||
transport := cfg.MeshAdvertiseTransport
|
||||
transport := strings.TrimSpace(candidates[0].Transport)
|
||||
if transport == "" {
|
||||
transport = strings.TrimSpace(cfg.MeshAdvertiseTransport)
|
||||
}
|
||||
if transport == "" {
|
||||
transport = "direct_tcp_tls"
|
||||
}
|
||||
@@ -3842,6 +3845,20 @@ func advertisedEndpointCandidates(cfg config.Config, identity state.Identity, me
|
||||
Priority: 10,
|
||||
})
|
||||
}
|
||||
if cfg.MeshQUICFabricEnabled && meshState != nil && strings.TrimSpace(meshState.QUICFabricListenAddr) != "" {
|
||||
candidates = append(candidates, mesh.PeerEndpointCandidate{
|
||||
EndpointID: identity.NodeID + "-quic-fabric",
|
||||
NodeID: identity.NodeID,
|
||||
Transport: "direct_quic",
|
||||
Address: "quic://" + meshState.QUICFabricListenAddr,
|
||||
Reachability: reachabilityFromConnectivityMode(cfg.MeshConnectivityMode),
|
||||
NATType: cfg.MeshNATType,
|
||||
ConnectivityMode: cfg.MeshConnectivityMode,
|
||||
Region: cfg.MeshRegion,
|
||||
Priority: 5,
|
||||
PolicyTags: []string{"fast-path"},
|
||||
})
|
||||
}
|
||||
candidates = append(candidates, interfaceEndpointCandidates(cfg, identity, meshState, observedAt)...)
|
||||
for i := range candidates {
|
||||
if candidates[i].EndpointID == "" {
|
||||
|
||||
@@ -720,12 +720,17 @@ func TestHeartbeatPayloadIncludesMeshEndpointReport(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("mesh endpoint report missing: %+v", payload.Metadata)
|
||||
}
|
||||
if report["peer_endpoint"] != "https://node-a.example.test:443" ||
|
||||
if report["peer_endpoint"] != "quic://127.0.0.1:19443" ||
|
||||
report["transport"] != "direct_quic" ||
|
||||
report["connectivity_mode"] != "outbound_only" ||
|
||||
report["nat_type"] != "symmetric" ||
|
||||
report["region"] != "eu" {
|
||||
t.Fatalf("unexpected endpoint report: %+v", report)
|
||||
}
|
||||
candidates, ok := report["endpoint_candidates"].([]mesh.PeerEndpointCandidate)
|
||||
if !ok || len(candidates) < 2 || candidates[0].Transport != "direct_quic" || candidates[1].Transport != "wss" {
|
||||
t.Fatalf("unexpected endpoint candidates: %+v", report["endpoint_candidates"])
|
||||
}
|
||||
if payload.Capabilities["mesh_dynamic_endpoint_reporting"] != true {
|
||||
t.Fatalf("dynamic endpoint capability missing: %+v", payload.Capabilities)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user