After reading the source code of gohop, i have 2 questions about the implementation that i don't understand, could u explain it?
-
What does the 'rate' mean in hopPacketBuffer:Pop(), to delay the pop operation? What does the algorithm means?
func (hb *hopPacketBuffer) Pop() *HopPacket {
<-hb.newPack
r := int(hb.rate & 0x10)
if hb.buf.count < 8+r {
time.Sleep(time.Duration(r*20+50) * time.Microsecond)
hb.rate = hb.rate >> 1
}
p := hb.buf.Pop().(*HopPacket)
return p
}
-
For the PKCS5UnPadding method, if there's no padding, this method will still get the last byte as padding length, is it wrong ?
func PKCS5UnPadding(origData []byte) []byte {
length := len(origData)
unpadding := int(origData[length-1])
return origData[:(length - unpadding)]
}
-
If one of the port between [HopStart, HopEnd] is blocked, the client knowns nothing about that, and still trying to forward packets to the port blocked (because of handshake succed on another port), without retrying and port switching ?
After reading the source code of gohop, i have 2 questions about the implementation that i don't understand, could u explain it?
What does the 'rate' mean in hopPacketBuffer:Pop(), to delay the pop operation? What does the algorithm means?
For the PKCS5UnPadding method, if there's no padding, this method will still get the last byte as padding length, is it wrong ?
If one of the port between [HopStart, HopEnd] is blocked, the client knowns nothing about that, and still trying to forward packets to the port blocked (because of handshake succed on another port), without retrying and port switching ?