From a5a9476d9248885c45b3827362f345f944449770 Mon Sep 17 00:00:00 2001 From: mohammad hosseinzadeh <84992361+mohammadhz98@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:44:57 +0330 Subject: [PATCH 1/2] Update ip-address.md `TrustIPRanges` was wrong. correct it to `TrustIPRange`. and add example for TrustOptions --- website/docs/guide/ip-address.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/docs/guide/ip-address.md b/website/docs/guide/ip-address.md index 9094a044..41209c18 100644 --- a/website/docs/guide/ip-address.md +++ b/website/docs/guide/ip-address.md @@ -77,8 +77,10 @@ E.g.: ```go e.IPExtractor = echo.ExtractIPFromXFFHeader( - TrustLinkLocal(false), - TrustIPRanges(lbIPRange), + echo.TrustLoopback(false), // e.g. ipv4 start with 127. + echo.TrustLinkLocal(false), // e.g. ipv4 start with 169.254 + echo.TrustPrivateNet(false), // e.g. ipv4 start with 10. or 192.168 + echo.TrustIPRange(echo.lbIPRange), ) ``` @@ -106,4 +108,4 @@ Again, it trusts internal IP addresses by default (loopback, link-local unicast, In default behavior, Echo sees all of first XFF header, X-Real-IP header and IP from network layer. As you might already notice, after reading this article, this is not good. -Sole reason this is default is just backward compatibility. \ No newline at end of file +Sole reason this is default is just backward compatibility. From e6599b3b61a0fe52cfd6c85aba36d6531641b31f Mon Sep 17 00:00:00 2001 From: mohammad hosseinzadeh <84992361+mohammadhz98@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:32:15 +0330 Subject: [PATCH 2/2] Update ip-address.md `TrustIPRanges` was wrong. correct it to `TrustIPRange`. and add example for TrustOptions --- website/docs/guide/ip-address.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/guide/ip-address.md b/website/docs/guide/ip-address.md index 41209c18..ac0c7639 100644 --- a/website/docs/guide/ip-address.md +++ b/website/docs/guide/ip-address.md @@ -80,7 +80,7 @@ e.IPExtractor = echo.ExtractIPFromXFFHeader( echo.TrustLoopback(false), // e.g. ipv4 start with 127. echo.TrustLinkLocal(false), // e.g. ipv4 start with 169.254 echo.TrustPrivateNet(false), // e.g. ipv4 start with 10. or 192.168 - echo.TrustIPRange(echo.lbIPRange), + echo.TrustIPRange(lbIPRange), ) ```