Skip to content

Configurable delay options on the original socket #74

Description

@kamaz

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()
    })

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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