From e2fbce0420a18addf2ddccd99e8e5f3a3af91614 Mon Sep 17 00:00:00 2001 From: hades300 <1018987488@qq.com> Date: Fri, 3 Dec 2021 16:07:04 +0800 Subject: [PATCH 1/3] ghttp_request.go GetRemoteIp ipv6 fix --- net/ghttp/ghttp_request.go | 2 +- net/ghttp/ghttp_z_unit_feature_ip_test.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/net/ghttp/ghttp_request.go b/net/ghttp/ghttp_request.go index cb4a9d085..be1399734 100644 --- a/net/ghttp/ghttp_request.go +++ b/net/ghttp/ghttp_request.go @@ -216,7 +216,7 @@ func (r *Request) GetClientIp() string { func (r *Request) GetRemoteIp() string { array, _ := gregex.MatchString(`(.+):(\d+)`, r.RemoteAddr) if len(array) > 1 { - return array[1] + return strings.Trim(array[1], "[]") } return r.RemoteAddr } diff --git a/net/ghttp/ghttp_z_unit_feature_ip_test.go b/net/ghttp/ghttp_z_unit_feature_ip_test.go index 4873a32ad..12ec11375 100644 --- a/net/ghttp/ghttp_z_unit_feature_ip_test.go +++ b/net/ghttp/ghttp_z_unit_feature_ip_test.go @@ -32,10 +32,14 @@ func TestRequest_GetRemoteIp(t *testing.T) { time.Sleep(100 * time.Millisecond) - client := g.Client() - client.SetPrefix(fmt.Sprintf("http://127.0.0.1:%d", p)) + clientV4 := g.Client() + clientV4.SetPrefix(fmt.Sprintf("http://127.0.0.1:%d", p)) - t.Assert(client.GetContent(ctx, "/"), "127.0.0.1") + clientV6 := g.Client() + clientV6.SetPrefix(fmt.Sprintf("http://[::1]:%d", p)) + + t.Assert(clientV4.GetContent(ctx, "/"), "127.0.0.1") + t.Assert(clientV6.GetContent(ctx, "/"), "::1") }) } From f56c2ed356b77f7be4635da925c1003cee6fd92f Mon Sep 17 00:00:00 2001 From: xuweiwei Date: Fri, 3 Dec 2021 17:19:42 +0800 Subject: [PATCH 2/3] fix a comment error in IsSubDomain Signed-off-by: xuweiwei --- text/gstr/gstr_domain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/gstr/gstr_domain.go b/text/gstr/gstr_domain.go index ae4155277..45f31bb72 100644 --- a/text/gstr/gstr_domain.go +++ b/text/gstr/gstr_domain.go @@ -24,7 +24,7 @@ func IsSubDomain(subDomain string, mainDomain string) bool { // Eg: // "s.s.goframe.org" is not sub-domain of "*.goframe.org" // but - // "s.s.goframe.org" is not sub-domain of "goframe.org" + // "s.s.goframe.org" is sub-domain of "goframe.org" if mainLength > 2 && subLength > mainLength { return false } From 65fde530839a50461873a1c51fd22cfd4c1e7335 Mon Sep 17 00:00:00 2001 From: houseme Date: Sat, 4 Dec 2021 18:25:24 +0800 Subject: [PATCH 3/3] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 7eee0b379..38c7aeb28 100644 --- a/README.MD +++ b/README.MD @@ -64,7 +64,7 @@ The `Web` component performance of `GoFrame`, please refer to third-party projec - [ZTE](https://www.zte.com.cn/china/) - [Ant Financial Services](https://www.antfin.com/) - [VIVO](https://www.vivo.com/) -- [MedLinker](https://www.vivo.com/) +- [MedLinker](https://www.medlinker.com/) - [KuCoin](https://www.kucoin.io/) - [LeYouJia](https://www.leyoujia.com/) - [IGG](https://igg.com)