forked from zmap/zgrab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ztls_event.go
44 lines (35 loc) · 893 Bytes
/
ztls_event.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package zlib
import (
"encoding/json"
"github.com/zmap/zgrab/ztools/ztls"
)
// HandshakeEvent implements the EventData interface
type TLSHandshakeEvent struct {
handshakeLog *ztls.ServerHandshake
}
func (he *TLSHandshakeEvent) GetType() EventType {
return TLSHandshakeEventType
}
func (he *TLSHandshakeEvent) MarshalJSON() ([]byte, error) {
return json.Marshal(he.handshakeLog)
}
func (he *TLSHandshakeEvent) UnmarshalJSON(b []byte) error {
hs := new(ztls.ServerHandshake)
if err := json.Unmarshal(b, hs); err != nil {
return err
}
he.handshakeLog = hs
return nil
}
func (he *TLSHandshakeEvent) GetHandshakeLog() *ztls.ServerHandshake {
return he.handshakeLog
}
var (
TLSHandshakeEventType = EventType{
TypeName: CONNECTION_EVENT_TLS_NAME,
GetEmptyInstance: newTLSHandshakeEvent,
}
)
func newTLSHandshakeEvent() EventData {
return new(TLSHandshakeEvent)
}