diff options
Diffstat (limited to 'probe')
| -rw-r--r-- | probe/probe.go | 20 | ||||
| -rw-r--r-- | probe/tracer.go | 48 |
2 files changed, 49 insertions, 19 deletions
diff --git a/probe/probe.go b/probe/probe.go index 951e65e..912833f 100644 --- a/probe/probe.go +++ b/probe/probe.go @@ -23,6 +23,7 @@ import ( "os" "time" + "github.com/network-quality/goresponsiveness/constants" "github.com/network-quality/goresponsiveness/debug" "github.com/network-quality/goresponsiveness/extendedstats" "github.com/network-quality/goresponsiveness/utilities" @@ -34,16 +35,18 @@ type ProbeConfiguration struct { ConnectToAddr string URL string Host string + CongestionControl *string InsecureSkipVerify bool } type ProbeDataPoint struct { - Time time.Time `Description:"Time of the generation of the data point." Formatter:"Format" FormatterArgument:"01-02-2006-15-04-05.000"` - RoundTripCount uint64 `Description:"The number of round trips measured by this data point."` - Duration time.Duration `Description:"The duration for this measurement." Formatter:"Seconds"` - TCPRtt time.Duration `Description:"The underlying connection's RTT at probe time." Formatter:"Seconds"` - TCPCwnd uint32 `Description:"The underlying connection's congestion window at probe time."` - Type ProbeType `Description:"The type of the probe." Formatter:"Value"` + Time time.Time `Description:"Time of the generation of the data point." Formatter:"Format" FormatterArgument:"01-02-2006-15-04-05.000"` + RoundTripCount uint64 `Description:"The number of round trips measured by this data point."` + Duration time.Duration `Description:"The duration for this measurement." Formatter:"Seconds"` + TCPRtt time.Duration `Description:"The underlying connection's RTT at probe time." Formatter:"Seconds"` + TCPCwnd uint32 `Description:"The underlying connection's congestion window at probe time."` + Type ProbeType `Description:"The type of the probe." Formatter:"Value"` + CongestionControl string `Description:"The congestion control algorithm used."` } const ( @@ -81,6 +84,7 @@ func Probe( probeHost string, // optional: for use with a test_endpoint probeType ProbeType, probeId uint, + congestionControl *string, captureExtendedStats bool, debugging *debug.DebugWithPrefix, ) (*ProbeDataPoint, error) { @@ -88,7 +92,7 @@ func Probe( return nil, fmt.Errorf("cannot start a probe with a nil client") } - probeTracer := NewProbeTracer(client, probeType, probeId, debugging) + probeTracer := NewProbeTracer(client, probeType, probeId, congestionControl, debugging) time_before_probe := time.Now() probe_req, err := http.NewRequestWithContext( httptrace.WithClientTrace(managingCtx, probeTracer.trace), @@ -215,5 +219,7 @@ func Probe( TCPRtt: tcpRtt, TCPCwnd: tcpCwnd, Type: probeType, + CongestionControl: *utilities.Conditional(congestionControl == nil, + &constants.DefaultL4SCongestionControlAlgorithm, congestionControl), }, nil } diff --git a/probe/tracer.go b/probe/tracer.go index e59e1aa..b9c4a3f 100644 --- a/probe/tracer.go +++ b/probe/tracer.go @@ -23,18 +23,20 @@ import ( "time" "github.com/network-quality/goresponsiveness/debug" + "github.com/network-quality/goresponsiveness/l4s" "github.com/network-quality/goresponsiveness/stats" "github.com/network-quality/goresponsiveness/traceable" "github.com/network-quality/goresponsiveness/utilities" ) type ProbeTracer struct { - client *http.Client - stats *stats.TraceStats - trace *httptrace.ClientTrace - debug debug.DebugLevel - probeid uint - probeType ProbeType + client *http.Client + stats *stats.TraceStats + trace *httptrace.ClientTrace + debug debug.DebugLevel + probeid uint + probeType ProbeType + congestionControl *string } func (p *ProbeTracer) String() string { @@ -226,6 +228,26 @@ func (probe *ProbeTracer) SetGotConnTimeInfo( ) } } + + if probe.congestionControl != nil { + if debug.IsDebug(probe.debug) { + fmt.Printf( + "(%s Probe) Setting congestion control for Probe %v to %v.\n", + probe.probeType.Value(), + probe.ProbeId(), + *probe.congestionControl, + ) + } + if err := l4s.SetL4S(probe.stats.ConnInfo.Conn, probe.congestionControl); err != nil { + fmt.Fprintf( + os.Stderr, + "(%s Probe) Probe %v could not set L4s because %v.\n", + probe.probeType.Value(), + probe.ProbeId(), + err.Error(), + ) + } + } } func (probe *ProbeTracer) SetTLSHandshakeStartTime( @@ -294,15 +316,17 @@ func NewProbeTracer( client *http.Client, probeType ProbeType, probeId uint, + congestionControl *string, debugging *debug.DebugWithPrefix, ) *ProbeTracer { probe := &ProbeTracer{ - client: client, - stats: &stats.TraceStats{}, - trace: nil, - debug: debugging.Level, - probeid: probeId, - probeType: probeType, + client: client, + stats: &stats.TraceStats{}, + trace: nil, + debug: debugging.Level, + probeid: probeId, + probeType: probeType, + congestionControl: congestionControl, } trace := traceable.GenerateHttpTimingTracer(probe, debugging.Level) |
