Refactoring
Refactored Protocol.Name -> Protocol.Type; added Encapsulation field Refactored TLS parsing; added support for ALPN
This commit is contained in:
@@ -31,7 +31,7 @@ func detectHTTPRequest(dir Direction, data []byte, srcPort, dstPort int) (proto
|
||||
)
|
||||
if request, err := http.ReadRequest(r); err == nil {
|
||||
return &Protocol{
|
||||
Name: ProtocolHTTP,
|
||||
Type: TypeHTTP,
|
||||
Version: Version{
|
||||
Major: request.ProtoMajor,
|
||||
Minor: request.ProtoMinor,
|
||||
@@ -66,7 +66,7 @@ func detectHTTPRequest(dir Direction, data []byte, srcPort, dstPort int) (proto
|
||||
_, _ = fmt.Sscanf(string(part[2]), "HTTP/%d.%d ", &version.Major, &version.Minor)
|
||||
|
||||
return &Protocol{
|
||||
Name: ProtocolHTTP,
|
||||
Type: TypeHTTP,
|
||||
Version: version,
|
||||
}, confidence + .75
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func detectHTTPResponse(dir Direction, data []byte, srcPort, dstPort int) (proto
|
||||
)
|
||||
if response, err := http.ReadResponse(r, nil); err == nil {
|
||||
return &Protocol{
|
||||
Name: ProtocolHTTP,
|
||||
Type: TypeHTTP,
|
||||
Version: Version{
|
||||
Major: response.ProtoMajor,
|
||||
Minor: response.ProtoMinor,
|
||||
@@ -110,7 +110,7 @@ func detectHTTPResponse(dir Direction, data []byte, srcPort, dstPort int) (proto
|
||||
_, _ = fmt.Sscanf(string(data), "HTTP/%d.%d ", &version.Major, &version.Minor)
|
||||
|
||||
return &Protocol{
|
||||
Name: ProtocolHTTP,
|
||||
Type: TypeHTTP,
|
||||
Version: version,
|
||||
}, confidence + .75
|
||||
}
|
||||
|
Reference in New Issue
Block a user