2021-11-02 12:20:04 +01:00
|
|
|
package netxlite
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Bogon
|
|
|
|
//
|
|
|
|
// This file helps us to decide if an IPAddr is a bogon.
|
|
|
|
//
|
|
|
|
|
|
|
|
import (
|
2022-05-31 08:11:07 +02:00
|
|
|
"context"
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
"net"
|
|
|
|
|
2022-05-31 08:11:07 +02:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/model"
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
|
|
|
)
|
|
|
|
|
2022-05-31 08:11:07 +02:00
|
|
|
// BogonResolver is a bogon aware resolver. When a bogon is encountered in
|
|
|
|
// a reply, this resolver will return ErrDNSBogon.
|
2022-06-05 19:52:39 +02:00
|
|
|
//
|
|
|
|
// This resolver is not part of the default chain created by WrapResolver
|
|
|
|
// therefore it returns errors that have already been wrapped.
|
|
|
|
//
|
|
|
|
// BUG: This resolver currently only implements LookupHost. All the other
|
|
|
|
// lookup methods will always return ErrNoDNSTransport.
|
2022-05-31 08:11:07 +02:00
|
|
|
type BogonResolver struct {
|
|
|
|
Resolver model.Resolver
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ model.Resolver = &BogonResolver{}
|
|
|
|
|
|
|
|
// LookupHost implements Resolver.LookupHost
|
|
|
|
func (r *BogonResolver) LookupHost(ctx context.Context, hostname string) ([]string, error) {
|
|
|
|
addrs, err := r.Resolver.LookupHost(ctx, hostname)
|
|
|
|
if err != nil {
|
2022-06-05 19:52:39 +02:00
|
|
|
return nil, err // not our responsibility to wrap this error
|
2022-05-31 08:11:07 +02:00
|
|
|
}
|
|
|
|
for _, addr := range addrs {
|
|
|
|
if IsBogon(addr) {
|
2022-06-05 19:52:39 +02:00
|
|
|
// wrap ErrDNSBogon as documented
|
|
|
|
return nil, newErrWrapper(classifyResolverError, ResolveOperation, ErrDNSBogon)
|
2022-05-31 08:11:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return addrs, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// LookupHTTPS implements Resolver.LookupHTTPS
|
|
|
|
func (r *BogonResolver) LookupHTTPS(ctx context.Context, hostname string) (*model.HTTPSSvc, error) {
|
|
|
|
// TODO(bassosimone): decide whether we want to implement this method or not
|
|
|
|
return nil, ErrNoDNSTransport
|
|
|
|
}
|
|
|
|
|
|
|
|
// LookupNS implements Resolver.LookupNS
|
|
|
|
func (r *BogonResolver) LookupNS(ctx context.Context, hostname string) ([]*net.NS, error) {
|
|
|
|
// TODO(bassosimone): decide whether we want to implement this method or not
|
|
|
|
return nil, ErrNoDNSTransport
|
|
|
|
}
|
|
|
|
|
|
|
|
// Network implements Resolver.Network
|
|
|
|
func (r *BogonResolver) Network() string {
|
|
|
|
return r.Resolver.Network()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Address implements Resolver.Address
|
|
|
|
func (r *BogonResolver) Address() string {
|
|
|
|
return r.Resolver.Address()
|
|
|
|
}
|
|
|
|
|
|
|
|
// CloseIdleConnections implements Resolver.CloseIdleConnections
|
|
|
|
func (r *BogonResolver) CloseIdleConnections() {
|
|
|
|
r.Resolver.CloseIdleConnections()
|
|
|
|
}
|
|
|
|
|
2022-05-13 15:32:47 +02:00
|
|
|
// IsBogon returns whether an IP address is bogon. Passing to this
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
// function a non-IP address causes it to return true.
|
2021-11-02 12:20:04 +01:00
|
|
|
func IsBogon(address string) bool {
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
ip := net.ParseIP(address)
|
2022-05-15 19:25:27 +02:00
|
|
|
return ip == nil || isBogon(address, ip)
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
}
|
|
|
|
|
2022-05-13 15:32:47 +02:00
|
|
|
// IsLoopback returns whether an IP address is loopback. Passing to this
|
|
|
|
// function a non-IP address causes it to return true.
|
|
|
|
func IsLoopback(address string) bool {
|
|
|
|
ip := net.ParseIP(address)
|
|
|
|
return ip == nil || ip.IsLoopback()
|
|
|
|
}
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
|
2022-05-13 15:32:47 +02:00
|
|
|
var (
|
|
|
|
bogons4 []*net.IPNet
|
|
|
|
bogons6 []*net.IPNet
|
|
|
|
)
|
|
|
|
|
2022-05-15 19:25:27 +02:00
|
|
|
func expandBogons(cidrs []string) (out []*net.IPNet) {
|
2022-05-13 15:32:47 +02:00
|
|
|
for _, cidr := range cidrs {
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
_, block, err := net.ParseCIDR(cidr)
|
|
|
|
runtimex.PanicOnError(err, "net.ParseCIDR failed")
|
2022-05-13 15:32:47 +02:00
|
|
|
out = append(out, block)
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
}
|
2022-05-13 15:32:47 +02:00
|
|
|
return
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
}
|
|
|
|
|
2022-05-13 15:32:47 +02:00
|
|
|
func init() {
|
2022-05-15 19:25:27 +02:00
|
|
|
bogons4 = append(bogons4, expandBogons([]string{
|
2022-05-13 15:32:47 +02:00
|
|
|
//
|
|
|
|
// List extracted from https://ipinfo.io/bogon
|
|
|
|
//
|
|
|
|
"0.0.0.0/8", // "This" network
|
|
|
|
"10.0.0.0/8", // Private-use networks
|
|
|
|
"100.64.0.0/10", // Carrier-grade NAT
|
|
|
|
"127.0.0.0/8", // Loopback
|
|
|
|
"127.0.53.53/32", // Name collision occurrence
|
|
|
|
"169.254.0.0/16", // Link local
|
|
|
|
"172.16.0.0/12", // Private-use networks
|
|
|
|
"192.0.0.0/24", // IETF protocol assignments
|
|
|
|
"192.0.2.0/24", // TEST-NET-1
|
|
|
|
"192.168.0.0/16", // Private-use networks
|
|
|
|
"198.18.0.0/15", // Network interconnect device benchmark testing
|
|
|
|
"198.51.100.0/24", // TEST-NET-2
|
|
|
|
"203.0.113.0/24", // TEST-NET-3
|
|
|
|
"224.0.0.0/4", // Multicast
|
|
|
|
"240.0.0.0/4", // Reserved for future use
|
|
|
|
"255.255.255.255/32", // Limited broadcast
|
|
|
|
})...)
|
2022-05-15 19:25:27 +02:00
|
|
|
bogons6 = append(bogons6, expandBogons([]string{
|
2022-05-13 15:32:47 +02:00
|
|
|
//
|
|
|
|
// List extracted from https://ipinfo.io/bogon
|
|
|
|
//
|
|
|
|
"::/128", // Node-scope unicast unspecified address
|
|
|
|
"::1/128", // Node-scope unicast loopback address
|
|
|
|
"::ffff:0:0/96", // IPv4-mapped addresses
|
|
|
|
"::/96", // IPv4-compatible addresses
|
|
|
|
"100::/64", // Remotely triggered black hole addresses
|
|
|
|
"2001:10::/28", // Overlay routable cryptographic hash identifiers (ORCHID)
|
|
|
|
"2001:db8::/32", // Documentation prefix
|
|
|
|
"fc00::/7", // Unique local addresses (ULA)
|
|
|
|
"fe80::/10", // Link-local unicast
|
|
|
|
"fec0::/10", // Site-local unicast (deprecated)
|
|
|
|
"ff00::/8", // Multicast (Note: ff0e:/16 is global scope and may appear on the global internet.)
|
|
|
|
"2002::/24", // 6to4 bogon (0.0.0.0/8)
|
|
|
|
"2002:a00::/24", // 6to4 bogon (10.0.0.0/8)
|
|
|
|
"2002:7f00::/24", // 6to4 bogon (127.0.0.0/8)
|
|
|
|
"2002:a9fe::/32", // 6to4 bogon (169.254.0.0/16)
|
|
|
|
"2002:ac10::/28", // 6to4 bogon (172.16.0.0/12)
|
|
|
|
"2002:c000::/40", // 6to4 bogon (192.0.0.0/24)
|
|
|
|
"2002:c000:200::/40", // 6to4 bogon (192.0.2.0/24)
|
|
|
|
"2002:c0a8::/32", // 6to4 bogon (192.168.0.0/16)
|
|
|
|
"2002:c612::/31", // 6to4 bogon (198.18.0.0/15)
|
|
|
|
"2002:c633:6400::/40", // 6to4 bogon (198.51.100.0/24)
|
|
|
|
"2002:cb00:7100::/40", // 6to4 bogon (203.0.113.0/24)
|
|
|
|
"2002:e000::/20", // 6to4 bogon (224.0.0.0/4)
|
|
|
|
"2002:f000::/20", // 6to4 bogon (240.0.0.0/4)
|
|
|
|
"2002:ffff:ffff::/48", // 6to4 bogon (255.255.255.255/32)
|
|
|
|
"2001::/40", // Teredo bogon (0.0.0.0/8)
|
|
|
|
"2001:0:a00::/40", // Teredo bogon (10.0.0.0/8)
|
|
|
|
"2001:0:7f00::/40", // Teredo bogon (127.0.0.0/8)
|
|
|
|
"2001:0:a9fe::/48", // Teredo bogon (169.254.0.0/16)
|
|
|
|
"2001:0:ac10::/44", // Teredo bogon (172.16.0.0/12)
|
|
|
|
"2001:0:c000::/56", // Teredo bogon (192.0.0.0/24)
|
|
|
|
"2001:0:c000:200::/56", // Teredo bogon (192.0.2.0/24)
|
|
|
|
"2001:0:c0a8::/48", // Teredo bogon (192.168.0.0/16)
|
|
|
|
"2001:0:c612::/47", // Teredo bogon (198.18.0.0/15)
|
|
|
|
"2001:0:c633:6400::/56", // Teredo bogon (198.51.100.0/24)
|
|
|
|
"2001:0:cb00:7100::/56", // Teredo bogon (203.0.113.0/24)
|
|
|
|
"2001:0:e000::/36", // Teredo bogon (224.0.0.0/4)
|
|
|
|
"2001:0:f000::/36", // Teredo bogon (240.0.0.0/4)
|
|
|
|
"2001:0:ffff:ffff::/64", // Teredo bogon (255.255.255.255/32)
|
|
|
|
})...)
|
|
|
|
}
|
|
|
|
|
2022-05-15 19:25:27 +02:00
|
|
|
// isBogon implements IsBogon
|
|
|
|
func isBogon(address string, ip net.IP) bool {
|
|
|
|
// TODO(bassosimone): the following check is probably redundant given that these
|
|
|
|
// three checks are already included into the list of bogons.
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
if ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() {
|
|
|
|
return true
|
|
|
|
}
|
2022-05-13 15:32:47 +02:00
|
|
|
var bogons []*net.IPNet
|
|
|
|
if isIPv6(address) {
|
|
|
|
bogons = bogons6
|
|
|
|
} else {
|
|
|
|
bogons = bogons4
|
|
|
|
}
|
|
|
|
for _, block := range bogons {
|
feat(measurex): refactored measurement library (#528)
This commit introduce a measurement library that consists of
refactored code from earlier websteps experiments.
I am not going to add tests for the time being, because this library
is still a bit in flux, as we finalize websteps.
I will soon though commit documentation explaining in detail how
to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506
and adds a new directory to internal/tutorial.
The core idea of this measurement library is to allow two
measurement modes:
1. tracing, which is what we're currently doing now, and the
tutorial shows how we can rewrite the measurement part of web
connectivity with measurex using less code. Under a tracing
approach, we construct a normal http.Client that however has
tracing configured, we gather events for resolve, connect, TLS
handshake, QUIC handshake, HTTP round trip, etc. and then we
try to make sense of what happened from the events stream;
2. step-by-step, which is what websteps does, and basically
means that after each operation you immediately write into
a Measurement structure its results and immediately draw the
conclusions on what seems odd (which later may become an
anomaly if we see what the test helper measured).
This library is also such that it produces a data format
compatible with the current OONI spec.
This work is part of https://github.com/ooni/probe/issues/1733.
2021-09-30 01:24:08 +02:00
|
|
|
if block.Contains(ip) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|