tapc-plugin-monitor

端口转发服务

Usage no npm install needed!

<script type="module">
  import tapcPluginMonitor from 'https://cdn.skypack.dev/tapc-plugin-monitor';
</script>

README

tapc-plugin-monitor

test lines coverage branches coverage functions coverage statements coverage

tap monitor 请求转发插件

Install

$ npm install -g tapc

Usage

$ tapc monitor # 启动转发服务

Config

  • tap.conf.js
module.exports = exports = {
  assets: {
    urls: [{
      rule: /([\S]+?)\/([\S]+?)\/[\d\.]*/, // url规则:group/仓库/版本号,例如g.tbcdn.cn/mui/test/1.2.3
      dest: '~/gitliab/$1/$2/'             // 本地目录规则:当前执行的路径,例如~/gitlab/mui/test/
    }],
    hosts: {
      'g.alicdn.com': '1.1.1.1'  // 私有cdn服务器地址
    }  
  },
  monitor: {      //主进程服务配置
    port: 80,     //监听80端口
    proxy_pass: [ //代理转发规则
      {
        server_name: 'localhost test.tmall.com', // 本地host绑定这些域名
        rewrite: [
          {
            rule: /^(.+)$/,
            target: 'http://127.0.0.1:3000/$1' // 转发到wormhole服务所在的3000端口
          }
        ]
      },
      {
        server_name: 'g.tbcdn.cn g.alicdn.com', // 本地host绑定这些域名
        rewrite: [
          {
            rule: /^(.+)$/,
            target: 'http://127.0.0.1:8000/$1' // 转发到assets所在的8000端口
          }
        ]
      }
    ]
  }
}


Test

$ npm run build # build the source code with babel
$ npm run dev # build automatically when files change
$ npm run test # run unit tests

License

The MIT License (MIT)

Copyright (c) 2015 tmallfe

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.