{"id":18772743,"url":"https://github.com/sctg-development/proxyv2-test","last_synced_at":"2025-10-17T02:27:22.637Z","repository":{"id":229824986,"uuid":"777734676","full_name":"sctg-development/proxyv2-test","owner":"sctg-development","description":"Minimalist test for detecting original IP address while proxying a rust program via Haproxy protocol","archived":false,"fork":false,"pushed_at":"2024-03-26T12:15:15.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T08:22:09.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sctg-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T12:14:03.000Z","updated_at":"2024-03-26T12:14:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b10f275-3fba-4088-b875-868596da310a","html_url":"https://github.com/sctg-development/proxyv2-test","commit_stats":null,"previous_names":["sctg-development/proxyv2-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fproxyv2-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fproxyv2-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fproxyv2-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fproxyv2-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sctg-development","download_url":"https://codeload.github.com/sctg-development/proxyv2-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239681025,"owners_count":19679508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T19:30:04.116Z","updated_at":"2025-10-17T02:27:17.605Z","avatar_url":"https://github.com/sctg-development.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Proxy IP Detection\n\nThis Rust application is designed to handle connections that may be proxied and correctly identify the original source IP address, even when the connection is proxied.\n\n## How it works\n\nThe application listens for incoming connections and reads the data sent over each connection. It uses the `proxy_protocol` library to parse the data and extract the Proxy Protocol header, if one is present.\n\nThe Proxy Protocol header can be either version 1 or version 2. This application specifically handles version 2 headers, which include the command, transport protocol, and addresses (source and destination).\n\nThe addresses can be IPv4 or IPv6. The application extracts the source address, which represents the original IP address of the client before it was proxied.\n\nAfter extracting the original source IP address, the application echoes back all the data it received. It then clears the buffer to ensure that data from previous connections does not interfere with the next connection.\n\n## Why it's useful\n\nThis application is useful in scenarios where you want to know the original IP address of a client, but the connection may be proxied. By correctly parsing the Proxy Protocol header, the application can extract the original source IP address, even when the connection is proxied.\n\nThis can be useful for logging, analytics, or any other situation where you need to know the original source IP address of a connection.\n\n## Using with HAProxy\n\nThis application includes a HAProxy configuration file that is set up to use the Proxy Protocol. You can use this configuration file to test the application with HAProxy.\n\nTo use the provided HAProxy configuration file, run the following command:\n\n```bash\nhaproxy -f ./haproxy.cfg\ncargo run -- --proxyV2\nnc my_ip_address 21123\nTeST Stuff\nCtrl^c\n```\n\nWithout the `--proxyV2` flag, the application will not be able to parse the Proxy Protocol header and will not extract the original source IP address.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsctg-development%2Fproxyv2-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsctg-development%2Fproxyv2-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsctg-development%2Fproxyv2-test/lists"}