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:
+2
-2
@@ -163,8 +163,8 @@ func (lst *Listener) handleSocksConn(ctx context.Context, socksConn ptxSocksConn
|
||||
// We _must_ wrap the ptConn. Wrapping the socks conn leads us to
|
||||
// count the sent bytes as received and the received bytes as sent:
|
||||
// bytes flow in the opposite direction there for the socks conn.
|
||||
ptConn = bytecounter.MaybeWrap(ptConn, lst.SessionByteCounter)
|
||||
ptConn = bytecounter.MaybeWrap(ptConn, lst.ExperimentByteCounter)
|
||||
ptConn = bytecounter.MaybeWrapConn(ptConn, lst.SessionByteCounter)
|
||||
ptConn = bytecounter.MaybeWrapConn(ptConn, lst.ExperimentByteCounter)
|
||||
lst.forwardWithContext(ctx, socksConn, ptConn) // transfer ownership
|
||||
return nil // used for testing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user