portfwd

一个低性能端口转发实现

使用

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

interface Config {
  proxy: {
    [localPort: string]: string;
  }
  APIPort: string;
}

其中 APIPort 为 api 监听的端口。

示例参见 示例配置

web 控制台

提供了一个简陋的web

api

ping

GET /ping

request

response

interface Resp {
  message: 'pong'
}

add

POST /proxy

request

interface Req {
  local: string // 比如 "10086"
  targrt: string //比如 "127.0.0.1:10010"
}

response

interface Resp {
  message: 'done'
}

update

PATCH /proxy/:localPort

request

interface Req {
  targrt: string //比如 "127.0.0.1:10010"
}

response

interface Resp {
  message: 'done'
}

delete

DELETE /proxy/:localPort

request

response

interface Resp {
  message: 'done'
}

proxy config

GET /proxy

request

response

type Resp = {
    [k in keyof ProxyPool]: string
}

proxy item

GET /proxy/:localPort

request

response

interface Resp {
  local: string
  target: string
}