Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions about source code #16

Open
FTwOoO opened this issue Jul 19, 2016 · 0 comments
Open

Some questions about source code #16

FTwOoO opened this issue Jul 19, 2016 · 0 comments

Comments

@FTwOoO
Copy link

FTwOoO commented Jul 19, 2016

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant