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

Configurable delay options on the original socket #74

Open
kamaz opened this issue Sep 8, 2021 · 1 comment
Open

Configurable delay options on the original socket #74

kamaz opened this issue Sep 8, 2021 · 1 comment

Comments

@kamaz
Copy link

kamaz commented Sep 8, 2021

I was wondering how open are you for a PR that would open ability to configure a delay on the socket.

I was thinking something between these line:

Mitm.prototype.connect = function connect(orig, Socket, opts, done) {
    ...
    const origSocket = orig.call(this, opts, done)
    if (client.delay) {
      origSocket.pause()
      setTimeout(() => {
        origSocket.resume()
      }, client.delay)
    } 
    ...
}

Potential usage:

    mitm.on('connect', function (socket: any, _opts: any) {
      console.log('bypassing connection')
      socket.delay = 1000
      socket.bypass()
    })
@moll
Copy link
Owner

moll commented Aug 26, 2024

Hey, @kamaz! Thanks for the idea.

Not against supporting delays, but I'm not yet sure what exactly should be delayed. Perhaps the initial connection (client socket's connect)...

What are you trying to test there? Some timeouts on initial connection? Including DNS resolving delays?

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

2 participants