Giter Site home page Giter Site logo

mkloubert / vscode-proxy Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 12.36 MB

Runs TCP proxies with additional trace support in Visual Studio Code.

Home Page: https://marketplace.visualstudio.com/items?itemName=mkloubert.vscode-proxy

License: MIT License

TypeScript 100.00%

vscode-proxy's Introduction

vscode-proxy

Latest Release Installs Rating

Runs TCP proxies with additional trace support in Visual Studio Code.


The extension is now marked as DEPRECATED ... it is RECOMMENDED to use vscode-powertools by e.GO Digital.

If you have suggestions and other kind of issues for that new extension, feel free to open an issue here.


Donate

Table of contents

  1. Install
  2. Demos
  3. How to use
  4. Documentation

Install []

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:

ext install vscode-proxy

Or search for things like vscode-proxy in your editor.

Demos

Tracing

Demo Tracing

How to use []

Settings []

Open (or create) your settings.json in your .vscode subfolder of your workspace.

Add a tcp.proxy section and one or more proxies:

{
    "tcp.proxy": {
        "80": {
            "autoStart": true,
            "name": "My HTTP proxy",
            "to": 8080,
            "outputFormat": "http"
        }
    }
}
Name Description
hexWidth The width for binary data in hex view. Default: 16
openAfterTrace Default value that indicates if traces should be opened in new tab after trace has been finished or not. Default: (true)
outputFormat Default output format for traces. Possible values are ascii, http, json and text. Default: text
proxies One or more proxies to register.
writeToOutput Default value for writing trace entries to output or not. Default: (false)

Proxies []

The following example registers a proxy at port 80 and sends all data to 8080.

{
    "tcp.proxy": {
        "80": {
            "autoStart": true,
            "name": "My HTTP proxy",
            "description": "A proxy for my HTTP server",
            "to": 8080,
            "outputFormat": "http"
        }
    }
}
Name Description
autoStart Start proxy on startup or not. Default: (false)
chunkHandler The path to the script that handles a chunk.
chunkHandlerOptions Additional options for the chunk handler.
chunkHandlerState Initial state value for the chunk handler.
description An additional description for the proxy.
name The name of the proxy.
openAfterTrace Open traces in new tab after trace has been finished or not. Default: (true)
outputFormat Output format for traces. Possible values are ascii, http, json and text. Default: text
receiveChunksFrom The custom list of targets (s. to) from where to send answers back to the source / client or (true) or (false) to enable/disable that feature. Default: First target.
traceHandler The path to the script that handles a (new) trace entry.
traceHandlerOptions Additional options for the trace handler.
traceHandlerState Initial state value for the trace handler.
traceWriter The path to the script that writes a trace list, when tracing is stopped.
traceWriterOptions Additional options for the trace writer.
traceWriterState Initial state value for the trace writer.
to The destination port(s) or address(es).
writeToOutput Write trace entries to output or not. Default: (false)
Chunk handlers []
exports.handleChunk = function(args) {
    // this function is executed synchronous

    // you can update `args.chunk` property with new
    // data, which should be send to the target
    // 
    // (undefined) or (null) will NOT send data to the target

    // you can also access any NodeJS API
    // provided by Visual Studio Code
    // and the modules shipped with that extension
    // (s. https://github.com/mkloubert/vscode-proxy/blob/master/package.json)
};

args uses the ChunkHandlerModuleExecutorArguments interface.

Trace handlers []
exports.handleTrace = function(args) {
    // this function is executed synchronous

    // you can also access any NodeJS API
    // provided by Visual Studio Code
    // and the modules shipped with that extension
    // (s. https://github.com/mkloubert/vscode-proxy/blob/master/package.json)
};

args uses the TraceHandlerModuleExecutorArguments interface.

Trace writers []
exports.writeTrace = function(args) {
    // this function can be executed asynchronous
    // via a promise

    // the final trace list is stored
    // in 'args.trace' array
    for (let i = 0; i < args.trace.length; i++) {
        // s. https://mkloubert.github.io/vscode-proxy/interfaces/_contracts_.traceentry.html
        let currentTraceEntry = args.trace[i];

        //TODO
    }

    // you can also access any NodeJS API
    // provided by Visual Studio Code
    // and the modules shipped with that extension
    // (s. https://github.com/mkloubert/vscode-proxy/blob/master/package.json)
};

args uses the TraceWriterModuleExecutorArguments interface.

Commands []

Press F1 to open the list of commands and enter one of the following commands:

Name Description ID
Proxy: Start / stop Starts or stops one or more proxies. extension.proxy.startStop
Proxy: Trace Starts or stops tracing one or more proxies. extension.proxy.trace

Documentation []

The full API documentation can be found here.

vscode-proxy's People

Contributors

mkloubert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-proxy's Issues

proxy to other hostaddr:port resolves into undefined:undefined

I might be a misconfiguration by me, but proxying to hostaddr:port doesn't seem to work. Data is intercepted, but not forwarded to the other host (localhost:50321 => undefined:undefined).

I tried different formats of hostaddr:port, but none seem to work. The traffic consists of HTTP-calls

My config (I tried two separate configs, none work):

"tcp.proxy": {
"proxies": {
"7999": {
"autoStart": true,
"name": "Test",
"outputFormat": "http",
"writeToOutput": true,
"receiveChunksFrom": [
"xxx.xxx.xxx.xxx"
],
"to": 8000,
},
"8000": {
"autoStart": true,
"name": "Production",
"to": "yyy.yyy.yyy.yyy:8000",
"outputFormat": "http"
}

    },
},

Kind regards,
Ruben

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.