{"id":21523774,"url":"https://github.com/bhojpur/vpn","last_synced_at":"2026-02-14T02:45:15.506Z","repository":{"id":37461686,"uuid":"446172344","full_name":"bhojpur/vpn","owner":"bhojpur","description":"The Bhojpur VPN is a virtual private networking system based on the Bhojpur.NET Platform for application delivery.","archived":false,"fork":false,"pushed_at":"2022-04-26T14:33:10.000Z","size":503,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T01:18:52.277Z","etag":null,"topics":["networking","virtual-networking","vpn"],"latest_commit_sha":null,"homepage":"https://page.bhojpur-consulting.com/product/vpn/","language":"Go","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/bhojpur.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}},"created_at":"2022-01-09T18:36:22.000Z","updated_at":"2024-08-12T20:19:37.000Z","dependencies_parsed_at":"2022-09-04T23:12:02.821Z","dependency_job_id":null,"html_url":"https://github.com/bhojpur/vpn","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bhojpur/vpn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhojpur%2Fvpn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhojpur%2Fvpn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhojpur%2Fvpn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhojpur%2Fvpn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhojpur","download_url":"https://codeload.github.com/bhojpur/vpn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhojpur%2Fvpn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29432613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T02:20:56.896Z","status":"ssl_error","status_checked_at":"2026-02-14T02:11:29.478Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["networking","virtual-networking","vpn"],"created_at":"2024-11-24T01:19:21.197Z","updated_at":"2026-02-14T02:45:15.489Z","avatar_url":"https://github.com/bhojpur.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bhojpur VPN - Networking Framework\n\nThe Bhojpur VPN is a decentralized, virtual private networking system applied within the\n[Bhojpur.NET Platform](https://github.com/bhojpur/platform) for delivery of distributed\n`applications` or `services`. It uses libp2p to build private decentralized networks that\ncould be accessed via shared secrets.\n\nIt can:\n\n- **Create a VPN** :  Secure VPN between P2P peers\n  - Automatically assign IPs to nodes\n  - Embedded tiny DNS server to resolve internal/external IPs\n  - Create trusted zones to prevent network access if token is leaked\n\n- **Act as a reverse Proxy** : Share a TCP service. The Bhojpur VPN let exposes TCP services\nto the P2P network nodes without establishing a VPN connection: creates reverse proxy and\ntunnels traffic into the P2P network.\n\n- **Send files via P2P** : Send files over P2P between nodes without establishing a VPN connection.\n\n- **Be used as a library**: Plug a distributed P2P ledger easily in your project!\n\n## Installation\n\nDownload the precompiled static release in the [releases page](https://github.com/bhojpur/vpn/releases).\nYou can either install it in your system or just run it.\n\n## Simple Usage\n\nThe Bhojpur VPN works by generating tokens (or, a configuration file) that can be shared\nbetween different machines, hosts, or peers to access to a decentralized secured network\nbetween them. Every token is unique and identifies the network, no central server setup,\nor specifying hosts IP is required.\n\nTo generate a config run:\n\n```bash\n# Generate a new config file and use it later as BHOJPUR_VPN_CONFIG\n$ vpnsvr -g \u003e config.yaml\n```\n\nor, to generate a portable token:\n\n```bash\n$ BHOJPUR_VPN_TOKEN=$(vpnsvr -g -b)\n```\n\n*NOTE*: Tokens are config merely encoded in base64, so this is equivalent:\n\n```bash\n$ BHOJPUR_VPN_TOKEN=$(vpnsvr -g | tee config.yaml | base64 -w0)\n```\n\nAll Bhojpur VPN commands implies that you either specify a `BHOJPUR_VPN_TOKEN`\n(`--token` as parameter) or a `BHOJPUR_VPN_CONFIG` as this is the way for `vpnsvr`\nto establish a network between the nodes.\n\nThe configuration file is the network definition and allows you to connect over to\nyour peers securely.\n\n**Warning** Exposing this file or passing-it by is equivalent to give full control\nto the network.\n\n### As a VPN\n\nTo start the VPN, simply run `vpnsvr` without any argument.\n\nAn example of running Bhojpur VPN on multiple hosts:\n\n```bash\n# on Node A\n$ BHOJPUR_VPN_TOKEN=.. vpnsvr --address 10.1.0.11/24\n# on Node B\n$ BHOJPUR_VPN_TOKEN=.. vpnsvr --address 10.1.0.12/24\n# on Node C ...\n$ BHOJPUR_VPN_TOKEN=.. vpnsvr --address 10.1.0.13/24\n...\n```\n\n... and that's it! the `--address` is a _virtual_ unique IP for each node, and it\nis actually the IP, where the node will be reachable to from the VPN. You can assign\nIPs freely to the nodes of the network, while you can override the default\n`bhojpurvpn0` interface with `IFACE` (or `--interface`)\n\n*NOTE*: It might take up time to build the connection between nodes. Wait at least\n5 mins, it depends on the network behind the hosts.\n\n## Use Case: [Bhojpur DCP](https://github.com/bhojpur/dcp) test cluster\n\nLet's say you are developing something for the Kubernetes and you would like to \na multi-node setup, but you have machines available only behind NAT; and, you would\nreally like to leverage hardware.\n\n1) Generate `Bhojpur VPN` config: `vpnsvr -g \u003e vpn.yaml`\n2) Start the VPN:\n\n   on node A: `sudo IFACE=bhojpurvpn0 ADDRESS=10.1.0.3/24 BHOJPUR_VPN_CONFIG=vpn.yml vpnsvr`\n   \n   on node B: `sudo IFACE=bhojpurvpn0 ADDRESS=10.1.0.4/24 BHOJPUR_VPN_CONFIG=vpm.yml vpnsvr`\n3) Start [Bhojpur DCP](https://gihub.com/bhojpur/dcp):\n \n   on node A: `dcp server --flannel-iface=bhojpurvpn0`\n   \n   on node B: `DCP_URL=https://10.1.0.3:6443 DCP_TOKEN=xx dcp agent --flannel-iface=bhojpurvpn0 --node-ip 10.10.4`\n\nWe have used flannel here, but other CNI should work as well.\n\nDon't miss out [Bhojpur OS](https://github.com/bhojpur/os), which is a Linux derivative\nbuilt on top of [Bhojpur DCP](https://gihub.com/bhojpur/dcp) and `Bhojpur VPN` for automatic\nnode discovery!\n\n## As a library\n\nThe `Bhojpur VPN` could be used as a library. It is very portable and offers a functional\ninterface. To join a node in a network from a token, without starting the VPN:\n\n```golang\nimport (\n    node \"github.com/bhojpur/vpn/pkg/node\"\n)\n\ne := node.New(\n    node.Logger(l),\n    node.LogLevel(log.LevelInfo),\n    node.MaxMessageSize(2 \u003c\u003c 20),\n    node.FromBase64( mDNSEnabled, DHTEnabled, token ),\n    // ....\n  )\n\ne.Start(ctx)\n\n```\n\nor, to start a Bhojpur VPN:\n\n```golang\nimport (\n    vpn \"github.com/bhojpur/vpn/pkg/engine\"\n    node \"github.com/bhojpur/vpn/pkg/node\"\n)\n\nopts, err := vpn.Register(vpnOpts...)\nif err != nil {\n\treturn err\n}\n\ne := vpn.New(append(o, opts...)...)\n\ne.Start(ctx)\n```\n\n## Troubleshooting\n\nIf during bootstrap you see messages like:\n\n```bash\nvpnsvr[3679]:             * [/ip4/104.131.131.82/tcp/4001] failed to negotiate stream multiplexer: context deadline exceeded     \n```\n\nor,\n\n```bash\nvpnsvr[9971]: 2021/12/16 20:56:34 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB)\n```\n\nor, generally experiencing poor network performance, it is recommended to increase the\nmaximum buffer size by running:\n\n```bash\n$ sysctl -w net.core.rmem_max=2500000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhojpur%2Fvpn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhojpur%2Fvpn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhojpur%2Fvpn/lists"}