Nacho Printing Machine

    @types/mitm
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.4 • Public • Published

    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.

    Keywords

    none

    Install

    npm i @types/mitm

    DownloadsWeekly Downloads

    8,362

    Version

    1.3.4

    License

    MIT

    Unpacked Size

    5.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • types