{"id":15893598,"url":"https://github.com/alexdlaird/java-ngrok","last_synced_at":"2025-03-20T14:30:38.132Z","repository":{"id":37927394,"uuid":"359293310","full_name":"alexdlaird/java-ngrok","owner":"alexdlaird","description":"A Java wrapper for ngrok","archived":false,"fork":false,"pushed_at":"2024-04-15T13:59:32.000Z","size":1010,"stargazers_count":43,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-02T05:50:26.100Z","etag":null,"topics":["education","java","java-ngrok","localhost","localtunnel","ngrok","reverse-proxy","tunnel","tunneling","webhook"],"latest_commit_sha":null,"homepage":"https://javadoc.io/doc/com.github.alexdlaird/java-ngrok","language":"Java","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/alexdlaird.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"alexdlaird","patreon":"alexdlaird","custom":["https://www.paypal.me/alexdlaird"]}},"created_at":"2021-04-19T01:27:12.000Z","updated_at":"2024-05-04T13:45:15.508Z","dependencies_parsed_at":"2024-02-14T00:25:55.566Z","dependency_job_id":"f8eddd36-d67e-4f43-a685-900eaf383ddf","html_url":"https://github.com/alexdlaird/java-ngrok","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdlaird%2Fjava-ngrok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdlaird%2Fjava-ngrok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdlaird%2Fjava-ngrok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdlaird%2Fjava-ngrok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdlaird","download_url":"https://codeload.github.com/alexdlaird/java-ngrok/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244629987,"owners_count":20484293,"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":["education","java","java-ngrok","localhost","localtunnel","ngrok","reverse-proxy","tunnel","tunneling","webhook"],"created_at":"2024-10-06T08:12:13.731Z","updated_at":"2025-03-20T14:30:38.127Z","avatar_url":"https://github.com/alexdlaird.png","language":"Java","readme":"\u003cp align=\"center\"\u003e\u003cimg alt=\"java-ngrok - a Java wrapper for ngrok\" src=\"https://github.com/alexdlaird/java-ngrok/raw/main/logo.png\" /\u003e\u003c/p\u003e\n\n[![Version](https://img.shields.io/maven-central/v/com.github.alexdlaird/java-ngrok)](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java-ngrok/)\n[![Java Versions](https://img.shields.io/badge/Java-11+-blue)](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java-ngrok/)\n[![Coverage](https://img.shields.io/codecov/c/github/alexdlaird/java-ngrok)](https://codecov.io/gh/alexdlaird/java-ngrok)\n[![Build](https://img.shields.io/github/actions/workflow/status/alexdlaird/java-ngrok/build.yml)](https://github.com/alexdlaird/java-ngrok/actions/workflows/build.yml)\n[![Code Quality](https://api.codacy.com/project/badge/Grade/940d16178f8f4e8abfcf9bf2873894b3)](https://app.codacy.com/gh/alexdlaird/java-ngrok?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=alexdlaird/java-ngrok\u0026utm_campaign=Badge_Grade)\n[![Docs](https://img.shields.io/badge/docs-passing-brightgreen)](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok)\n[![GitHub License](https://img.shields.io/github/license/alexdlaird/java-ngrok)](https://github.com/alexdlaird/java-ngrok/blob/main/LICENSE)\n\n`java-ngrok` is a Java wrapper for `ngrok` that manages its own binary, making `ngrok` available via a convenient Java\nAPI.\n\n[`ngrok`](https://ngrok.com) is a reverse proxy tool that opens secure tunnels from public URLs to localhost, perfect\nfor\nexposing local web servers, building webhook integrations, enabling SSH access, testing chatbots, demoing from your own\nmachine, and more, and its made even more powerful with native Java integration through `java-ngrok`.\n\n## Installation\n\n`java-ngrok` is available\non [Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java-ngrok/).\n\nIf we want `ngrok` to be available from the command\nline, [pyngrok](https://pyngrok.readthedocs.io/en/latest/#installation)\ncan be installed using `pip` to manage that for us.\n\n## Basic Usage\n\n### Open a Tunnel\n\nAll `ngrok` functionality is available through\nthe [`NgrokClient`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/NgrokClient.html).\nTo open a tunnel, use\nthe [`connect`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/NgrokClient.html#connect(com.github.alexdlaird.ngrok.protocol.CreateTunnel))\nmethod, which returns a `Tunnel`, and this returned object has a reference to the public URL generated by `ngrok`, which\ncan be retrieved\nwith [`getPublicUrl()`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/Tunnel.html#getPublicUrl()).\n\n```java\nfinal NgrokClient ngrokClient = new NgrokClient.Builder().build();\n\n// Open a HTTP tunnel on the default port 80\n// \u003cTunnel: \"https://\u003cpublic_sub\u003e.ngrok.io\" -\u003e \"http://localhost:80\"\u003e\nfinal Tunnel httpTunnel = ngrokClient.connect();\n\n// Open a SSH tunnel\n// \u003cTunnel: \"tcp://0.tcp.ngrok.io:12345\" -\u003e \"localhost:22\"\u003e\nfinal CreateTunnel sshCreateTunnel = new CreateTunnel.Builder()\n        .withProto(Proto.TCP)\n        .withAddr(22)\n        .build();\nfinal Tunnel sshTunnel = ngrokClient.connect(sshCreateTunnel);\n\n// Open a named tunnel from the config file\nfinal CreateTunnel createNamedTunnel = new CreateTunnel.Builder()\n        .withName(\"my-config-file-tunnel\")\n        .build();\nfinal Tunnel namedTunnel = ngrokClient.connect(createNamedTunnel);\n```\n\nThe [`connect`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/NgrokClient.html#connect(com.github.alexdlaird.ngrok.protocol.CreateTunnel))\nmethod can also take\na [`CreateTunnel`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/CreateTunnel.html) (which can be built through [its Builder](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/CreateTunnel.Builder.html))\nthat allows us to pass additional properties that\nare supported by `ngrok` (or [`withName()`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/CreateTunnel.Builder.html#withName(java.lang.String))\nto use a tunnel defined in `ngrok`'s config file), [as documented here](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/NgrokClient.html#tunnel-configurations).\n\n### `ngrok`'s Edge\nTo use [`ngrok`'s Edge](https://ngrok.com/docs/network-edge/edges/) with `java-ngrok`, first\n[configure an Edge](https://dashboard.ngrok.com/edges) [on ngrok's dashboard](https://dashboard.ngrok.com/edges) (with\nat least one Endpoint mapped to the Edge), and define a labeled tunnel in\n[the `ngrok` config file](https://ngrok.com/docs/agent/config/v2/#define-two-labeled-tunnels) that points to the Edge.\n\n```yaml\ntunnels:\n  some-edge-tunnel:\n    labels:\n      - edge=my_edge_id\n    addr: http://localhost:80\n```\n\nTo start a labeled tunnel in `java-ngrok`, set [withName(String)](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/CreateTunnel.Builder.html#withName(java.lang.String)).\n\n```java\nfinal NgrokClient ngrokClient = new NgrokClient.Builder().build();\n\n// Open a named tunnel from the config file\nfinal CreateTunnel createNamedTunnel = new CreateTunnel.Builder()\n        .withName(\"some-edge-tunnel\")\n        .build();\nfinal Tunnel namedTunnel = ngrokClient.connect(createNamedTunnel);\n```\n\nOnce an Edge tunnel is started, it can be managed through [`ngrok`'s dashboard](https://dashboard.ngrok.com/edges).\n\n### Command Line Usage\n\nAssuming we have also installed [pyngrok](https://pyngrok.readthedocs.io/en/latest/#installation), all features of `ngrok` are available\non the command line.\n\n```sh\nngrok http 80\n```\n\nFor details on how to fully leverage `ngrok` from the command line,\nsee [`ngrok`'s official documentation](https://ngrok.com/docs/agent/cli/).\n\n## Documentation\n\nFor more advanced usage, `java-ngrok`'s official documentation is available\nat [https://javadoc.io/doc/com.github.alexdlaird/java-ngrok](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok).\n\n### `ngrok` Version Compatibility\n\n`java-ngrok` is compatible with `ngrok` v2 and v3, but by default it will install v3. To install v2 instead,\nset the version\nwith [`JavaNgrokConfig.Builder.withNgrokVersion(NgrokVersion)`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/conf/JavaNgrokConfig.Builder.html#withNgrokVersion(com.github.alexdlaird.ngrok.installer.NgrokVersion))\nand [`CreateTunnel.Builder.withNgrokVersion(NgrokVersion)`](https://javadoc.io/doc/com.github.alexdlaird/java-ngrok/latest/com.github.alexdlaird.ngrok/com/github/alexdlaird/ngrok/protocol/CreateTunnel.Builder.html#withNgrokVersion(com.github.alexdlaird.ngrok.installer.NgrokVersion)).\n\n### Java 8\n\n[![Version](https://img.shields.io/maven-central/v/com.github.alexdlaird/java8-ngrok)](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java8-ngrok/)\n[![Java Versions](https://img.shields.io/badge/Java-8+-blue)](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java8-ngrok/)\n[![Coverage](https://img.shields.io/codecov/c/github/alexdlaird/java-ngrok/1.4.x)](https://codecov.io/gh/alexdlaird/java-ngrok/tree/1.4.x)\n[![Build](https://img.shields.io/github/actions/workflow/status/alexdlaird/java-ngrok/build.yml?branch=1.4.x)](https://github.com/alexdlaird/java-ngrok/actions/workflows/build.yml?query=branch%3A1.4.x)\n[![Docs](https://img.shields.io/badge/docs-passing-brightgreen)](https://javadoc.io/doc/com.github.alexdlaird/java8-ngrok)\n[![GitHub License](https://img.shields.io/github/license/alexdlaird/java-ngrok)](https://github.com/alexdlaird/java-ngrok/blob/main/LICENSE)\n\nJava 8 support is not actively maintained, but on a periodic basis, `main` may be rebased in to the `1.4.x`\nbranch, where a compatible build of this project exists for Java 8. To use it, include the `java8-ngrok`\ndependency from [Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.alexdlaird/java8-ngrok/).\n\nFor more details on what differs in the `java8-ngrok` dependency,\nsee [the \"Java 8\" section of the docs](https://javadoc.io/doc/com.github.alexdlaird/java8-ngrok/latest/index.html#java8).\n\n## Contributing\n\nIf you would like to get involved, be sure to review\nthe [Contribution Guide](https://github.com/alexdlaird/java-ngrok/blob/main/CONTRIBUTING.md).\n\nWant to contribute financially? If you've found `java-ngrok`\nuseful, [sponsorship](https://github.com/sponsors/alexdlaird)\nwould also be greatly appreciated!\n","funding_links":["https://github.com/sponsors/alexdlaird","https://patreon.com/alexdlaird","https://www.paypal.me/alexdlaird"],"categories":["网络编程"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdlaird%2Fjava-ngrok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdlaird%2Fjava-ngrok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdlaird%2Fjava-ngrok/lists"}