aboutsummaryrefslogtreecommitdiff
path: root/parsers/parser.go
blob: 06cc0dc26da0b9da023e91bed1a6018301413aaf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package parsers

type Parser interface {
	TryParse(content []byte) Metadata

}

type Metadata interface {
}

type BasicMetadata struct {
	Type string `json:"type"`
}

var parsers = []Parser{	// order matter
	HttpRequestParser{},
	HttpResponseParser{},
}

func Parse(content []byte) Metadata {
	for _, parser := range parsers {
		if metadata := parser.TryParse(content); metadata != nil {
			return metadata
		}
	}

	return nil
}