[tor-commits] [obfs4/master] Add support for enabling IAT obfuscation and biased WDist.

yawning at torproject.org yawning at torproject.org
Mon Aug 18 11:56:21 UTC 2014


commit 22c9dc3f489dd0984e431ede95f963bc1f57222c
Author: Yawning Angel <yawning at torproject.org>
Date:   Mon Aug 18 11:53:22 2014 +0000

    Add support for enabling IAT obfuscation and biased WDist.
    
    Golang's command line parser is slightly cumbersome to use with
    subcommands, so the arguments are "obfs4-iatObufscation" and
    "obfs-distBias" instead of obfsproxy style subcommands.
---
 transports/obfs4/obfs4.go |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/transports/obfs4/obfs4.go b/transports/obfs4/obfs4.go
index 7af7224..fbfea27 100644
--- a/transports/obfs4/obfs4.go
+++ b/transports/obfs4/obfs4.go
@@ -32,6 +32,7 @@ package obfs4
 import (
 	"bytes"
 	"crypto/sha256"
+	"flag"
 	"fmt"
 	"math/rand"
 	"net"
@@ -55,25 +56,27 @@ const (
 	privateKeyArg = "private-key"
 	seedArg       = "drbg-seed"
 
+	iatCmdArg  = "obfs4-iatObfuscation"
+	biasCmdArg = "obfs4-distBias"
+
 	seedLength             = 32
 	headerLength           = framing.FrameOverhead + packetOverhead
 	clientHandshakeTimeout = time.Duration(60) * time.Second
 	serverHandshakeTimeout = time.Duration(30) * time.Second
 	replayTTL              = time.Duration(3) * time.Hour
 
-	// Use a ScrambleSuit style biased probability table.
-	biasedDist = false
-
-	// Use IAT obfuscation.
-	iatObfuscation = false
-
-	// Maximum IAT delay (100 usec increments).
-	maxIATDelay = 100
-
+	maxIATDelay        = 100
 	maxCloseDelayBytes = maxHandshakeLength
 	maxCloseDelay      = 60
 )
 
+// iatObfuscation controls if Inter-Arrival Time obfuscation will be enabled.
+var iatObfuscation bool
+
+// biasedDist controls if the probability table will be ScrambleSuit style or
+// uniformly distributed.
+var biasedDist bool
+
 type obfs4ClientArgs struct {
 	nodeID     *ntor.NodeID
 	publicKey  *ntor.PublicKey
@@ -573,6 +576,11 @@ func (conn *obfs4Conn) padBurst(burst *bytes.Buffer) (err error) {
 	return
 }
 
+func init() {
+	flag.BoolVar(&iatObfuscation, iatCmdArg, false, "Enable obfs4 IAT obfuscation (expensive)")
+	flag.BoolVar(&biasedDist, biasCmdArg, false, "Enable obfs4 using ScrambleSuit style table generation")
+}
+
 var _ base.ClientFactory = (*obfs4ClientFactory)(nil)
 var _ base.ServerFactory = (*obfs4ServerFactory)(nil)
 var _ base.Transport = (*Transport)(nil)





More information about the tor-commits mailing list