summaryrefslogtreecommitdiff
path: root/obfs4.go
diff options
context:
space:
mode:
Diffstat (limited to 'obfs4.go')
-rw-r--r--obfs4.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/obfs4.go b/obfs4.go
index f13e14a..52e1b02 100644
--- a/obfs4.go
+++ b/obfs4.go
@@ -263,29 +263,39 @@ func (c *Obfs4Conn) serverHandshake(nodeID *ntor.NodeID, keypair *ntor.Keypair)
break
}
+ //
+ // Since the current and only implementation always sends a PRNG seed for
+ // the length obfuscation, this makes the amount of data received from the
+ // server inconsistent with the length sent from the client.
+ //
+ // Rebalance this by tweaking the client mimimum padding/server maximum
+ // padding, and sending the PRNG seed unpadded (As in, treat the PRNG seed
+ // as part of the server response). See inlineSeedFrameLength in
+ // handshake_ntor.go.
+ //
+
// Generate/send the response.
var blob []byte
blob, err = hs.generateHandshake()
if err != nil {
return
}
- _, err = c.conn.Write(blob)
+ var frameBuf bytes.Buffer
+ _, err = frameBuf.Write(blob)
if err != nil {
return
}
c.state = stateEstablished
// Send the PRNG seed as the first packet.
- var frameBuf bytes.Buffer
err = c.producePacket(&frameBuf, packetTypePrngSeed, c.listener.seed.Bytes()[:], 0)
if err != nil {
return
}
- err = c.padBurst(&frameBuf)
+ _, err = c.conn.Write(frameBuf.Bytes())
if err != nil {
return
}
- _, err = c.conn.Write(frameBuf.Bytes())
return
}