refactor(netx): move construction logic outside package (#798)
For testability, replace most if-based construction logic with calls to well-tested factories living in other packages. While there, acknowledge that a bunch of types could now be private and make them private, modifying the code to call the public factories allowing to construct said types instead. Part of https://github.com/ooni/probe/issues/2121
This commit is contained in:
parent
2d3d5d9cdc
commit
6b85dfce88
20 changed files with 475 additions and 184 deletions
|
|
@ -38,7 +38,7 @@ func WithExperimentByteCounter(ctx context.Context, counter *Counter) context.Co
|
|||
// MaybeWrapWithContextByteCounters wraps a conn with the byte counters
|
||||
// that have previosuly been configured into a context.
|
||||
func MaybeWrapWithContextByteCounters(ctx context.Context, conn net.Conn) net.Conn {
|
||||
conn = MaybeWrap(conn, ContextExperimentByteCounter(ctx))
|
||||
conn = MaybeWrap(conn, ContextSessionByteCounter(ctx))
|
||||
conn = MaybeWrapConn(conn, ContextExperimentByteCounter(ctx))
|
||||
conn = MaybeWrapConn(conn, ContextSessionByteCounter(ctx))
|
||||
return conn
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue