From 422a87903c71c1a59b502b431a40ca583327b70b Mon Sep 17 00:00:00 2001 From: piaodazhu <2283079466@qq.com> Date: Sun, 13 Aug 2023 20:42:30 +0800 Subject: [PATCH] add TODO --- README.md | 2 +- README_ZH.md | 2 +- TODO | 4 ++++ client.go | 1 + protocol.go | 8 ++++++++ server.go | 4 ++++ 6 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 TODO diff --git a/README.md b/README.md index 02af9d2..0bd1d42 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ So why not write a package to make this more elegant? proxylite was born. Its ma 1. Easy to integrate into code. Both server and client structures are provided. Just import this package then register tunnels whenever you want. 2. Dynamic on-demand reverse proxy. **One registration, one port, one user, one tcp connection.** 3. Service registration and discovery. -4. Customized hooks are support. +4. Customized hooks are support. (Under development) ## Concepts ``` diff --git a/README_ZH.md b/README_ZH.md index 84810eb..05f99a6 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -18,7 +18,7 @@ 1. 易于集成到代码中。提供了服务器和客户端结构。只需导入此包,然后在需要时注册隧道。 2. 动态按需反向代理。**一次注册,一个端口,一个用户,一个 TCP 连接。** 3. 服务注册和发现。 -4. 支持自定义钩子。 +4. 支持自定义钩子。(开发中) ## 概念 ``` diff --git a/TODO b/TODO new file mode 100644 index 0000000..9ee68ae --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +- [ ] Hook API +- [ ] Unit Tests +- [ ] Code Report +- [ ] Benchmark \ No newline at end of file diff --git a/client.go b/client.go index 0c325ed..51a3b06 100644 --- a/client.go +++ b/client.go @@ -23,6 +23,7 @@ type RegisterEntry struct { Done <-chan struct{} } +// ProxyLiteClient inner client that forwards traffic between inner service and proxy server server. type ProxyLiteClient struct { ready bool serverAddr string diff --git a/protocol.go b/protocol.go index 9315c99..41379ee 100644 --- a/protocol.go +++ b/protocol.go @@ -17,12 +17,15 @@ const ( TypeRegisterServiceRsp ) +// AskFreePortReq Ask avaliable free ports request type AskFreePortReq struct{} +// AskFreePortRsp Ask avaliable free ports response type AskFreePortRsp struct { Ports []int } +// RegisterInfo Register information type RegisterInfo struct { OuterPort int InnerAddr string @@ -30,6 +33,7 @@ type RegisterInfo struct { Message string } +// RegisterServiceReq inner service registration request type RegisterServiceReq struct { Info RegisterInfo } @@ -41,14 +45,17 @@ const ( RegisterRspServerError ) +// RegisterServiceRsp inner service registration response type RegisterServiceRsp struct { Code int } +// AskServiceReq Service discovery request type AskServiceReq struct { Prefix string } +// ServiceInfo Service basic information type ServiceInfo struct { Port int Name string @@ -57,6 +64,7 @@ type ServiceInfo struct { Birth time.Time } +// AskServiceRsp Service discovery response type AskServiceRsp struct { Services []ServiceInfo } diff --git a/server.go b/server.go index f9801f9..b52855e 100644 --- a/server.go +++ b/server.go @@ -1,3 +1,6 @@ +/* +Package proxylite is a dynamic reverse proxy package for Go. +*/ package proxylite import ( @@ -20,6 +23,7 @@ type tunnel struct { info *RegisterInfo } +// ProxyLiteServer Public server that forwards traffic between user and inner client. type ProxyLiteServer struct { all map[int]struct{} lock sync.RWMutex