2021-10-18 12:51:36 +03:00
|
|
|
package format
|
|
|
|
|
2023-05-03 10:59:09 +03:00
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/wader/fq/pkg/decode"
|
|
|
|
)
|
2023-03-29 01:36:55 +03:00
|
|
|
|
2022-06-01 17:55:55 +03:00
|
|
|
// TODO: do before-format somehow and topology sort?
|
|
|
|
const (
|
|
|
|
ProbeOrderBinUnique = 0 // binary with unlikely overlap
|
2022-08-15 13:12:37 +03:00
|
|
|
ProbeOrderBinFuzzy = 100 // binary with possible overlap
|
|
|
|
ProbeOrderTextJSON = 200 // text json has prio as yaml overlap
|
|
|
|
ProbeOrderTextFuzzy = 300 // text with possible overlap
|
2022-06-01 17:55:55 +03:00
|
|
|
)
|
|
|
|
|
2023-03-29 01:36:55 +03:00
|
|
|
// TODO: move to group package somehow?
|
|
|
|
|
2023-05-03 10:59:09 +03:00
|
|
|
type Probe_In struct {
|
|
|
|
IsProbe bool
|
|
|
|
Filename string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use HasExt("cer", "CeR", ...)
|
|
|
|
func (pi Probe_In) HasExt(ss ...string) bool {
|
|
|
|
ext := filepath.Ext(pi.Filename)
|
|
|
|
if ext == "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
ext = ext[1:]
|
|
|
|
for _, s := range ss {
|
|
|
|
if strings.EqualFold(s, ext) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
type Probe_Args_In struct {
|
|
|
|
IsProbeArgs bool
|
|
|
|
Filename string
|
|
|
|
DecodeGroup string
|
|
|
|
}
|
|
|
|
|
2023-03-29 01:36:55 +03:00
|
|
|
var (
|
2023-05-01 14:19:04 +03:00
|
|
|
Image = &decode.Group{Name: "image"}
|
|
|
|
INET_Packet = &decode.Group{Name: "inet_packet", DefaultInArg: INET_Packet_In{}} // ex: ipv4
|
|
|
|
IP_Packet = &decode.Group{Name: "ip_packet", DefaultInArg: INET_Packet_In{}} // ex: tcp
|
2024-02-18 18:33:39 +03:00
|
|
|
Link_Frame = &decode.Group{Name: "link_frame", DefaultInArg: Link_Frame_In{}} // ex: ethernet
|
|
|
|
MP3_Frame_Tags = &decode.Group{Name: "mp3_frame_tags"}
|
|
|
|
Probe = &decode.Group{Name: "probe", DefaultInArg: Probe_In{}}
|
|
|
|
Probe_Args = &decode.Group{Name: "probe_args", DefaultInArg: Probe_Args_In{}}
|
2023-05-01 14:19:04 +03:00
|
|
|
TCP_Stream = &decode.Group{Name: "tcp_stream", DefaultInArg: TCP_Stream_In{}} // ex: http
|
|
|
|
UDP_Payload = &decode.Group{Name: "udp_payload", DefaultInArg: UDP_Payload_In{}} // ex: dns
|
2023-03-29 01:36:55 +03:00
|
|
|
|
|
|
|
Bits = &decode.Group{Name: "bits"}
|
2024-02-18 18:33:39 +03:00
|
|
|
Bytes = &decode.Group{Name: "bytes"}
|
2023-03-29 01:36:55 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
AAC_Frame = &decode.Group{Name: "aac_frame"}
|
|
|
|
ADTS = &decode.Group{Name: "adts"}
|
|
|
|
ADTS_Frame = &decode.Group{Name: "adts_frame"}
|
|
|
|
AIFF = &decode.Group{Name: "aiff"}
|
|
|
|
AMF0 = &decode.Group{Name: "amf0"}
|
|
|
|
Apev2 = &decode.Group{Name: "apev2"}
|
|
|
|
Apple_Bookmark = &decode.Group{Name: "apple_bookmark"}
|
|
|
|
AR = &decode.Group{Name: "ar"}
|
|
|
|
ASN1_BER = &decode.Group{Name: "asn1_ber"}
|
|
|
|
AV1_CCR = &decode.Group{Name: "av1_ccr"}
|
|
|
|
AV1_Frame = &decode.Group{Name: "av1_frame"}
|
|
|
|
AV1_OBU = &decode.Group{Name: "av1_obu"}
|
|
|
|
AVC_Annexb = &decode.Group{Name: "avc_annexb"}
|
|
|
|
AVC_AU = &decode.Group{Name: "avc_au"}
|
|
|
|
AVC_DCR = &decode.Group{Name: "avc_dcr"}
|
|
|
|
AVC_NALU = &decode.Group{Name: "avc_nalu"}
|
|
|
|
AVC_PPS = &decode.Group{Name: "avc_pps"}
|
|
|
|
AVC_SEI = &decode.Group{Name: "avc_sei"}
|
|
|
|
AVC_SPS = &decode.Group{Name: "avc_sps"}
|
|
|
|
AVI = &decode.Group{Name: "avi"}
|
|
|
|
Avro_Ocf = &decode.Group{Name: "avro_ocf"}
|
|
|
|
Bencode = &decode.Group{Name: "bencode"}
|
|
|
|
Bitcoin_Blkdat = &decode.Group{Name: "bitcoin_blkdat"}
|
|
|
|
Bitcoin_Block = &decode.Group{Name: "bitcoin_block"}
|
|
|
|
Bitcoin_Script = &decode.Group{Name: "bitcoin_script"}
|
|
|
|
Bitcoin_Transaction = &decode.Group{Name: "bitcoin_transaction"}
|
|
|
|
Bplist = &decode.Group{Name: "bplist"}
|
|
|
|
BSD_Loopback_Frame = &decode.Group{Name: "bsd_loopback_frame"}
|
|
|
|
BSON = &decode.Group{Name: "bson"}
|
|
|
|
Bzip2 = &decode.Group{Name: "bzip2"}
|
2023-08-17 23:17:01 +03:00
|
|
|
CAFF = &decode.Group{Name: "caff"}
|
2023-05-01 14:19:04 +03:00
|
|
|
CBOR = &decode.Group{Name: "cbor"}
|
|
|
|
CSV = &decode.Group{Name: "csv"}
|
|
|
|
DNS = &decode.Group{Name: "dns"}
|
|
|
|
DNS_TCP = &decode.Group{Name: "dns_tcp"}
|
|
|
|
ELF = &decode.Group{Name: "elf"}
|
|
|
|
Ether_8023_Frame = &decode.Group{Name: "ether8023_frame"}
|
|
|
|
Exif = &decode.Group{Name: "exif"}
|
|
|
|
Fairplay_SPC = &decode.Group{Name: "fairplay_spc"}
|
2024-02-06 20:52:06 +03:00
|
|
|
FIT = &decode.Group{Name: "fit"}
|
2023-05-01 14:19:04 +03:00
|
|
|
FLAC = &decode.Group{Name: "flac"}
|
|
|
|
FLAC_Frame = &decode.Group{Name: "flac_frame"}
|
|
|
|
FLAC_Metadatablock = &decode.Group{Name: "flac_metadatablock"}
|
|
|
|
FLAC_Metadatablocks = &decode.Group{Name: "flac_metadatablocks"}
|
|
|
|
FLAC_Picture = &decode.Group{Name: "flac_picture"}
|
|
|
|
FLAC_Streaminfo = &decode.Group{Name: "flac_streaminfo"}
|
|
|
|
FLV = &decode.Group{Name: "flv"}
|
|
|
|
GIF = &decode.Group{Name: "gif"}
|
|
|
|
Gzip = &decode.Group{Name: "gzip"}
|
|
|
|
HEVC_Annexb = &decode.Group{Name: "hevc_annexb"}
|
|
|
|
HEVC_AU = &decode.Group{Name: "hevc_au"}
|
|
|
|
HEVC_DCR = &decode.Group{Name: "hevc_dcr"}
|
|
|
|
HEVC_NALU = &decode.Group{Name: "hevc_nalu"}
|
|
|
|
HEVC_PPS = &decode.Group{Name: "hevc_pps"}
|
|
|
|
HEVC_SPS = &decode.Group{Name: "hevc_sps"}
|
|
|
|
HEVC_VPS = &decode.Group{Name: "hevc_vps"}
|
|
|
|
HTML = &decode.Group{Name: "html"}
|
|
|
|
ICC_Profile = &decode.Group{Name: "icc_profile"}
|
|
|
|
ICMP = &decode.Group{Name: "icmp"}
|
|
|
|
ICMPv6 = &decode.Group{Name: "icmpv6"}
|
|
|
|
ID3v1 = &decode.Group{Name: "id3v1"}
|
|
|
|
ID3v11 = &decode.Group{Name: "id3v11"}
|
|
|
|
ID3v2 = &decode.Group{Name: "id3v2"}
|
|
|
|
IPv4Packet = &decode.Group{Name: "ipv4_packet"}
|
|
|
|
IPv6Packet = &decode.Group{Name: "ipv6_packet"}
|
|
|
|
JPEG = &decode.Group{Name: "jpeg"}
|
|
|
|
JSON = &decode.Group{Name: "json"}
|
|
|
|
JSONL = &decode.Group{Name: "jsonl"}
|
2023-12-06 21:24:49 +03:00
|
|
|
LevelDB_Descriptor = &decode.Group{Name: "leveldb_descriptor"}
|
2023-12-07 01:22:32 +03:00
|
|
|
LevelDB_LDB = &decode.Group{Name: "leveldb_table"}
|
|
|
|
LevelDB_LOG = &decode.Group{Name: "leveldb_log"}
|
2023-06-20 19:24:49 +03:00
|
|
|
LuaJIT = &decode.Group{Name: "luajit"}
|
2023-05-01 14:19:04 +03:00
|
|
|
MachO = &decode.Group{Name: "macho"}
|
|
|
|
MachO_Fat = &decode.Group{Name: "macho_fat"}
|
|
|
|
Markdown = &decode.Group{Name: "markdown"}
|
|
|
|
Matroska = &decode.Group{Name: "matroska"}
|
2023-08-18 06:07:55 +03:00
|
|
|
MOC3 = &decode.Group{Name: "moc3"}
|
2023-05-01 14:19:04 +03:00
|
|
|
MP3 = &decode.Group{Name: "mp3"}
|
|
|
|
MP3_Frame = &decode.Group{Name: "mp3_frame"}
|
|
|
|
MP3_Frame_VBRI = &decode.Group{Name: "mp3_frame_vbri"}
|
|
|
|
MP3_Frame_XING = &decode.Group{Name: "mp3_frame_xing"}
|
|
|
|
MP4 = &decode.Group{Name: "mp4"}
|
|
|
|
MPEG_ASC = &decode.Group{Name: "mpeg_asc"}
|
|
|
|
MPEG_ES = &decode.Group{Name: "mpeg_es"}
|
|
|
|
MPEG_PES_Packet = &decode.Group{Name: "mpeg_pes_packet"}
|
|
|
|
MPEG_SPU = &decode.Group{Name: "mpeg_spu"}
|
|
|
|
MPEG_TS = &decode.Group{Name: "mpeg_ts"}
|
2024-02-18 18:33:39 +03:00
|
|
|
MPES_PES = &decode.Group{Name: "mpeg_pes"}
|
2023-05-01 14:19:04 +03:00
|
|
|
MsgPack = &decode.Group{Name: "msgpack"}
|
|
|
|
Ogg = &decode.Group{Name: "ogg"}
|
|
|
|
Ogg_Page = &decode.Group{Name: "ogg_page"}
|
2024-02-18 18:33:39 +03:00
|
|
|
Opentimestamps = &decode.Group{Name: "opentimestamps"}
|
2023-05-01 14:19:04 +03:00
|
|
|
Opus_Packet = &decode.Group{Name: "opus_packet"}
|
|
|
|
PCAP = &decode.Group{Name: "pcap"}
|
|
|
|
PCAPNG = &decode.Group{Name: "pcapng"}
|
2023-05-04 08:45:42 +03:00
|
|
|
Pg_BTree = &decode.Group{Name: "pg_btree"}
|
|
|
|
Pg_Control = &decode.Group{Name: "pg_control"}
|
|
|
|
Pg_Heap = &decode.Group{Name: "pg_heap"}
|
2023-05-01 14:19:04 +03:00
|
|
|
PNG = &decode.Group{Name: "png"}
|
|
|
|
Prores_Frame = &decode.Group{Name: "prores_frame"}
|
|
|
|
Protobuf = &decode.Group{Name: "protobuf"}
|
|
|
|
ProtobufWidevine = &decode.Group{Name: "protobuf_widevine"}
|
|
|
|
PSSH_Playready = &decode.Group{Name: "pssh_playready"}
|
|
|
|
RTMP = &decode.Group{Name: "rtmp"}
|
|
|
|
SLL_Packet = &decode.Group{Name: "sll_packet"}
|
|
|
|
SLL2_Packet = &decode.Group{Name: "sll2_packet"}
|
|
|
|
TAR = &decode.Group{Name: "tar"}
|
|
|
|
TCP_Segment = &decode.Group{Name: "tcp_segment"}
|
|
|
|
TIFF = &decode.Group{Name: "tiff"}
|
|
|
|
TLS = &decode.Group{Name: "tls"}
|
|
|
|
TOML = &decode.Group{Name: "toml"}
|
|
|
|
Tzif = &decode.Group{Name: "tzif"}
|
|
|
|
UDP_Datagram = &decode.Group{Name: "udp_datagram"}
|
|
|
|
Vorbis_Comment = &decode.Group{Name: "vorbis_comment"}
|
|
|
|
Vorbis_Packet = &decode.Group{Name: "vorbis_packet"}
|
|
|
|
VP8_Frame = &decode.Group{Name: "vp8_frame"}
|
|
|
|
VP9_CFM = &decode.Group{Name: "vp9_cfm"}
|
|
|
|
VP9_Frame = &decode.Group{Name: "vp9_frame"}
|
|
|
|
VPX_CCR = &decode.Group{Name: "vpx_ccr"}
|
|
|
|
WASM = &decode.Group{Name: "wasm"}
|
|
|
|
WAV = &decode.Group{Name: "wav"}
|
|
|
|
WebP = &decode.Group{Name: "webp"}
|
|
|
|
XML = &decode.Group{Name: "xml"}
|
|
|
|
YAML = &decode.Group{Name: "yaml"}
|
|
|
|
Zip = &decode.Group{Name: "zip"}
|
2021-10-18 12:51:36 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// below are data types used to communicate between formats <FormatName>In/Out
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type AAC_Frame_In struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
ObjectType int `doc:"Audio object type"`
|
|
|
|
}
|
2023-05-01 14:19:04 +03:00
|
|
|
type AVC_AU_In struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
LengthSize uint64 `doc:"Length value size"`
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type AVC_DCR_Out struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
LengthSize uint64
|
|
|
|
}
|
2023-08-17 23:17:01 +03:00
|
|
|
|
|
|
|
type CAFF_In struct {
|
|
|
|
Uncompress bool `doc:"Uncompress and probe files"`
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Frame_In struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
SamplesBuf []byte
|
|
|
|
BitsPerSample int `doc:"Bits per sample"`
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Frame_Out struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
SamplesBuf []byte
|
|
|
|
Samples uint64
|
|
|
|
Channels int
|
|
|
|
BitsPerSample int
|
|
|
|
}
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Stream_Info struct {
|
2021-10-28 02:44:09 +03:00
|
|
|
SampleRate uint64
|
2021-12-09 19:15:21 +03:00
|
|
|
BitsPerSample uint64
|
2021-10-28 02:44:09 +03:00
|
|
|
TotalSamplesInStream uint64
|
2021-11-05 17:04:26 +03:00
|
|
|
MD5 []byte
|
2021-10-28 02:44:09 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Streaminfo_Out struct {
|
|
|
|
StreamInfo FLAC_Stream_Info
|
2021-10-28 02:44:09 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Metadatablock_Out struct {
|
2021-10-28 02:44:09 +03:00
|
|
|
IsLastBlock bool
|
|
|
|
HasStreamInfo bool
|
2023-05-01 14:19:04 +03:00
|
|
|
StreamInfo FLAC_Stream_Info
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type FLAC_Metadatablocks_Out struct {
|
2021-10-18 12:51:36 +03:00
|
|
|
HasStreamInfo bool
|
2023-05-01 14:19:04 +03:00
|
|
|
StreamInfo FLAC_Stream_Info
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type HEVC_AU_In struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
LengthSize uint64 `doc:"Length value size"`
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type HEVC_DCR_Out struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
LengthSize uint64
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Ogg_Page_Out struct {
|
2021-10-18 12:51:36 +03:00
|
|
|
IsLastPage bool
|
|
|
|
IsFirstPage bool
|
|
|
|
IsContinuedPacket bool
|
|
|
|
StreamSerialNumber uint32
|
|
|
|
SequenceNo uint32
|
2021-11-30 15:12:14 +03:00
|
|
|
Segments [][]byte
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Protobuf_In struct {
|
2021-10-18 12:51:36 +03:00
|
|
|
Message ProtoBufMessage
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Matroska_In struct {
|
2023-02-08 13:21:08 +03:00
|
|
|
DecodeSamples bool `doc:"Decode samples"`
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MP3_In struct {
|
2021-12-09 19:15:21 +03:00
|
|
|
MaxUniqueHeaderConfigs int `doc:"Max number of unique frame header configs allowed"`
|
2023-01-25 17:27:31 +03:00
|
|
|
MaxUnknown int `doc:"Max percent (0-100) unknown bits"`
|
2021-12-09 19:15:21 +03:00
|
|
|
MaxSyncSeek int `doc:"Max byte distance to next sync"`
|
2021-10-18 12:51:36 +03:00
|
|
|
}
|
2021-11-19 13:55:45 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MP3_Frame_Out struct {
|
2021-11-19 13:55:45 +03:00
|
|
|
MPEGVersion int
|
|
|
|
ProtectionAbsent bool
|
|
|
|
BitRate int
|
|
|
|
SampleRate int
|
|
|
|
ChannelsIndex int
|
|
|
|
ChannelModeIndex int
|
|
|
|
}
|
2021-11-24 23:20:46 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MPEG_Decoder_Config struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
ObjectType int
|
|
|
|
ASCObjectType int
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MPEG_ES_Out struct {
|
|
|
|
DecoderConfigs []MPEG_Decoder_Config
|
2023-03-29 01:36:55 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MPEG_ASC_Out struct {
|
2023-03-29 01:36:55 +03:00
|
|
|
ObjectType int
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Link_Frame_In struct {
|
2022-04-01 17:31:55 +03:00
|
|
|
Type int
|
|
|
|
IsLittleEndian bool // pcap endian etc
|
2022-01-03 22:17:01 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type INET_Packet_In struct {
|
2022-04-01 17:31:55 +03:00
|
|
|
EtherType int
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type IP_Packet_In struct {
|
2022-04-01 17:31:55 +03:00
|
|
|
Protocol int
|
2022-01-03 22:17:01 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type UDP_Payload_In struct {
|
2021-11-24 23:20:46 +03:00
|
|
|
SourcePort int
|
|
|
|
DestinationPort int
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
func (u UDP_Payload_In) IsPort(ports ...int) bool {
|
2022-04-08 16:03:47 +03:00
|
|
|
for _, p := range ports {
|
|
|
|
if u.DestinationPort == p || u.SourcePort == p {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
func (u UDP_Payload_In) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
2022-04-08 16:03:47 +03:00
|
|
|
if !u.IsPort(ports...) {
|
|
|
|
fn("incorrect udp port %t src:%d dst:%d", u.DestinationPort, u.SourcePort)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type TCP_Stream_In struct {
|
2022-03-29 23:41:11 +03:00
|
|
|
IsClient bool
|
2022-04-08 16:03:47 +03:00
|
|
|
HasStart bool
|
|
|
|
HasEnd bool
|
2022-05-06 17:45:59 +03:00
|
|
|
SkippedBytes uint64
|
2021-11-24 23:20:46 +03:00
|
|
|
SourcePort int
|
|
|
|
DestinationPort int
|
|
|
|
}
|
2021-12-06 21:33:17 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type TCP_Stream_Out struct {
|
2023-02-10 22:06:38 +03:00
|
|
|
PostFn func(peerIn any)
|
|
|
|
InArg any
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
func (t TCP_Stream_In) IsPort(ports ...int) bool {
|
2022-04-08 16:03:47 +03:00
|
|
|
for _, p := range ports {
|
|
|
|
if (t.IsClient && t.DestinationPort == p) ||
|
|
|
|
(!t.IsClient && t.SourcePort == p) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
func (t TCP_Stream_In) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
2022-04-08 16:03:47 +03:00
|
|
|
if !t.IsPort(ports...) {
|
|
|
|
fn("incorrect tcp port client %t src:%d dst:%d", t.IsClient, t.DestinationPort, t.SourcePort)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type MP4_In struct {
|
2023-02-08 13:21:08 +03:00
|
|
|
DecodeSamples bool `doc:"Decode samples"`
|
2021-12-09 19:15:21 +03:00
|
|
|
AllowTruncated bool `doc:"Allow box to be truncated"`
|
2021-12-06 21:33:17 +03:00
|
|
|
}
|
2022-05-26 13:39:14 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type AVI_In struct {
|
2023-10-12 16:48:36 +03:00
|
|
|
DecodeSamples bool `doc:"Decode samples"`
|
|
|
|
DecodeExtendedChunks bool `doc:"Decode extended chunks"`
|
2022-10-29 20:23:50 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Zip_In struct {
|
2022-05-26 20:27:17 +03:00
|
|
|
Uncompress bool `doc:"Uncompress and probe files"`
|
2022-05-26 13:39:14 +03:00
|
|
|
}
|
2022-06-01 17:55:55 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type XML_In struct {
|
2022-08-25 17:06:25 +03:00
|
|
|
Seq bool `doc:"Use seq attribute to preserve element order"`
|
|
|
|
Array bool `doc:"Decode as nested arrays"`
|
|
|
|
AttributePrefix string `doc:"Prefix for attribute keys"`
|
2022-06-01 17:55:55 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type HTML_In struct {
|
2022-08-25 17:06:25 +03:00
|
|
|
Seq bool `doc:"Use seq attribute to preserve element order"`
|
|
|
|
Array bool `doc:"Decode as nested arrays"`
|
|
|
|
AttributePrefix string `doc:"Prefix for attribute keys"`
|
2022-06-01 17:55:55 +03:00
|
|
|
}
|
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type CSV_In struct {
|
2022-06-01 17:55:55 +03:00
|
|
|
Comma string `doc:"Separator character"`
|
|
|
|
Comment string `doc:"Comment line character"`
|
|
|
|
}
|
2022-08-26 13:07:29 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type Bitcoin_Block_In struct {
|
2022-08-26 13:07:29 +03:00
|
|
|
HasHeader bool `doc:"Has blkdat header"`
|
|
|
|
}
|
2023-02-10 22:06:38 +03:00
|
|
|
|
2023-05-01 14:19:04 +03:00
|
|
|
type TLS_In struct {
|
2023-02-10 22:06:38 +03:00
|
|
|
Keylog string `doc:"NSS Key Log content"`
|
|
|
|
}
|
2023-05-03 09:44:02 +03:00
|
|
|
|
2023-05-04 08:45:42 +03:00
|
|
|
type Pg_Control_In struct {
|
2022-09-23 13:50:54 +03:00
|
|
|
Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14.., postgres10"`
|
|
|
|
}
|
|
|
|
|
2023-05-04 08:45:42 +03:00
|
|
|
type Pg_Heap_In struct {
|
2022-12-22 11:22:02 +03:00
|
|
|
Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14.., postgres10"`
|
|
|
|
Page int `doc:"First page number in file, default is 0"`
|
|
|
|
Segment int `doc:"Segment file number (16790.1 is 1), default is 0"`
|
|
|
|
}
|
|
|
|
|
2023-05-04 08:45:42 +03:00
|
|
|
type Pg_BTree_In struct {
|
2022-12-22 11:22:02 +03:00
|
|
|
Page int `doc:"First page number in file, default is 0"`
|
2022-10-07 12:58:36 +03:00
|
|
|
}
|