summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBluesaxorcist <joshua@operatorfoundation.org>2019-09-15 20:21:00 -0500
committerBluesaxorcist <joshua@operatorfoundation.org>2019-09-15 20:21:00 -0500
commit43d0e72c72600a1bc75518a8dfe31c279b4a9400 (patch)
treede195d95e1e45d68dcfcf2bbc2a2be1c9b65cbe0
parent6b048e3e998261a4bc105593e27607cf9d56e223 (diff)
Added Dust, Meeklite, and Replicant to dispatcher modes
Still needs fixing
-rw-r--r--common/pt_extras/pt_extras.go24
-rw-r--r--modes/pt_socks5/pt_socks5.go4
-rw-r--r--modes/stun_udp/stun_udp.go5
-rw-r--r--modes/transparent_tcp/transparent_tcp.go26
-rw-r--r--modes/transparent_udp/transparent_udp.go18
-rw-r--r--transports/transports.go19
6 files changed, 64 insertions, 32 deletions
diff --git a/common/pt_extras/pt_extras.go b/common/pt_extras/pt_extras.go
index 71477bd..42160b2 100644
--- a/common/pt_extras/pt_extras.go
+++ b/common/pt_extras/pt_extras.go
@@ -205,6 +205,30 @@ func ArgsToDialer(target string, name string, args map[string]interface{}) (Opti
} else {
return transport, nil
}
+ case "Dust":
+ transport, err := transports.ParseArgsDust(args, target)
+ if err != nil {
+ log.Errorf("Could not parse options %s", err.Error())
+ return nil, err
+ } else {
+ return transport, nil
+ }
+ case "Meeklite":
+ transport, err := transports.ParseArgsMeeklite(args, target)
+ if err != nil {
+ log.Errorf("Could not parse options %s", err.Error())
+ return nil, err
+ } else {
+ return transport, nil
+ }
+ case "Replicant":
+ transport, err := transports.ParseArgsReplicant(args, target)
+ if err != nil {
+ log.Errorf("Could not parse options %s", err.Error())
+ return nil, err
+ } else {
+ return transport, nil
+ }
default:
log.Errorf("Unknown transport: %s", name)
diff --git a/modes/pt_socks5/pt_socks5.go b/modes/pt_socks5/pt_socks5.go
index 45cbbf2..59c4a7c 100644
--- a/modes/pt_socks5/pt_socks5.go
+++ b/modes/pt_socks5/pt_socks5.go
@@ -30,6 +30,7 @@
package pt_socks5
import (
+ "fmt"
options2 "github.com/OperatorFoundation/shapeshifter-dispatcher/common"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/pt_extras"
"github.com/OperatorFoundation/shapeshifter-transports/transports/Dust"
@@ -202,10 +203,11 @@ func ServerSetup(termMon *termmon.TermMonitor, bindaddrString string, ptServerIn
}
case "replicant":
config, ok :=args.Get("config")
+ fmt.Println(config)
if !ok {
return false, nil
}
- transport := replicant.New(config)
+ transport := replicant.New(replicant.Config{})
listen = transport.Listen
case "Dust":
idPath, ok :=args.Get("idPath")
diff --git a/modes/stun_udp/stun_udp.go b/modes/stun_udp/stun_udp.go
index 564e562..70d5565 100644
--- a/modes/stun_udp/stun_udp.go
+++ b/modes/stun_udp/stun_udp.go
@@ -246,7 +246,8 @@ func ServerSetup(termMon *termmon.TermMonitor, bindaddrString string, ptServerIn
return
}
case "replicant":
- if _, ok := args["config"]; ok {
+ if config, ok := args["config"]; ok {
+ fmt.Println(config)
transport := replicant.New(replicant.Config{})
listen = transport.Listen
} else {
@@ -436,4 +437,4 @@ func serverHandler(termMon *termmon.TermMonitor, name string, remote net.Conn, i
dest.Write(writeBuffer)
}
-}
+} \ No newline at end of file
diff --git a/modes/transparent_tcp/transparent_tcp.go b/modes/transparent_tcp/transparent_tcp.go
index a1addf3..5535bd6 100644
--- a/modes/transparent_tcp/transparent_tcp.go
+++ b/modes/transparent_tcp/transparent_tcp.go
@@ -34,6 +34,7 @@ import (
options2 "github.com/OperatorFoundation/shapeshifter-dispatcher/common"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/pt_extras"
"github.com/OperatorFoundation/shapeshifter-transports/transports/Dust"
+ replicant "github.com/OperatorFoundation/shapeshifter-transports/transports/Replicant"
"github.com/OperatorFoundation/shapeshifter-transports/transports/meeklite"
"github.com/OperatorFoundation/shapeshifter-transports/transports/obfs2"
"io"
@@ -167,18 +168,18 @@ func ServerSetup(termMon *termmon.TermMonitor, bindaddrString string, ptServerIn
case "obfs4":
transport := obfs4.NewObfs4Server(statedir)
listen = transport.Listen
- //case "Replicant":
- // shargs, aok := args["Replicant"]
- // if !aok {
- // return false, nil
- // }
- //
- // config, ok := shargs.Get("config")
- // if !ok {
- // return false, nil
- // }
- // transport := replicant.New(config)
- // listen = transport.Listen
+ case "Replicant":
+ shargs, aok := args["Replicant"]
+ if !aok {
+ return false, nil
+ }
+
+ _, ok := shargs.Get("config")
+ if !ok {
+ return false, nil
+ }
+ transport := replicant.New(replicant.Config{})
+ listen = transport.Listen
case "Dust":
shargs, aok := args["Dust"]
if !aok {
@@ -339,3 +340,4 @@ func copyLoop(a net.Conn, b net.Conn) error {
return nil
}
+
diff --git a/modes/transparent_udp/transparent_udp.go b/modes/transparent_udp/transparent_udp.go
index 05235d7..8d29453 100644
--- a/modes/transparent_udp/transparent_udp.go
+++ b/modes/transparent_udp/transparent_udp.go
@@ -36,6 +36,7 @@ import (
options2 "github.com/OperatorFoundation/shapeshifter-dispatcher/common"
"github.com/OperatorFoundation/shapeshifter-dispatcher/common/pt_extras"
"github.com/OperatorFoundation/shapeshifter-transports/transports/Dust"
+ replicant "github.com/OperatorFoundation/shapeshifter-transports/transports/Replicant"
"github.com/OperatorFoundation/shapeshifter-transports/transports/meeklite"
"github.com/OperatorFoundation/shapeshifter-transports/transports/shadow"
"io"
@@ -243,14 +244,15 @@ func ServerSetup(termMon *termmon.TermMonitor, bindaddrString string, ptServerIn
log.Errorf("obfs4 transport missing cert argument: %s", args)
return
}
- //case "Replicant":
- // Config, ok := args.Get("config")
- // if !ok {
- // return false, nil
- // }
- //
- // transport := replicant.New(Config)
- // listen = transport.Listen
+ case "Replicant":
+ config, ok := args.Get("config")
+ fmt.Println(config)
+ if !ok {
+ return false, nil
+ }
+
+ transport := replicant.New(replicant.Config{})
+ listen = transport.Listen
case "Dust":
idPath, ok := args.Get("idPath")
if !ok {
diff --git a/transports/transports.go b/transports/transports.go
index 0089be2..14576f2 100644
--- a/transports/transports.go
+++ b/transports/transports.go
@@ -31,6 +31,7 @@ package transports
import (
"errors"
+ "fmt"
"github.com/OperatorFoundation/shapeshifter-transports/transports/Dust"
"github.com/OperatorFoundation/shapeshifter-transports/transports/Optimizer"
replicant "github.com/OperatorFoundation/shapeshifter-transports/transports/Replicant"
@@ -214,8 +215,8 @@ func ParseArgsDust(args map[string]interface{}, target string) (*Dust.Transport,
}
func ParseArgsReplicant(args map[string]interface{}, target string) (*replicant.Transport, error) {
- var conf replicant.Config
-
+ var conf string
+ fmt.Println(conf)
untypedConfig, ok := args["config"]
if !ok {
return nil, errors.New("replicant transport missing config argument")
@@ -233,8 +234,8 @@ func ParseArgsReplicant(args map[string]interface{}, target string) (*replicant.
}
transport := replicant.Transport{
- replicant.Config{} config,
- Address: target,
+ Config: replicant.Config{},
+ Address: target,
}
return &transport, nil
@@ -242,7 +243,7 @@ func ParseArgsReplicant(args map[string]interface{}, target string) (*replicant.
func ParseArgsMeeklite(args map[string]interface{}, target string) (*meeklite.Transport, error) {
- var url gourl.URL
+ var url *gourl.URL
var front string
untypedUrl, ok := args["url"]
@@ -287,8 +288,8 @@ func ParseArgsMeeklite(args map[string]interface{}, target string) (*meeklite.Tr
}
func ParseArgsOptimizer(args map[string]interface{}, target string) (*Optimizer.OptimizerTransport, error) {
- var transports []Optimizer.Transport
- var strategy Optimizer.Strategy
+ var transports string
+ var strategy string
untypedTransports, ok := args["transports"]
if !ok {
@@ -296,7 +297,7 @@ func ParseArgsOptimizer(args map[string]interface{}, target string) (*Optimizer.
}
switch untypedTransports.(type) {
- case []Optimizer.Transport:
+ case string:
var icerr error
transports, icerr = interconv.ParseString(untypedTransports)
if icerr != nil {
@@ -312,7 +313,7 @@ func ParseArgsOptimizer(args map[string]interface{}, target string) (*Optimizer.
}
switch untypedStrategy.(type) {
- case Optimizer.Strategy:
+ case string:
var icerr error
strategy, icerr = interconv.ParseString(untypedStrategy)
if icerr != nil {