tls_handshakes: add endpoint addresses to handshake list (#711)
* tls_handshakes: add IP addresses * tls_handshakes: extract ip from tcp-connect * tls_handshake: switched to trace event * saver.go: get remoteAddr before handshake Not sure whether this is strictly necessary, but I'd rather take the remoteAddr before calling Handshake, just in case a future version of the handshake closes the `conn`. In such a case, `conn.RemoteAddr` would return `nil` and we would crash here. This occurred to me while reading once again the diff before merging. Co-authored-by: decfox <decfox> Co-authored-by: Simone Basso <bassosimone@gmail.com>
This commit is contained in:
parent
b81af5b058
commit
a72cc7151c
|
@ -314,6 +314,7 @@ func NewTLSHandshakesList(begin time.Time, events []trace.Event) []TLSHandshake
|
|||
continue
|
||||
}
|
||||
out = append(out, TLSHandshake{
|
||||
Address: ev.Address,
|
||||
CipherSuite: ev.TLSCipherSuite,
|
||||
Failure: NewFailure(ev.Err),
|
||||
NegotiatedProtocol: ev.TLSNegotiatedProto,
|
||||
|
|
|
@ -526,6 +526,7 @@ func TestNewTLSHandshakesList(t *testing.T) {
|
|||
Err: websocket.ErrReadLimit,
|
||||
Time: begin.Add(17 * time.Millisecond),
|
||||
}, {
|
||||
Address: "131.252.210.176:443",
|
||||
Name: "tls_handshake_done",
|
||||
Err: io.EOF,
|
||||
NoTLSVerify: false,
|
||||
|
@ -542,6 +543,7 @@ func TestNewTLSHandshakesList(t *testing.T) {
|
|||
}},
|
||||
},
|
||||
want: []archival.TLSHandshake{{
|
||||
Address: "131.252.210.176:443",
|
||||
CipherSuite: "SUITE",
|
||||
Failure: archival.NewFailure(io.EOF),
|
||||
NegotiatedProtocol: "h2",
|
||||
|
|
|
@ -29,9 +29,11 @@ func (h SaverTLSHandshaker) Handshake(
|
|||
TLSServerName: config.ServerName,
|
||||
Time: start,
|
||||
})
|
||||
remoteAddr := conn.RemoteAddr().String()
|
||||
tlsconn, state, err := h.TLSHandshaker.Handshake(ctx, conn, config)
|
||||
stop := time.Now()
|
||||
h.Saver.Write(trace.Event{
|
||||
Address: remoteAddr,
|
||||
Duration: stop.Sub(start),
|
||||
Err: err,
|
||||
Name: "tls_handshake_done",
|
||||
|
|
|
@ -163,6 +163,7 @@ type ArchivalTCPConnectStatus struct {
|
|||
//
|
||||
// See https://github.com/ooni/spec/blob/master/data-formats/df-006-tlshandshake.md
|
||||
type ArchivalTLSOrQUICHandshakeResult struct {
|
||||
Address string `json:"address"`
|
||||
CipherSuite string `json:"cipher_suite"`
|
||||
Failure *string `json:"failure"`
|
||||
NegotiatedProtocol string `json:"negotiated_protocol"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user