GoSuda

使用一个 curl 命令使 localhost 公开 — Portal Tunnel

By gosunuts
views ...

Portal and Tunnel (门户与隧道)

We can create programs anywhere With AI. 借助 AI,我们可以在任何地方创建程序。 But no matter how great a program is, it usually lives only on your own computer — on localhost. 但是,无论程序多么出色,它通常只存在于您自己的计算机上——即 localhost 上。vibecon

To expose it to the outside world, you normally have to go through complicated steps such as router configuration, firewall rules, public IP setup, and tunnel configuration. 为了将其暴露给外部世界,您通常需要经历复杂的步骤,例如 router configuration(路由器配置)、firewall rules(防火墙规则)、public IP setup(公共 IP 设置)和 tunnel configuration(隧道配置)。

What if all of this could be solved with a single line of command? 如果所有这些问题都可以通过一行命令来解决,那会怎样?

With Portal’s tunnel, you can turn your local program into a public service with just one command. 借助 Portal 的隧道功能,您只需一条命令即可将您的本地程序转化为公共服务。

Make localhost public (使 localhost 公开)

  1. First, run your program locally.

  2. 首先,在本地运行您的程序。

  3. Then, this single line is all you need:

  4. 接着,您只需要这一行命令:

1curl -fsSL portal.gosuda.org/tunnel | PORT=3000 NAME={app name} sh
  1. Check that your app is now publicly accessible:
  2. 检查您的应用程序现在是否可公开访问:
  • {app name}.portal.gosuda.org

Multi-tenancy (多租户)

Portal is designed as an open network, not a single service. Anyone can operate a portal relay, and a single app can be connected to multiple portals simultaneously for redundancy or geographic distribution. Portal 被设计为一个开放网络,而非单一服务。任何人都可以运行 portal relay(门户中继),并且单个应用程序可以同时连接到多个门户,以实现冗余或地理分布。

1# Publish to multiple portal relays at once
2# 一次性发布到多个门户中继
3curl -fsSL http://portal.gosuda.org/tunnel | \
4PORT=3000 \
5NAME={app_name} \
6RELAY_URL=portal.thumbgo.kr,portal.iwanhae.kr,s-h.day,portal.lmmt.eu.org \
7sh

A list of active public portals is maintained in the Portal List app (which is itself hosted on the Portal network): 活跃的公共门户列表在 Portal List 应用程序中维护(该应用程序本身托管在 Portal 网络上):https://portal-list.portal.gosuda.org/

This represents a truly permissionless publishing environment that is not dependent on any specific provider or infrastructure. 这代表了一个真正无需许可的发布环境,不依赖于任何特定的提供商或 infrastructure(基础设施)。

Comparison with Other Services (与其他服务的比较)

Tools like ngrok and cloudflared are widely used to expose local services to the public internet. ngrok 和 cloudflared 等工具被广泛用于将本地服务暴露给公共 internet。 However, Portal is fundamentally different in both design philosophy and usage model. 然而,Portal 在 design philosophy(设计理念)和 usage model(使用模型)上都存在根本性的不同。

ngrok and cloudflared are centralized, SaaS-based tunneling services. ngrok 和 cloudflared 是中心化的、基于 SaaS 的 tunneling services(隧道服务)。 They require account creation, token issuance, binary installation, and configuration before use, and users are inevitably subject to service policies and pricing models. 它们在使用前需要 account creation(账户创建)、token issuance(令牌发放)、binary installation(二进制安装)和 configuration(配置),并且用户不可避免地受到 service policies(服务政策)和 pricing models(定价模型)的约束。

In contrast, Portal Tunnel: 相比之下,Portal Tunnel:

  • Runs in one line without installation
  • 一行运行,无需安装
  • Publishes instantly without accounts or tokens
  • 立即发布,无需账户或令牌
  • Allows anyone to operate a relay
  • 允许任何人运行中继
  • Lets a single app connect to multiple portals simultaneously
  • 允许单个应用程序同时连接到多个门户
  • Is a pure network architecture without dependency on any specific vendor
  • 是纯粹的 network architecture(网络架构),不依赖于任何特定 vendor(供应商)

These characteristics place Portal Tunnel in a completely different category from traditional tunneling services.