Skip to content

Commit

Permalink
psiphon, telegram: sync with latest spec (#225)
Browse files Browse the repository at this point in the history
* psiphon: add TLS handshake data

This is consistent w/ psiphon's spec v0.3.2

* telegram: export TLS handshake info

Equivalent to spec 2020-01-11-001
  • Loading branch information
bassosimone authored Jan 11, 2020
1 parent 595c18d commit 41b419f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
36 changes: 13 additions & 23 deletions experiment/psiphon/psiphon.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

const (
testName = "psiphon"
testVersion = "0.3.1"
testVersion = "0.3.2"
)

// Config contains the experiment's configuration.
Expand All @@ -45,27 +45,14 @@ type Config struct {
// This is what will end up into the Measurement.TestKeys field
// when you run this experiment.
type TestKeys struct {
// Agent is the HTTP agent we're using.
Agent string `json:"agent"`

// BootstrapTime is the seconds it took to bootstrap Psiphon.
BootstrapTime float64 `json:"bootstrap_time"`

// Failure contains the failure that occurred.
Failure *string `json:"failure"`

// MaxRuntime is the number of seconds after which we
// interrupt the psiphon experiment.
MaxRuntime float64 `json:"max_runtime"`

// Queries contains the DNS queries.
Queries oonidatamodel.DNSQueriesList `json:"queries"`

// Requests contains HTTP measurements
Requests oonidatamodel.RequestList `json:"requests"`

// SOCKSProxy is the address of the proxy we're using.
SOCKSProxy string `json:"socksproxy"`
Agent string `json:"agent"`
BootstrapTime float64 `json:"bootstrap_time"`
Failure *string `json:"failure"`
MaxRuntime float64 `json:"max_runtime"`
Queries oonidatamodel.DNSQueriesList `json:"queries"`
Requests oonidatamodel.RequestList `json:"requests"`
SOCKSProxy string `json:"socksproxy"`
TLSHandshakes oonidatamodel.TLSHandshakesList `json:"tls_handshakes"`
}

type runner struct {
Expand Down Expand Up @@ -141,8 +128,11 @@ func (r *runner) usetunnel(
r.testkeys.Requests = append(
r.testkeys.Requests, oonidatamodel.NewRequestList(results.TestKeys)...,
)
r.testkeys.TLSHandshakes = append(
r.testkeys.TLSHandshakes, oonidatamodel.NewTLSHandshakesList(results.TestKeys)...,
)
// TODO(bassosimone): understand if there is a way to ask
// the tunnel the number of bytes sent and/or received
// the tunnel the number of bytes sent and received
receivedBytes := results.TestKeys.ReceivedBytes
sentBytes := results.TestKeys.SentBytes
r.callbacks.OnDataUsage(
Expand Down
23 changes: 14 additions & 9 deletions experiment/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,23 @@ import (

const (
testName = "telegram"
testVersion = "0.0.4"
testVersion = "0.0.5"
)

// Config contains the experiment config.
type Config struct{}

// TestKeys contains telegram test keys.
type TestKeys struct {
Agent string `json:"agent"`
Queries oonidatamodel.DNSQueriesList `json:"queries"`
Requests oonidatamodel.RequestList `json:"requests"`
TCPConnect oonidatamodel.TCPConnectList `json:"tcp_connect"`
TelegramHTTPBlocking bool `json:"telegram_http_blocking"`
TelegramTCPBlocking bool `json:"telegram_tcp_blocking"`
TelegramWebFailure *string `json:"telegram_web_failure"`
TelegramWebStatus string `json:"telegram_web_status"`
Agent string `json:"agent"`
Queries oonidatamodel.DNSQueriesList `json:"queries"`
Requests oonidatamodel.RequestList `json:"requests"`
TCPConnect oonidatamodel.TCPConnectList `json:"tcp_connect"`
TelegramHTTPBlocking bool `json:"telegram_http_blocking"`
TelegramTCPBlocking bool `json:"telegram_tcp_blocking"`
TelegramWebFailure *string `json:"telegram_web_failure"`
TelegramWebStatus string `json:"telegram_web_status"`
TLSHandshakes oonidatamodel.TLSHandshakesList `json:"tls_handshakes"`
}

type urlMeasurements struct {
Expand Down Expand Up @@ -78,6 +79,10 @@ func (tk *TestKeys) processone(v *urlMeasurements) error {
tk.TCPConnect,
oonidatamodel.NewTCPConnectList(r.TestKeys)...,
)
tk.TLSHandshakes = append(
tk.TLSHandshakes,
oonidatamodel.NewTLSHandshakesList(r.TestKeys)...,
)
// process access points first
if v.method != "GET" {
if r.Error == nil {
Expand Down

0 comments on commit 41b419f

Please sign in to comment.