summaryrefslogtreecommitdiff
path: root/transports/base/base.go
diff options
context:
space:
mode:
authorYawning Angel <yawning@torproject.org>2015-10-29 14:09:34 +0000
committerYawning Angel <yawning@torproject.org>2015-10-29 14:09:34 +0000
commite52258edac55d82ff153755493d770bfbbc9a346 (patch)
tree324136fb4500944cd8c8790e4bca2f06fb96cef8 /transports/base/base.go
parent69ffcc39c63f4a9a192082da71eea6b06a1e75d7 (diff)
Make establishing outgoing connections the transport's responsibility.
ClientFactories now have a Dial() method instead of a WrapConn() method, so that it is possible to write something like meek-client using the obfs4proxy framework. This breaks the external interface if anyone is using obfs4proxy as a library, but the new way of doing things is a trivial modification, to a single routine that shouldn't have been very large to begin with.
Diffstat (limited to 'transports/base/base.go')
-rw-r--r--transports/base/base.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/transports/base/base.go b/transports/base/base.go
index e81ea03..bb0902e 100644
--- a/transports/base/base.go
+++ b/transports/base/base.go
@@ -35,6 +35,8 @@ import (
"git.torproject.org/pluggable-transports/goptlib.git"
)
+type DialFunc func(string, string) (net.Conn, error)
+
// ClientFactory is the interface that defines the factory for creating
// pluggable transport protocol client instances.
type ClientFactory interface {
@@ -48,10 +50,10 @@ type ClientFactory interface {
// generation) to be hidden from third parties.
ParseArgs(args *pt.Args) (interface{}, error)
- // WrapConn wraps the provided net.Conn with a transport protocol
- // implementation, and does whatever is required (eg: handshaking) to get
- // the connection to a point where it is ready to relay data.
- WrapConn(conn net.Conn, args interface{}) (net.Conn, error)
+ // Dial creates an outbound net.Conn, and does whatever is required
+ // (eg: handshaking) to get the connection to the point where it is
+ // ready to relay data.
+ Dial(network, address string, dialFn DialFunc, args interface{}) (net.Conn, error)
}
// ServerFactory is the interface that defines the factory for creating