summaryrefslogtreecommitdiff
path: root/shapeshifter-dispatcher
diff options
context:
space:
mode:
authorBrandon Wiley <brandon@blanu.net>2017-02-08 10:52:56 -0600
committerBrandon Wiley <brandon@blanu.net>2017-02-08 10:52:56 -0600
commitc8c93dde6d60108eee12a0b72221716cef190a7f (patch)
treee6a7368eb5dfae5613c4df0ad8c4a26c3b94a0aa /shapeshifter-dispatcher
parent9feb19570446d81b78f6383e26e18398185c1140 (diff)
Ported remaining proxy modes (UDP, STUN, SOCKS) to PT 2.0 Go API
Diffstat (limited to 'shapeshifter-dispatcher')
-rw-r--r--shapeshifter-dispatcher/shapeshifter-dispatcher.go116
1 files changed, 62 insertions, 54 deletions
diff --git a/shapeshifter-dispatcher/shapeshifter-dispatcher.go b/shapeshifter-dispatcher/shapeshifter-dispatcher.go
index 1e57c7a..ef03484 100644
--- a/shapeshifter-dispatcher/shapeshifter-dispatcher.go
+++ b/shapeshifter-dispatcher/shapeshifter-dispatcher.go
@@ -49,8 +49,9 @@ import (
// "github.com/OperatorFoundation/shapeshifter-dispatcher/modes/pt_socks5"
// "github.com/OperatorFoundation/shapeshifter-dispatcher/modes/stun_udp"
"github.com/OperatorFoundation/shapeshifter-dispatcher/modes/transparent_tcp"
- // "github.com/OperatorFoundation/shapeshifter-dispatcher/modes/transparent_udp"
+ "github.com/OperatorFoundation/shapeshifter-dispatcher/modes/transparent_udp"
+ "github.com/OperatorFoundation/obfs4/modes/stun_udp"
_ "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_http"
_ "github.com/OperatorFoundation/obfs4/proxy_dialers/proxy_socks4"
"github.com/OperatorFoundation/shapeshifter-dispatcher/transports"
@@ -155,26 +156,30 @@ func main() {
// Do the transparent proxy configuration.
log.Infof("%s - initializing transparent proxy", execName)
if *udp {
- // log.Infof("%s - initializing UDP transparent proxy", execName)
- // if isClient {
- // log.Infof("%s - initializing client transport listeners", execName)
- // if *target == "" {
- // log.Errorf("%s - transparent mode requires a target", execName)
- // } else {
- // fmt.Println("transparent udp client")
- // factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
- // launched = transparent_udp.ClientSetup(termMon, *target, factories, ptClientProxy)
- // }
- // } else {
- // log.Infof("%s - initializing server transport listeners", execName)
- // if *bindAddr == "" {
- // fmt.Println("%s - transparent mode requires a bindaddr", execName)
- // } else {
- // fmt.Println("transparent udp server")
- // launched = transparent_udp.ServerSetup(termMon, *bindAddr, *target)
- // fmt.Println("launched", launched, ptListeners)
- // }
- // }
+ log.Infof("%s - initializing UDP transparent proxy", execName)
+ if isClient {
+ log.Infof("%s - initializing client transport listeners", execName)
+ if *target == "" {
+ log.Errorf("%s - transparent mode requires a target", execName)
+ } else {
+ fmt.Println("transparent udp client")
+ factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
+ launched = transparent_udp.ClientSetup(termMon, *target, factories, ptClientProxy)
+ }
+ } else {
+ log.Infof("%s - initializing server transport listeners", execName)
+ if *bindAddr == "" {
+ fmt.Println("%s - transparent mode requires a bindaddr", execName)
+ } else {
+ fmt.Println("transparent udp server")
+ // launched = transparent_udp.ServerSetup(termMon, *bindAddr, *target)
+ // fmt.Println("launched", launched, ptListeners)
+
+ factories, ptServerInfo := getServerFactories(ptversion, bindAddr, options, transportsList, orport)
+ launched, serverListeners = transparent_udp.ServerSetup(termMon, *bindAddr, factories, ptServerInfo)
+ fmt.Println("launched", launched, serverListeners)
+ }
+ }
} else {
log.Infof("%s - initializing TCP transparent proxy", execName)
if isClient {
@@ -197,39 +202,42 @@ func main() {
}
}
} else {
- // if *udp {
- // log.Infof("%s - initializing STUN UDP proxy", execName)
- // if isClient {
- // log.Infof("%s - initializing client transport listeners", execName)
- // if *target == "" {
- // log.Errorf("%s - STUN mode requires a target", execName)
- // } else {
- // fmt.Println("STUN udp client")
- // factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
- // launched = stun_udp.ClientSetup(termMon, *target, factories, ptClientProxy)
- // }
- // } else {
- // log.Infof("%s - initializing server transport listeners", execName)
- // if *bindAddr == "" {
- // fmt.Println("%s - STUN mode requires a bindaddr", execName)
- // } else {
- // fmt.Println("STUN udp server")
- // launched = stun_udp.ServerSetup(termMon, *bindAddr, *target)
- // fmt.Println("launched", launched, ptListeners)
- // }
- // }
- // } else {
- // // Do the managed pluggable transport protocol configuration.
- // log.Infof("%s - initializing PT 1.0 proxy", execName)
- // if isClient {
- // log.Infof("%s - initializing client transport listeners", execName)
- // factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
- // launched, ptListeners = pt_socks5.ClientSetup(termMon, factories, ptClientProxy)
- // } else {
- // log.Infof("%s - initializing server transport listeners", execName)
- // launched, ptListeners = pt_socks5.ServerSetup(termMon)
- // }
- // }
+ if *udp {
+ log.Infof("%s - initializing STUN UDP proxy", execName)
+ if isClient {
+ log.Infof("%s - initializing client transport listeners", execName)
+ if *target == "" {
+ log.Errorf("%s - STUN mode requires a target", execName)
+ } else {
+ fmt.Println("STUN udp client")
+ factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
+ launched = stun_udp.ClientSetup(termMon, *target, factories, ptClientProxy)
+ }
+ } else {
+ log.Infof("%s - initializing server transport listeners", execName)
+ if *bindAddr == "" {
+ fmt.Println("%s - STUN mode requires a bindaddr", execName)
+ } else {
+ fmt.Println("STUN udp server")
+ factories, ptServerInfo := getServerFactories(ptversion, bindAddr, options, transportsList, orport)
+ launched, serverListeners = stun_udp.ServerSetup(termMon, *bindAddr, factories, ptServerInfo)
+ fmt.Println("launched", launched, serverListeners)
+ }
+ }
+ } else {
+ // Do the managed pluggable transport protocol configuration.
+ log.Infof("%s - initializing PT 1.0 proxy", execName)
+ if isClient {
+ log.Infof("%s - initializing client transport listeners", execName)
+ factories, ptClientProxy := getClientFactories(ptversion, transportsList, proxy)
+ launched, clientListeners = transparent_tcp.ClientSetup(termMon, *target, factories, ptClientProxy)
+ } else {
+ log.Infof("%s - initializing server transport listeners", execName)
+ factories, ptServerInfo := getServerFactories(ptversion, bindAddr, options, transportsList, orport)
+ launched, serverListeners = transparent_tcp.ServerSetup(termMon, *bindAddr, factories, ptServerInfo)
+ fmt.Println("launched", launched, serverListeners)
+ }
+ }
}
if !launched {