summaryrefslogtreecommitdiff
path: root/modes/pt_socks5
diff options
context:
space:
mode:
authorBrandon Wiley <brandon@blanu.net>2016-11-16 15:10:16 -0600
committerBrandon Wiley <brandon@blanu.net>2016-11-16 15:10:16 -0600
commitfc4bf82171d7337c9db1ce91e553a3b9a97beb02 (patch)
treedbc39637fe5888e010b9cfd02536fd46add147e4 /modes/pt_socks5
parentc1d70905378fefa781172e9e9b314a816765c32a (diff)
Added new command line flags and refactored ClientSetup to use them
Diffstat (limited to 'modes/pt_socks5')
-rw-r--r--modes/pt_socks5/pt_socks5.go34
1 files changed, 3 insertions, 31 deletions
diff --git a/modes/pt_socks5/pt_socks5.go b/modes/pt_socks5/pt_socks5.go
index e7a4cec..38b0e2c 100644
--- a/modes/pt_socks5/pt_socks5.go
+++ b/modes/pt_socks5/pt_socks5.go
@@ -41,7 +41,6 @@ import (
"git.torproject.org/pluggable-transports/goptlib.git"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/log"
- "github.com/OperatorFoundation/shapeshifter-dispatcher/common/pt_extras"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/socks5"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/termmon"
"github.com/OperatorFoundation/shapeshifter-dispatcher/transports"
@@ -49,41 +48,14 @@ import (
)
const (
- obfs4proxyVersion = "0.0.7-dev"
- obfs4proxyLogFile = "obfs4proxy.log"
- socksAddr = "127.0.0.1:0"
+ socksAddr = "127.0.0.1:0"
)
var stateDir string
-func ClientSetup(termMon *termmon.TermMonitor) (launched bool, listeners []net.Listener) {
- ptClientInfo, err := pt.ClientSetup(transports.Transports())
- if err != nil {
- golog.Fatal(err)
- }
-
- ptClientProxy, err := pt_extras.PtGetProxy()
- fmt.Println("ptclientproxy", ptClientProxy)
- if err != nil {
- golog.Fatal(err)
- } else if ptClientProxy != nil {
- pt_extras.PtProxyDone()
- }
-
+func ClientSetup(termMon *termmon.TermMonitor, ptClientProxy *url.URL, factories map[string]base.ClientFactory) (launched bool, listeners []net.Listener) {
// Launch each of the client listeners.
- for _, name := range ptClientInfo.MethodNames {
- t := transports.Get(name)
- if t == nil {
- pt.CmethodError(name, "no such transport is supported")
- continue
- }
-
- f, err := t.ClientFactory(stateDir)
- if err != nil {
- pt.CmethodError(name, "failed to get ClientFactory")
- continue
- }
-
+ for name, f := range factories {
ln, err := net.Listen("tcp", socksAddr)
if err != nil {
pt.CmethodError(name, err.Error())