{"id":16991042,"url":"https://github.com/gin66/socksv5_future","last_synced_at":"2025-04-12T04:06:48.557Z","repository":{"id":57667843,"uuid":"121849301","full_name":"gin66/socksv5_future","owner":"gin66","description":"Socks v5 futures for Server and Client","archived":false,"fork":false,"pushed_at":"2018-03-04T13:31:36.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:37:15.052Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gin66.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-17T11:21:22.000Z","updated_at":"2024-09-05T12:53:04.000Z","dependencies_parsed_at":"2022-09-10T14:40:34.851Z","dependency_job_id":null,"html_url":"https://github.com/gin66/socksv5_future","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Fsocksv5_future","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Fsocksv5_future/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Fsocksv5_future/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Fsocksv5_future/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gin66","download_url":"https://codeload.github.com/gin66/socksv5_future/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247918918,"owners_count":21018044,"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-10-14T03:24:39.418Z","updated_at":"2025-04-12T04:06:48.529Z","avatar_url":"https://github.com/gin66.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socksv5_future\n\nThe socks5 protocol consists of a handshake in these steps:\n\n1. Client establish TCP connection to a socks5 server\n2. Client sends authentication request with list of supported authentication methods.\n3. Server selects an appropriate authentication method and sends this back to client.\n4. Client sends socks5 request, which primarily contains destination address and port\n5. Server establishes connection to destination and answers client's request\n\nThis is the implementation of two Futures:\n\n- SocksHandshake\n- SocksConnectHandshake\n\nAs per RFC 1928, this is not a compliant socks5 implementation, because\nGSSAPI authentication method is not supported.\n\n## SocksHandshake\n\nThis is the server side implementation. It implements the step 2 to 4. Step 5 is not performed by this future. Instead the socks5 request is part of the future result.\n\n## SocksConnectHandshake\n\nThis is the client side implementation. It performs step 2-5.\n\n## Use case socks5 forwarder\n\nThe socks5 request from the client is used unchanged and sent to the forwarded socks proxy.\nHere short code segment to show the principal idea (this code will not compile):\n\n```rust\n    let mut lp = Core::new().unwrap();\n    let handle = lp.handle();\n    let addr = \"127.0.0.1:8888\".parse::\u003cSocketAddr\u003e().unwrap();\n    let listener = TcpListener::bind(\u0026addr, \u0026handle2).unwrap();\n    let server = listener.incoming().for_each(move |(socket, _addr)| {\n        handle.spawn(\n            socks_handshake(socket)\n                .and_then(move |(source,request)| {\n                    let proxy = \"xx.xx.xx.xx:8888\".parse::\u003cSocketAddr\u003e().unwrap();\n                    let connect = TcpStream::connect(\u0026proxy,\u0026handle);\n                    connect.and_then(move |dest|{\n                        socks_connect_handshake(dest,request)\n                    })\n                    .and_then(|(stream,req_answer)|{\n                        write_all(source,req_answer)\n                    })\n                    .and_then(|(stream,buf)|{\n                        // perform transfer source\u003c-\u003estream\n                    });\n                })\n        );\n        Ok(())\n    });\n    handle.spawn(server)\n```\n\n[![Build Status](https://travis-ci.org/gin66/socksv5_future.svg?branch=master)](https://travis-ci.org/gin66/socksv5_future)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Fsocksv5_future","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgin66%2Fsocksv5_future","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Fsocksv5_future/lists"}