summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modes/pt_socks5/pt_socks5.go46
-rw-r--r--modes/stun_udp/stun_udp.go43
-rw-r--r--modes/transparent_udp/transparent_udp.go45
3 files changed, 134 insertions, 0 deletions
diff --git a/modes/pt_socks5/pt_socks5.go b/modes/pt_socks5/pt_socks5.go
index 14b55e1..8ff2528 100644
--- a/modes/pt_socks5/pt_socks5.go
+++ b/modes/pt_socks5/pt_socks5.go
@@ -136,6 +136,52 @@ func clientHandler(target string, termMon *termmon.TermMonitor, name string, con
socksReq.Reply(socks5.ReplyGeneralFailure)
return
}
+ //case "shadow":
+ // if password, ok := args["password"]; ok {
+ // if cipher, ok2 := args["cipherName"]; ok2 {
+ // transport := shadow.NewShadowClient(password[0], cipher[0])
+ // dialer = transport.Dial
+ // } else {
+ // log.Errorf("shadow transport missing cipher argument: %s", args)
+ // socksReq.Reply(socks5.ReplyGeneralFailure)
+ // return
+ // }
+ // } else {
+ // log.Errorf("shadow transport missing password argument: %s", args)
+ // socksReq.Reply(socks5.ReplyGeneralFailure)
+ // return
+ // }
+ // case "Optimizer":
+ // if _, ok := args["transports"]; ok {
+ // if strategyName, ok2 := args["strategy"]; ok2 {
+ // var strategy Optimizer.Strategy = nil
+ // switch strategyName[0] {
+ // case "first":
+ // strategy = Optimizer.NewFirstStrategy()
+ // case "random":
+ // strategy = Optimizer.NewRandomStrategy()
+ // case "rotate":
+ // strategy = Optimizer.NewRotateStrategy()
+ // case "track":
+ // strategy = Optimizer.NewTrackStrategy()
+ // case "min":
+ // strategy = Optimizer.NewMinimizeDialDuration()
+ // }
+ //transports := []Optimizer.Transport{}
+ //transport := Optimizer.NewOptimizerClient(transports, strategy)
+ // return transport, nil
+ ////says too many arguments to return just like earlier.
+ // } else {
+ // log.Errorf("Optimizer transport missing transports argument: %s", args)
+ // socksReq.Reply(socks5.ReplyGeneralFailure)
+ // return
+ // }
+ //} else {
+ // log.Errorf("Optimizer transport missing strategy argument: %s", args)
+ // socksReq.Reply(socks5.ReplyGeneralFailure)
+ // return
+ //}
+
default:
log.Errorf("Unknown transport: %s", name)
socksReq.Reply(socks5.ReplyGeneralFailure)
diff --git a/modes/stun_udp/stun_udp.go b/modes/stun_udp/stun_udp.go
index 7f0cdea..c9abcd6 100644
--- a/modes/stun_udp/stun_udp.go
+++ b/modes/stun_udp/stun_udp.go
@@ -31,6 +31,7 @@ package stun_udp
import (
"fmt"
+ "github.com/OperatorFoundation/shapeshifter-transports/transports/shadow"
"io"
golog "log"
"net"
@@ -254,6 +255,48 @@ func ServerSetup(termMon *termmon.TermMonitor, bindaddrString string, ptServerIn
log.Errorf("obfs4 transport missing cert argument: %s", args)
return
}
+ case "shadow":
+ if password, ok := args["password"]; ok {
+ if cipher, ok2 := args["cipherName"]; ok2 {
+ transport := shadow.NewShadowClient(password[0], cipher[0])
+ listen = transport.Listen
+ } else {
+ log.Errorf("shadow transport missing cipher argument: %s", args)
+ return
+ }
+ } else {
+ log.Errorf("shadow transport missing password argument: %s", args)
+ return
+ }
+ // case "Optimizer":
+ // if _, ok := args["transports"]; ok {
+ // if strategyName, ok2 := args["strategy"]; ok2 {
+ // var strategy Optimizer.Strategy = nil
+ // switch strategyName[0] {
+ // case "first":
+ // strategy = Optimizer.NewFirstStrategy()
+ // case "random":
+ // strategy = Optimizer.NewRandomStrategy()
+ // case "rotate":
+ // strategy = Optimizer.NewRotateStrategy()
+ // case "track":
+ // strategy = Optimizer.NewTrackStrategy()
+ // case "min":
+ // strategy = Optimizer.NewMinimizeDialDuration()
+ // }
+ //transports := []Optimizer.Transport{}
+ //transport := Optimizer.NewOptimizerClient(transports, strategy)
+ // return transport, nil
+ ////says too many arguments to return just like earlier. tried autocorrecting and now it says transport is not type bool
+ // } else {
+ // log.Errorf("Optimizer transport missing transports argument: %s", args)
+ // return
+ // }
+ //} else {
+ // log.Errorf("Optimizer transport missing strategy argument: %s", args)
+ // return
+ //}
+
default:
log.Errorf("Unknown transport: %s", name)
return
diff --git a/modes/transparent_udp/transparent_udp.go b/modes/transparent_udp/transparent_udp.go
index 6e573c2..58ef491 100644
--- a/modes/transparent_udp/transparent_udp.go
+++ b/modes/transparent_udp/transparent_udp.go
@@ -45,6 +45,8 @@ import (
"github.com/OperatorFoundation/shapeshifter-ipc"
"github.com/OperatorFoundation/shapeshifter-transports/transports/obfs2"
"github.com/OperatorFoundation/shapeshifter-transports/transports/obfs4"
+ //"github.com/OperatorFoundation/shapeshifter-transports/transports/Optimizer"
+ //"github.com/OperatorFoundation/shapeshifter-transports/transports/shadow"
)
var stateDir string
@@ -205,6 +207,49 @@ func dialConn(tracker *ConnTracker, addr string, target string, name string, opt
log.Errorf("obfs4 transport missing cert argument: %s", args)
return
}
+ //case "shadow":
+ // if password, ok := args["password"]; ok {
+ // if cipher, ok2 := args["cipherName"]; ok2 {
+ //transport := shadow.NewShadowClient(password[0], cipher[0])
+ //dialer = transport.Dial
+ ////transport.Dial isn't the right type somehow?
+ // } else {
+ // log.Errorf("shadow transport missing cipher argument: %s", args)
+ // return
+ // }
+ //} else {
+ // log.Errorf("shadow transport missing password argument: %s", args)
+ // return
+ //}
+ //case "Optimizer":
+ // if _, ok := args["transports"]; ok {
+ // if strategyName, ok2 := args["strategy"]; ok2 {
+ // var strategy Optimizer.Strategy = nil
+ // switch strategyName[0] {
+ // case "first":
+ // strategy = Optimizer.NewFirstStrategy()
+ // case "random":
+ // strategy = Optimizer.NewRandomStrategy()
+ // case "rotate":
+ // strategy = Optimizer.NewRotateStrategy()
+ // case "track":
+ // strategy = Optimizer.NewTrackStrategy()
+ // case "min":
+ // strategy = Optimizer.NewMinimizeDialDuration()
+ // }
+ //transports := []Optimizer.Transport{}
+ //transport := Optimizer.NewOptimizerClient(transports, strategy)
+ //return transport
+ ////says too many arguments to return? where is the return type specified?
+ // } else {
+ // log.Errorf("Optimizer transport missing transports argument: %s", args)
+ // return
+ // }
+ //} else {
+ // log.Errorf("Optimizer transport missing strategy argument: %s", args)
+ // return
+ //}
+
default:
log.Errorf("Unknown transport: %s", name)
return