项目作者: muzea

项目描述 :
A low performance port forwarding implementation
高级语言: Go
项目地址: git://github.com/muzea/portfwd.git
创建时间: 2019-05-26T13:01:31Z
项目社区:https://github.com/muzea/portfwd

开源协议:

下载


一个低性能端口转发实现

使用

要求配置文件和程序放在一起,且名字必须是 config.json, 配置文件格式为

  1. interface Config {
  2. proxy: {
  3. [localPort: string]: string;
  4. }
  5. APIPort: string;
  6. }

其中 APIPort 为 api 监听的端口。

示例参见 示例配置

web 控制台

提供了一个简陋的web

api

  • 均要求数据为 application/json
  • 类型描述为typescript

ping

GET /ping

request

response

  1. interface Resp {
  2. message: 'pong'
  3. }

add

POST /proxy

request

  1. interface Req {
  2. local: string // 比如 "10086"
  3. targrt: string //比如 "127.0.0.1:10010"
  4. }

response

  1. interface Resp {
  2. message: 'done'
  3. }

update

PATCH /proxy/:localPort

request

  1. interface Req {
  2. targrt: string //比如 "127.0.0.1:10010"
  3. }

response

  1. interface Resp {
  2. message: 'done'
  3. }

delete

DELETE /proxy/:localPort

request

response

  1. interface Resp {
  2. message: 'done'
  3. }

proxy config

GET /proxy

request

response

  1. type Resp = {
  2. [k in keyof ProxyPool]: string
  3. }

proxy item

GET /proxy/:localPort

request

response

  1. interface Resp {
  2. local: string
  3. target: string
  4. }