1.3.8 • Published 6 months ago

@types/mitm v1.3.8

Weekly downloads
1,144
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/mitm

Summary

This package contains type definitions for mitm (https://github.com/moll/node-mitm).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mitm.

index.d.ts

// Type definitions for mitm v1.3.0
// Project: https://github.com/moll/node-mitm
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

///<reference types="node"/>

declare module 'mitm' {
    import * as http from 'http';
    import * as net from 'net';

    interface SocketOptions {
        port: number;
        host?: string | undefined;
        localAddress?: string | undefined;
        localPort?: string | undefined;
        family?: number | undefined;
        allowHalfOpen?: boolean | undefined;
    }

    interface BypassableSocket extends net.Socket {
        bypass(): void
    }

    type SocketConnectCallback = (socket: BypassableSocket, opts: SocketOptions) => void;

    type SocketConnectionCallback = (socket: net.Socket, opts: SocketOptions) => void;

    type HttpCallback = (request: http.IncomingMessage, response: http.ServerResponse) => void;

    type Event = 'connect' | 'connection' | 'request';

    type Callback = SocketConnectCallback | SocketConnectionCallback | HttpCallback;

    interface Mitm {
        disable(): void;
        on(event: Event, callback: Callback): void;
        on(event: 'connect', callback: SocketConnectCallback): void;
        on(event: 'connection', callback: SocketConnectionCallback): void;
        on(event: 'request', callback: HttpCallback): void;
    }

    function _(): Mitm;
    export = _;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 18:50:51 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Alejandro Sánchez.

1.3.8

6 months ago

1.3.7

6 months ago

1.3.6

7 months ago

1.3.5

8 months ago

1.3.4

3 years ago

1.3.3

4 years ago

1.3.2

7 years ago

1.3.1

8 years ago