-
-
Notifications
You must be signed in to change notification settings - Fork 31
Add IP lookup feature #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| map $arg_ip $lookup_ip { | ||
| "" $remote_addr; | ||
| default $arg_ip; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ http { | |
| tcp_nopush on; | ||
| tcp_nodelay on; | ||
| types_hash_max_size 2048; | ||
| map_hash_bucket_size 128; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I referred to the explanation in the issue #20 , but I'm not sure if it's really necessary.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai can you help @che0124? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 4382 @PeterDaveHello @che0124 Based on my analysis, increasing The This directive typically only needs to be increased when:
Since the current map is very simple with only two short entries, the default value should be more than adequate. I recommend removing this line unless you've encountered specific issues during testing that required this increase.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /ask explain the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The This setting is important when:
By increasing the bucket size to 128 (from the default which is typically 32 or 64), the PR is ensuring that the hash tables used for mapping operations have enough memory allocated to handle a larger number of entries efficiently. This change is likely related to the "Add IP lookup feature" mentioned in the PR title, as IP lookups often require mapping IP addresses to specific values or behaviors, which would use Nginx's
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| include /etc/nginx/conf.d/*.conf; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider clarifying the example output by explaining that the output lines represent the queried IP address, the country (with region if applicable), and the ASN details, which could help users better understand the endpoint response.