Speak protocol 3.0 and fall back to 2.0 only when that is the reflector's maximum.

A reflector that has moved to 3.0 will not accept a station that always announces 2.0, and a 2.x reflector still needs one explicit plaintext session.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 14:24:00 +02:00
co-authored by Cursor
parent 0930d4b727
commit 3d1a2a1669
24 changed files with 3180 additions and 244 deletions
+12 -6
View File
@@ -27,14 +27,20 @@ func TestLoginAnnouncesProtocolAndJoinsTheTalkGroup(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if got.Callsign != "DL1ABC" || got.TalkGroup != 20 || got.Detail != "Idle" {
t.Fatalf("State = %+v, want DL1ABC talk group 20 Idle", got)
if got.Callsign != "DL1ABC" || got.TalkGroup != 20 || got.Detail != "Idle" || got.Protocol != "" {
t.Fatalf("State = %+v, want DL1ABC talk group 20 Idle and a blank protocol", got)
}
refl.accept(t)
typ, body := refl.readFrame(t)
if typ != 5 || len(body) != 4 || body[0] != 0 || body[1] != 2 || body[2] != 0 || body[3] != 0 {
t.Fatalf("first frame type %d body %v, want protocol 2.0", typ, body)
if typ != 5 || !versionIs(body, 3, 0) {
t.Fatalf("first frame type %d body %v, want protocol 3.0", typ, body)
}
refl.writeFrame(t, 6, versionWire(2, 0))
refl.accept(t)
typ, body = refl.readFrame(t)
if typ != 5 || !versionIs(body, 2, 0) {
t.Fatalf("fallback frame type %d body %v, want protocol 2.0", typ, body)
}
challenge := make([]byte, 20)
@@ -91,8 +97,8 @@ func TestLoginAnnouncesProtocolAndJoinsTheTalkGroup(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if got.Detail != "Idle" || got.Talker != "" {
t.Fatalf("State = %+v, want Connected Idle", got)
if got.Detail != "Idle" || got.Talker != "" || got.Protocol != "2.0" {
t.Fatalf("State = %+v, want Connected Idle protocol 2.0", got)
}
// No other talk group: the next TCP message is a heartbeat, not a monitor set.