|
54 | 54 | - [Cache Responses Plugin](#cacheresponsesplugin) |
55 | 55 | - [Man-In-The-Middle Plugin](#maninthemiddleplugin) |
56 | 56 | - [Proxy Pool Plugin](#proxypoolplugin) |
57 | | - - [FilterByClientIpPlugin](#filterbyclientipplugin) |
58 | | - - [ModifyChunkResponsePlugin](#modifychunkresponseplugin) |
59 | | - - [CloudflareDnsResolverPlugin](#cloudflarednsresolverplugin) |
60 | | - - [CustomDnsResolverPlugin](#customdnsresolverplugin) |
61 | | - - [CustomNetworkInterface](#customnetworkinterface) |
| 57 | + - [Filter By Client IP Plugin](#filterbyclientipplugin) |
| 58 | + - [Modify Chunk Response Plugin](#modifychunkresponseplugin) |
| 59 | + - [Cloudflare DNS Resolver Plugin](#cloudflarednsresolverplugin) |
| 60 | + - [Custom DNS Resolver Plugin](#customdnsresolverplugin) |
| 61 | + - [Custom Network Interface](#customnetworkinterface) |
| 62 | + - [Program Name Plugin](#programnameplugin) |
62 | 63 | - [HTTP Web Server Plugins](#http-web-server-plugins) |
63 | 64 | - [Reverse Proxy](#reverse-proxy) |
64 | 65 | - [Web Server Route](#web-server-route) |
@@ -578,7 +579,7 @@ Verify mock API response using `curl -x localhost:8899 http://api.example.com/v1 |
578 | 579 | Verify the same by inspecting `proxy.py` logs: |
579 | 580 |
|
580 | 581 | ```console |
581 | | -2019-09-27 12:44:02,212 - INFO - pid:7077 - access_log:1210 - ::1:64792 - GET None:None/v1/users/ - None None - 0 byte |
| 582 | +... [redacted] ... - access_log:1210 - ::1:64792 - GET None:None/v1/users/ - None None - 0 byte |
582 | 583 | ``` |
583 | 584 |
|
584 | 585 | Access log shows `None:None` as server `ip:port`. `None` simply means that |
@@ -618,8 +619,8 @@ Verify the same by inspecting the logs for `proxy.py`. |
618 | 619 | Along with the proxy request log, you must also see a http web server request log. |
619 | 620 |
|
620 | 621 | ``` |
621 | | -2019-09-24 19:09:33,602 - INFO - pid:49996 - access_log:1241 - ::1:49525 - GET / |
622 | | -2019-09-24 19:09:33,603 - INFO - pid:49995 - access_log:1157 - ::1:49524 - GET localhost:8899/ - 404 NOT FOUND - 70 bytes |
| 622 | +... [redacted] ... - access_log:1241 - ::1:49525 - GET / |
| 623 | +... [redacted] ... - access_log:1157 - ::1:49524 - GET localhost:8899/ - 404 NOT FOUND - 70 bytes |
623 | 624 | ``` |
624 | 625 |
|
625 | 626 | ### FilterByUpstreamHostPlugin |
@@ -650,10 +651,10 @@ Above `418 I'm a tea pot` is sent by our plugin. |
650 | 651 | Verify the same by inspecting logs for `proxy.py`: |
651 | 652 |
|
652 | 653 | ```console |
653 | | -2019-09-24 19:21:37,893 - ERROR - pid:50074 - handle_readables:1347 - HttpProtocolException type raised |
| 654 | +... [redacted] ... - handle_readables:1347 - HttpProtocolException type raised |
654 | 655 | Traceback (most recent call last): |
655 | 656 | ... [redacted] ... |
656 | | -2019-09-24 19:21:37,897 - INFO - pid:50074 - access_log:1157 - ::1:49911 - GET None:None/ - None None - 0 bytes |
| 657 | +... [redacted] ... - access_log:1157 - ::1:49911 - GET None:None/ - None None - 0 bytes |
657 | 658 | ``` |
658 | 659 |
|
659 | 660 | ### CacheResponsesPlugin |
@@ -887,6 +888,34 @@ for more details. |
887 | 888 | PS: There is no plugin named, but [CustomDnsResolverPlugin](#customdnsresolverplugin) |
888 | 889 | can be easily customized according to your needs. |
889 | 890 |
|
| 891 | +### ProgramNamePlugin |
| 892 | + |
| 893 | +Attempts to resolve program `(application)` name for proxy requests originating from the local machine. |
| 894 | +If identified, client IP in the access logs is replaced with program name. |
| 895 | + |
| 896 | +Start `proxy.py` as: |
| 897 | + |
| 898 | +```console |
| 899 | +❯ proxy \ |
| 900 | + --plugins proxy.plugin.ProgramNamePlugin |
| 901 | +``` |
| 902 | + |
| 903 | +Make a request using `curl`: |
| 904 | + |
| 905 | +```console |
| 906 | +❯ curl -v -x localhost:8899 https://httpbin.org/get |
| 907 | +``` |
| 908 | + |
| 909 | +You must see log lines like this: |
| 910 | + |
| 911 | +```console |
| 912 | +... [redacted] ... - [I] server.access_log:419 - curl:58096 - CONNECT httpbin.org:443 - 6010 bytes - 1824.62ms |
| 913 | +``` |
| 914 | + |
| 915 | +Notice `curl` in-place of `::1` or `127.0.0.1` as client IP. |
| 916 | + |
| 917 | +[](#programnameplugin) If `ProgramNamePlugin` does not work reliably on your operating system, kindly contribute by sending a pull request and/or open an issue. Thank you!!! |
| 918 | + |
890 | 919 | ## HTTP Web Server Plugins |
891 | 920 |
|
892 | 921 | ### Reverse Proxy |
|
0 commit comments