Skip to content

Some questions about source code #16

Description

@FTwOoO

After reading the source code of gohop, i have 2 questions about the implementation that i don't understand, could u explain it?

  1. 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
    }
    
  2. 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)]
    }
    
  3. 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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions