outline-sdk
outline-sdk copied to clipboard
WIP/DRAFT: Introducing tracers and adding trace hooks/callbacks for events
This PR aims to introduces:
- a systematic event-driven approach to collect connection traces that capture events such as establishment of TCP connection, successful read, write, DNS resolution, TLS handshake, etc.
- New connectivity tests:
2.1
do53-tcp
2.2do53-udp
2.3dot
(dns over tls) 2.4doh
(dns over https) 2.5http
,https
2.6http3/quic
TODO:
- Make a design decision on what must go into the trace package
- Finalized the ClientTrace retrievers and listeners. Shall we define a set of specialized one (
DNSClientTrace
,TLSClientTrace
, etc) which is more consistent withhttptrace
approach, or one generic one? -Put these event into a span/trace format suggested and discussed below: https://opentelemetry.io/docs/concepts/signals/traces/
Here's is an example of trace information getting printed out in stdio
:
➜ test-connectivity git:(amir-dsn-trace) ✗ go run . -v -transport="tls:|socks5://user:[email protected]:443" -test-type dot -resolver 1.1.1.1 -report-success-rate 1.0 -domain example.com -resolver-name one.one.one.one
DNS start: {pod3.letsgetconnectedquick.com}
DNS done: {[{45.76.69.216 } {70.34.210.176 }] <nil> false}
Connect start: tcp 45.76.69.216:443
Connect done: tcp 45.76.69.216:443 <nil>
TLS handshake started
SNI: pod3.letsgetconnectedquick.com
TLS version: 772
ALPN:
TLS handshake took 0.041285625 seconds.
Connected to socks5 proxy at address 45.76.69.216:443
TLS handshake started
SNI: one.one.one.one
TLS version: 772
ALPN:
TLS handshake took 0.019287583 seconds.
[DEBUG] 2024/08/22 18:43:50.254607 main.go:244: Test Type: dot Resolver Address: 1.1.1.1:853 domain: example.com result: <nil>
{"resolver":"1.1.1.1:853","proto":"tcp","transport":"tls:|socks5://[email protected]:443","time":"2024-08-23T01:43:50Z","duration_ms":186,"error":null}