MCPcopy Create free account
hub / github.com/SamNet-dev/snix / TestRankSNIsKeepsOnlyOK

Function TestRankSNIsKeepsOnlyOK

scanner/sni_test.go:137–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestRankSNIsKeepsOnlyOK(t *testing.T) {
138 in := []Result{
139 {SNI: "a", Outcome: OutcomeOK, Handshake: 100 * time.Millisecond},
140 {SNI: "b", Outcome: OutcomeDPIReset},
141 {SNI: "c", Outcome: OutcomeOK, Handshake: 50 * time.Millisecond},
142 {SNI: "d", Outcome: OutcomeOK, Handshake: 200 * time.Millisecond},
143 }
144 ranked := RankSNIs(in)
145 if len(ranked) != 3 {
146 t.Fatalf("len: %d want 3", len(ranked))
147 }
148 if ranked[0].SNI != "c" || ranked[1].SNI != "a" || ranked[2].SNI != "d" {
149 t.Fatalf("order: %+v", ranked)
150 }
151}

Callers

nothing calls this directly

Calls 1

RankSNIsFunction · 0.85

Tested by

no test coverage detected