{"id":13611970,"url":"https://github.com/liudf0716/xfrpc","last_synced_at":"2025-05-15T05:06:21.522Z","repository":{"id":40689440,"uuid":"432891057","full_name":"liudf0716/xfrpc","owner":"liudf0716","description":"The xfrpc project is a lightweight implementation of the FRP client written in C language for OpenWRT and IoT systems. It is designed to provide an efficient solution for resource-constrained devices such as OpenWRT routers and IoT devices, which often have limited ROM and RAM space.","archived":false,"fork":false,"pushed_at":"2025-04-30T09:35:32.000Z","size":7872,"stargazers_count":750,"open_issues_count":28,"forks_count":98,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-30T11:18:39.728Z","etag":null,"topics":["colab","frp","github-actions","instaloader","lan-proxy","openwrt","reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liudf0716.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-11-29T03:18:38.000Z","updated_at":"2025-04-30T09:35:36.000Z","dependencies_parsed_at":"2023-10-28T04:24:09.543Z","dependency_job_id":"aa172a0a-7ff8-40fd-97bd-0cca9e5268fb","html_url":"https://github.com/liudf0716/xfrpc","commit_stats":{"total_commits":818,"total_committers":10,"mean_commits":81.8,"dds":0.3264058679706602,"last_synced_commit":"448df0b349258e116eb242c191b8db33643bd376"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxfrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxfrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxfrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxfrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liudf0716","download_url":"https://codeload.github.com/liudf0716/xfrpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"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":["colab","frp","github-actions","instaloader","lan-proxy","openwrt","reverse-proxy"],"created_at":"2024-08-01T20:00:20.149Z","updated_at":"2025-05-15T05:06:16.512Z","avatar_url":"https://github.com/liudf0716.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\n![xfrpc](https://user-images.githubusercontent.com/1182593/213063003-73501d3b-1a22-4f4a-8f3f-4ca3268b5bee.png)\n\n\n## What is xfrpc \n\nThe xfrpc project is an implementation of frp client written in C language for OpenWRT and IOT system. The main motivation of this project is to provide a lightweight solution for devices with limited resources such as OpenWRT devices which often have limited ROM and RAM space. The project aims to provide a frp client that uses less space and memory than other available options.\n\n## Development Status\n\nxfrpc partially compitable with latest frp release feature, It targets to fully compatible with latest frp release.\n\nthe following table is detail  compatible feature:\n\n| Feature  | xfrpc | frpc |\n| ------------- | ------------- | ---------|\n| tcp  | Yes |\t Yes  |\n| tcpmux  | Yes |\t Yes  |\n| http  | Yes |\t Yes  |\n| https  | Yes |  Yes  |\n| custom_domains | Yes | Yes |\n| subdomain | Yes | Yes |\n| socks5 | Yes | No |\n| use_encryption | No | Yes |\n| use_compression | No | Yes |\n| udp  | No |  Yes  |\n| p2p  | No |  Yes  |\n| xtcp  | No |  Yes  |\n| stcp  | No |  Yes  |\n\n\n\n## Architecture\n\n\n![Architecture](https://user-images.githubusercontent.com/1182593/196329678-1781b4e9-2355-4863-be3f-e128b31cc82c.png)\n\n\n\n## Sequence Diagram\n\n```mermaid\nsequenceDiagram\n\ttitle:\txfrpc与frps通信交互时序图\n\tparticipant 本地服务\n\tparticipant xfrpc\n  participant frps\n  participant 远程访问用户\n  \n  xfrpc -\u003e\u003e frps  : TypeLogin Message\n  frps -\u003e\u003e xfrpc  : TypeLoginResp Message\n  Note right of frps  : 根据Login信息里面的pool值，决定给xfrpc发送几条TypeReqWorkConn请求信息\n  frps -\u003e\u003e xfrpc  : frps aes-128-cfb iv[16] data\n  frps --\u003e\u003e xfrpc : TypeReqWorkConn Message\n\tloop 根据Login中的PoolCount创建工作连接数\n  \txfrpc --\u003e\u003e frps  : TypeNewWorkConn Message\n  \tNote left of xfrpc  : 与服务器创建代理服务工作连接，并请求新的工作连接请求\n  \tNote right of frps  : 处理xfrpc端发送的TypeNewWorkConn消息，注册该工作连接到连接池中\n  \tfrps -\u003e\u003e xfrpc  : TypeStartWorkConn Message\n  \tNote left of xfrpc  : 将新创建的工作连接与代理的本地服务连接做绑定\n\tend\n  xfrpc -\u003e\u003e frps  : xfrpc aes-128-cfb iv[16] data\n  loop 用户配置的代理服务数\n  \txfrpc --\u003e\u003e frps : TypeNewProxy Message\n  \tfrps --\u003e\u003e xfrpc : NewProxyResp Message\n  end\n\t\n  loop 心跳包检查\n    xfrpc --\u003e\u003e frps : TypePing Message\n    frps --\u003e\u003e xfrpc : TypePong Message\n  end\n  \n  远程访问用户 -\u003e\u003e frps   : 发起访问\n  frps -\u003e\u003e xfrpc\t : TypeStartWorkconn Message\n  loop  远程访问用户与本地服务之间的交互过程\n    frps -\u003e\u003e xfrpc         : 用户数据\n    xfrpc -\u003e\u003e 本地服务      : 用户数据\n    本地服务 -\u003e\u003e xfrpc      : 本地服务数据\n    xfrpc -\u003e\u003e frps         : 本地服务数据\n    frps  -\u003e\u003e 远程访问用户  : 本地服务数据\n  end\n  \n```\n\n## How to build\n\n### Build on Ubuntu 20.04.3 LTS\n\nTo run xfrpc on Ubuntu 20.04 LTS, you will need to have the following libraries installed: libevent, openssl-dev, and json-c. Use the following command in your terminal to install these libraries:\n\n```\nsudo apt-get update\nsudo apt-get install -y libjson-c-dev libevent-dev libssl-dev\n```\n\nOnce the required libraries are installed, you can download the xfrpc source code by forking the xfrpc repository on GitHub and then cloning it to your local machine using the following command:\n\n```\ngit clone https://github.com/${YOUR_GITHUB_ACCOUNT_NAME}/xfrpc.git\n```\n\nNavigate to the xfrp directory and create a build directory by using these commands:\n\n```\ncd xfrp\nmkdir build\n```\nUse the following commands to build and install xfrpc:\n\n```\ncmake ..\nmake\n```\nThis will compile xfrpc and create an executable in the build directory. You can then run xfrpc using the executable by running the appropriate command in terminal.\n\n### Build xfrpc by Built-in thirdparty\n\nuse Built-in thirdparty build xfrpc.\n\nrequire cmake version \u003e 3.1.\n\nTo build xfrpc using the built-in third-party libraries, you can fork the xfrpc repository on GitHub and then clone it locally. Then, navigate to the xfrp directory, create a build directory, and use cmake to configure the build.\n\n```shell\ngit clone https://github.com/${YOUR_GITHUB_ACCOUNT_NAME}/xfrpc.git\ncd xfrp\nmkdir build\ncmake -D THIRDPARTY_STATIC_BUILD=ON ..\nmake\n```\n\nBy setting THIRDPARTY_STATIC_BUILD=ON the build process will use the libraries that are included in the xfrpc source code, instead of using the libraries installed on your system.\n\nThe THIRDPARTY_STATIC_BUILD parameter is default set to OFF, which means that by default the build process will use the libraries installed on your system.\n\nIt's important to note that you will need cmake version greater than 3.1 to use this feature.\n\n### Cross-compile xfrpc by Built-in thirdparty\n\nThe method of compiling arm architecture or mips architecture xfrpc under x86 architecture is as follows.\n\nTest on Ubuntu 22.04 LTS\n\nCross-compile mips architecture xfrpc(only support linux mips, irix mips don't supported)\nIf can't run in special mips architecture, Modify the CMakeLists.txt in the thirdparty folder and change the linux-mips32 string to linux-generic32.After modify can work.\n```\nsudo apt-get install gcc-mips-linux-gnu # install mips-gcc compiler\nmkdir build \u0026\u0026 cd build\ncmake -DTHIRDPARTY_STATIC_BUILD=mips -DCMAKE_C_COMPILER=mips-linux-gnu-gcc ..\nmake\n```\n\nCMAKE_C_COMPILER flag is the path of your cross compiler.I recommend that you put this in an environment variable.\n\nCross-compile arm architecture xfrpc\n```\nsudo apt-get install arm-linux-gnueabihf-gcc\nmkdir build \u0026\u0026 cd build\ncmake -DTHIRDPARTY_STATIC_BUILD=arm -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc ..\nmake\n```\n\n### Build static binary in Alpine container\n\nUnder project root directory\n\n```shell\n$ DOCKER_BUILDKIT=1 docker build --output out . -f docker/Dockerfile\n\n$ ls out/\nxfrpc\n```\n\n### Build on OpenWrt master\n\nxfrpc is included in the OpenWrt community since version 1.04.515, which allows users to easily include it in their custom firmware images. It is recommended to use the latest version of xfrpc as it may have bug fixes and new features.\n\nTo include xfrpc in your OpenWrt firmware image, you can use the make menuconfig command to open the configuration menu. In the menu, navigate to \"Network\" and select \"Web Servers/Proxies\" and then select xfrpc. This will include xfrpc in the firmware image that will be built.\n\n### Build xfrpc with asan(For detect memory leak)\n\nWhen encountering a segment fault, please use the following command to compile xfrpc:\n\n```shell\ncmake -DCMAKE_BUILD_TYPE=Debug ..\n```\n\nNow your xfrpc can detect memory leak.We will add it in ci flow in future.\n\n## Quick start for use\n\n**before using xfrpc, you should get frps server: [frps](https://github.com/fatedier/frp/releases)**\n\nfrps is a server-side component of the FRP (Fast Reverse Proxy) system and it is used to forward incoming connections to xfrpc. \n\n+ frps \n\nTo run frps, you can use the following command, providing it with the path to the frps configuration file:\n\n```\n./frps -c frps.ini\n```\n\nA sample frps.ini configuration file is provided in the example, which binds frps to listen on port 7000.\n\n```\n# frps.ini\n[common]\nbind_port = 7000\n```\n\n+ xfrpc tcp support\n\nxfrpc is a client-side component of the FRP system and it can be used to forward TCP connections. To forward incoming TCP connections to a local service, you can configure xfrpc with the following example in xfrpc_mini.ini file\n\n```\n#xfrpc_mini.ini \n[common]\nserver_addr = your_server_ip\nserver_port = 7000\n\n[ssh]\ntype = tcp\nlocal_ip = 127.0.0.1\nlocal_port = 22\nremote_port = 6128\n```\n\nThis configuration tells the frp server (frps) to forward incoming connections on remote port 6128 to the xfrpc client. The xfrpc client, in turn, will forward these connections to the local service running on IP address 127.0.0.1 and port 22.\n\n+ xfrpc http\u0026https support\n\n Supporting HTTP and HTTPS in xfrpc requires additional configuration compared to supporting just TCP. In the frps.ini configuration file, the vhost_http_port and vhost_https_port options must be added to specify the ports that the frp server (frps) will listen on for incoming HTTP and HTTPS connections.\n \n```\n# frps.ini\n[common]\nbind_port = 7000\nvhost_http_port = 80\nvhost_https_port = 443\n```\n\nIt is important to ensure that the xfrpc client is properly configured to communicate with the frp server by specifying the correct server address and port in the xfrpc configuration file.\n\n```\n# xfrpc_mini.ini \n[common]\nserver_addr = x.x.x.x\nserver_port = 7000\n\n[http]\ntype = http\nlocal_port = 80\nlocal_ip = 127.0.0.1\ncustom_domains = www.example.com\n\n[https]\ntype = https\nlocal_port = 443\nlocal_ip = 127.0.0.1\ncustom_domains = www.example.com\n```\n\nThe FRP server (frps) will forward incoming HTTP and HTTPS connections to the domain \"www.example.com\" to the location where xfrpc is running on the local IP and port specified in the configuration file (127.0.0.1:80 and 127.0.0.1:443 respectively).\n\nIt is important to note that the domain name \"www.example.com\" should be pointed to the public IP address of the FRP server (frps) so that when a user's HTTP and HTTPS connections visit the domain, the FRP server can forward those connections to the xfrpc client. This can be done by configuring a DNS server or by using a dynamic DNS service.\n\n+ Run in debug mode \n\nIn order to troubleshooting problem when run xfrpc, you can use debug mode. which has more information when running.\n\n```shell\nxfrpc -c frpc_mini.ini -f -d 7 \n```\n\n+ Run in release mode :\n\n```shell\nxfrpc -c frpc_mini.ini -d 0\n```\n\nIt is important to note that running xfrpc in release mode will generate less log output and will run faster than in debug mode, so it is the recommended way to run xfrpc in production environment.\n\n## Openwrt luci configure ui\n\nIf you're running xfrpc on an OpenWRT device, luci-app-xfrpc is a good option to use as it provides a web-based interface for configuring and managing xfrpc. luci-app-xfrpc is a module for the LuCI web interface, which is the default web interface for OpenWRT.\n\nluci-app-xfrpc was adopted by the LuCI project, which is the official web interface for OpenWRT. This means that it is a supported and well-maintained option for managing xfrpc on OpenWRT devices.\n\nluci-app-xfrpc can be installed via the opkg package manager on OpenWRT and provides a user-friendly interface for configuring the xfrpc client, including options for setting up multiple connections, custom domains and more.\n\n## How to contribute our project\n\nSee [CONTRIBUTING](https://github.com/liudf0716/xfrpc/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow.\n\n## Contact\n\nQQ群 ： [331230369](https://jq.qq.com/?_wv=1027\u0026k=47QGEhL)\n\n\n## Please support us and star our project\n\n[![Star History Chart](https://api.star-history.com/svg?repos=liudf0716/xfrpc\u0026type=Date)](https://star-history.com/#liudf0716/xfrpc\u0026Date)\n\n## 打赏\n\n支付宝打赏\n\n![支付宝打赏](https://user-images.githubusercontent.com/1182593/169465135-d4522479-4068-4714-ab58-987d7d7eb338.png)\n\n\n微信打赏\n\n\n![微信打赏](https://user-images.githubusercontent.com/1182593/169465249-db1b495e-078e-4cab-91fc-96dab3320b06.png)\n\n\n \u003c!--\n \n## 广告\n\n想学习OpenWrt开发，但是摸不着门道？自学没毅力？基础太差？怕太难学不会？跟着佐大学OpenWrt开发入门培训班助你能学有所成\n\n报名地址：https://forgotfun.org/2018/04/openwrt-training-2018.html\n\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliudf0716%2Fxfrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliudf0716%2Fxfrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliudf0716%2Fxfrpc/lists"}