diff --git a/transports/obfs2/v2/go.mod b/transports/obfs2/v2/go.mod index 9793304..e15edaa 100644 --- a/transports/obfs2/v2/go.mod +++ b/transports/obfs2/v2/go.mod @@ -5,7 +5,6 @@ go 1.12 require ( github.com/OperatorFoundation/obfs4 v1.0.0 github.com/OperatorFoundation/shapeshifter-ipc v0.0.0-20170814234159-11746ba927e0 - github.com/OperatorFoundation/shapeshifter-transports v0.0.0-20200211223228-5b0aa21018a5 - github.com/OperatorFoundation/shapeshifter-transports/transports/Optimizer/v2 v2.1.12 + github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b ) diff --git a/transports/obfs2/v2/go.sum b/transports/obfs2/v2/go.sum index 3f3e8e8..7a5e130 100644 --- a/transports/obfs2/v2/go.sum +++ b/transports/obfs2/v2/go.sum @@ -1,38 +1,20 @@ git.torproject.org/pluggable-transports/goptlib.git v1.1.0/go.mod h1:YT4XMSkuEXbtqlydr9+OxqFAyspUv0Gr9qhM3B++o/Q= github.com/OperatorFoundation/ed25519 v0.0.0-20200225224545-b22b4bd3ddef h1:1xEtDEuNE9/yybZaHS94OIjx5FUo4e8M3UwcK9bFC9s= github.com/OperatorFoundation/ed25519 v0.0.0-20200225224545-b22b4bd3ddef/go.mod h1:gQNGvsyT4Zmps9H/yzCqdc+RQzt8ZxCndRNtGTYnBzQ= -github.com/OperatorFoundation/obfs4 v0.0.0-20161108041644-17f2cb99c264 h1:8UbFvUSYrlcEU9W92tohq74kYvtXJo11WLI16TMi904= -github.com/OperatorFoundation/obfs4 v0.0.0-20161108041644-17f2cb99c264/go.mod h1:oxwvRzQ4FDp7ysA1En4F/pyOh2Jfef4YTo1YhHUsBOA= github.com/OperatorFoundation/obfs4 v1.0.0 h1:OcfdNMzv69fKQrLTkTSwpaBkHyBZMLjigA5M3txZpAg= github.com/OperatorFoundation/obfs4 v1.0.0/go.mod h1:6apgxOLYwyvbpzujpFHWu6Jlc+mjn1aFK7WvNijIVWc= github.com/OperatorFoundation/shapeshifter-ipc v0.0.0-20170814234159-11746ba927e0 h1:zDYt6FDJwDSX4woVFVK2EMt7fkxU5L5qDNLUjQwA+BQ= github.com/OperatorFoundation/shapeshifter-ipc v0.0.0-20170814234159-11746ba927e0/go.mod h1:kB00Ak8Dgn1uZlZHLc/WsUta58Jc+n/ZhCetcPkh42Q= -github.com/OperatorFoundation/shapeshifter-transports v0.0.0-20200211223228-5b0aa21018a5 h1:UrCgBKvfj+Rim1jAUkRqQt1neJgLVHtKt0228tEmFKY= -github.com/OperatorFoundation/shapeshifter-transports v0.0.0-20200211223228-5b0aa21018a5/go.mod h1:u3jvRgYV13oHabVAdXekh3yk9PHfpCKvB8uolQEs4jA= -github.com/OperatorFoundation/shapeshifter-transports v2.1.11+incompatible h1:Icbjg/r1BC9NlQ4yk0XVhjJ4PtWRwd1uS6IrvPSuje4= -github.com/OperatorFoundation/shapeshifter-transports/transports/Optimizer/v2 v2.1.12 h1:BCDQ0UhF4RGxK7eYIBW94uQpOCQvpYbMkdJxSX5s6ZE= -github.com/OperatorFoundation/shapeshifter-transports/transports/Optimizer/v2 v2.1.12/go.mod h1:+A6vQ50ZAHi76GOGtpH730VFirwb1p8E6VJM8M50gNk= -github.com/OperatorFoundation/shapeshifter-transports/transports/meeklite/v2 v2.1.11 h1:LpSrJLqvqLG3dDK2/FJBMrNEq+Bez1V7kE5CTUYQvT8= -github.com/OperatorFoundation/shapeshifter-transports/transports/meeklite/v2 v2.1.11/go.mod h1:yPCbCoTjLIG+p0xiuRDwW5t+DivxTHqGU5njf89AkHY= -github.com/OperatorFoundation/shapeshifter-transports/transports/obfs4/v2 v2.1.11 h1:YWL++KLcWh0t755gwZlc8p0DqDAIfWVLdISpoY7RFhw= -github.com/OperatorFoundation/shapeshifter-transports/transports/obfs4/v2 v2.1.11/go.mod h1:OUFBnkMmjMHTWqEQlanDOMTgBjU5QARjklwQv9Qovr4= -github.com/OperatorFoundation/shapeshifter-transports/transports/shadow/v2 v2.1.11 h1:gKY17mRkP/VvBWvXzLuivJpFXt0AxkVUx7pv4PX2sUs= -github.com/OperatorFoundation/shapeshifter-transports/transports/shadow/v2 v2.1.11/go.mod h1:GN8ahnEHVGcPbR0raxdpWekjgElppspPNAAOpmNxQxU= -github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY= -github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA= -github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 h1:iPf1jQ8yKTms6k6L5vYSE7RZJpjEe5vLTOmzRZdpnKc= github.com/dchest/siphash v1.2.1 h1:4cLinnzVJDKxTCl9B01807Yiy+W7ZzVHj/KIroQRvT4= github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4= -github.com/shadowsocks/go-shadowsocks2 v0.0.11 h1:dXloqEhYnZV40jblWTK8kWeC0Eb+dgql4S0tj99e8j0= -github.com/shadowsocks/go-shadowsocks2 v0.0.11/go.mod h1:R+KWaoIwRRhnpw6XV+dZil0XHi64Hc1D7hXUyXTjUzQ= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/willscott/goturn v0.0.0-20170802220503-19f41278d0c9/go.mod h1:PfwRjodCaQXOsHnh2DeVaXqCFCIrbn5WLj1+A5bQkD4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= diff --git a/transports/obfs2/v2/obfs2.go b/transports/obfs2/v2/obfs2.go index 1052fe7..3f869fa 100644 --- a/transports/obfs2/v2/obfs2.go +++ b/transports/obfs2/v2/obfs2.go @@ -36,7 +36,7 @@ import ( "crypto/sha256" "encoding/binary" "fmt" - + "github.com/op/go-logging" "io" "net" "time" @@ -66,6 +66,7 @@ const ( type OptimizerTransport struct { Address string Dialer proxy.Dialer + Log *logging.Logger } //Dial connects to a specified address. @@ -91,25 +92,27 @@ func (transport OptimizerTransport) Dial() (net.Conn, error) { // Transport is the obfs2 implementation of the base.Transport interface. type Transport struct { dialer proxy.Dialer + log logging.Logger } //New initializes obfs2 for Optimizer -func New(address string, dialer proxy.Dialer) *OptimizerTransport { +func New(address string, dialer proxy.Dialer, log *logging.Logger) *OptimizerTransport { result := OptimizerTransport{ Address: address, Dialer: dialer, + Log: log, } return &result } //NewObfs2Transport is the initializer for obfs2 without a dialer func NewObfs2Transport() *Transport { - return &Transport{dialer: nil} + return &Transport{dialer: nil, log: logging.Logger{}} } //NewObfs2Transport is the initializer for obfs2 with a dialer func NewObfs2TransportWithDialer(dialer proxy.Dialer) *Transport { - return &Transport{dialer: dialer} + return &Transport{dialer: dialer, log: logging.Logger{}} } //obfs2TransportListener defines a TCP network listener. diff --git a/transports/obfs2/v2/obfs2_test.go b/transports/obfs2/v2/obfs2_test.go index c118e07..da1ef56 100644 --- a/transports/obfs2/v2/obfs2_test.go +++ b/transports/obfs2/v2/obfs2_test.go @@ -32,6 +32,7 @@ package obfs2 import ( + "github.com/op/go-logging" "golang.org/x/net/proxy" "os" "testing" @@ -97,7 +98,8 @@ func TestObfs2WithDialer(t *testing.T) { } func TestObfs2OptimizerTransportWithDialer(t *testing.T) { - config := New("127.0.0.1:1237", proxy.Direct) + var log = logging.MustGetLogger("obfs2") + config := New("127.0.0.1:1237", proxy.Direct, log) //create client buffer clientBuffer := make([]byte, 4) //call dial on client and check error