mirror of
https://github.com/renorris/openfsd
synced 2026-04-06 23:45:38 +08:00
refactor query type validation, support SIMDATA type
This commit is contained in:
@@ -2,6 +2,7 @@ package protocol
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -50,18 +51,7 @@ func (p *ClientQueryResponsePDU) Parse(packet string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
switch pdu.QueryType {
|
||||
case "ATC", "CAPS", "C?",
|
||||
"RN", "SV", "ATIS",
|
||||
"IP", "INF", "FP",
|
||||
"IPC", "BY", "HI",
|
||||
"HLP", "NOHLP", "WH",
|
||||
"IT", "HT", "DR",
|
||||
"FA", "TA", "BC",
|
||||
"SC", "VT", "ACC",
|
||||
"NEWINFO", "NEWATIS", "EST",
|
||||
"GD":
|
||||
default:
|
||||
if _, exists := slices.BinarySearch(supportedClientQueryTypes, pdu.QueryType); !exists {
|
||||
return NewGenericFSDError(SyntaxError, fields[2], "invalid query type")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user