一个低性能端口转发实现
要求配置文件和程序放在一起,且名字必须是 config.json, 配置文件格式为
interface Config {
  proxy: {
    [localPort: string]: string;
  }
  APIPort: string;
}
其中 APIPort 为 api 监听的端口。
示例参见 示例配置
提供了一个简陋的web。
application/jsonGET /ping
request
无
response
interface Resp {
  message: 'pong'
}
POST /proxy
request
interface Req {
  local: string // 比如 "10086"
  targrt: string //比如 "127.0.0.1:10010"
}
response
interface Resp {
  message: 'done'
}
PATCH /proxy/:localPort
request
interface Req {
  targrt: string //比如 "127.0.0.1:10010"
}
response
interface Resp {
  message: 'done'
}
DELETE /proxy/:localPort
request
无
response
interface Resp {
  message: 'done'
}
GET /proxy
request
无
response
type Resp = {
    [k in keyof ProxyPool]: string
}
GET /proxy/:localPort
request
无
response
interface Resp {
  local: string
  target: string
}