Command Line Interface 命令行界面
localhost.run uses SSH, which is already installed on all major operating systems.
localhost.run使用SSH,它已经安装在所有主要操作系统上。
Mac OS, Windows and most Linux will use openssh. The man page for openssh is here, the commands you will most often need for tunnels are documented below.
Mac OS, Windows和大多数Linux都将使用openssh。openssh的手册页在这里,您最经常需要的隧道命令记录在下面。
ssh ...#
ssh -R tunnel localhost.run [-- [--output output] [--[no-]inject-http-proxy-headers] [--[no-]inject-proxy-protocol-header] [--proxy-protocol-header-version version]
入门的示例 ssh -R 80:localhost:3002 localhost.run
80:localhost:3002 tunnel(隧道)
-R [customdomain:]bindport:host:hostport#
Forward connections from the localhost.run internet accessable domain to host:port.
将连接从localhost.run internet可访问域转发到host:port。
customdomain# 自定义域#
Optionally connect a tunnel to a custom domain.
可以选择将隧道连接到自定义域。
This defaults to localhost.run
which generates a free domain under localhost.run
.
这默认为localhost.run,它在localhost.run下生成一个自由域。
bindport# 绑定端口
Set your domain to listen on either 80
or 443
.
将域设置为监听80或443。
80
will deploy an unencrypted forwarder on port 80 and a TLS decryption forwarder on port 443 for your domain and send your application unencrypted traffic from your clients.
443
will deploy a redirect to HTTPS on port 80 and a TLS passthru forwarder on port 443 for your domain and send your application the unaltered TLS traffic from your clients.
80将在端口80上部署一个未加密转发器,在端口443上为您的域部署一个TLS解密转发器,并从您的客户端发送应用程序未加密的流量。
443将在端口80上部署重定向到HTTPS,在端口443上为您的域部署TLS passthru转发器,并从您的客户端向您的应用程序发送未更改的TLS流量。
warning
443
is an advanced mode of operation used to develop TLS applications, like letsencrypt handlers for example. Unless you know with certainly you want to use it, you probably don't want to use it.
警告
443是用于开发TLS应用程序的高级操作模式,例如letsencrypt处理程序。除非你知道你肯定想用它,否则你可能不想用它。
host:hostport#
The local address to connect the tunnel to. For example if you access your local application on localhost:8080
then this is also localhost:8080
主机:hostport#
连接隧道的本地地址。例如,如果您在localhost:8080上访问本地应用程序,那么这也是localhost:8080
note
Some operating systems set localhost
to the ipv6 address [::1]
while some frameworks listen on 127.0.0.1
, try 127.0.0.1
instead of localhost
if there are connection issues.
笔记
有些操作系统将localhost设置为ipv6地址[::1],而有些框架在127.0.0.1上侦听,如果存在连接问题,请尝试127.0.0.1而不是localhost。
--output output#
Set the output format for event messages:
- text (default)
- json
设置事件消息的输出格式:
- 文本(默认)
- json文件
--inject-http-proxy-headers#
Enable http proxy headers. 启用http代理标头。
This functionality is on by default and can be disabled with --no-inject-http-proxy-headers
.
默认情况下,此功能处于启用状态,并且可以使用--no-inject-http-proxy-headers
禁用
See HTTP Tunnels Proxy headers section for more information.
有关详细信息,请参阅HTTP隧道代理标头部分。
--inject-proxy-protocol-header#
Enable the Proxy Protocol TCP header.
启用代理协议TCP标头。
This functionality is off by default and can be enabled with --inject-proxy-protocol-header
.
默认情况下,此功能处于关闭状态,可以使用--inject-proxy-protocol-header
打开.
warning
This is an advanced setting and should only be used with applications that expect a Proxy Protocol TCP header.
警告
这是一个高级设置,只能用于需要代理协议TCP头的应用程序。
--proxy-protocol-header-version version#
Set the Proxy Protocol version:
- v1
- v2
This defaults to v1
when the header is enabled.
设置代理协议版本:
- v1
- v2
启用标头时,默认为v1。
Examples#示例#
ssh -R 80:localhost:8080 localhost.run
will connect a free domain tunnel to localhost on port 8080.
- ssh -R 80:localhost:8080 localhost.run将免费域隧道连接到端口8080上的本地主机。
ssh -R 80:localhost:3000 localhost.run
will connect a free domain tunnel to localhost on port 3000.
ssh -R 80:localhost:3000 localhost.run
将免费域隧道连接到端口3000上的localhost。
ssh -R example.com:80:localhost:3000 localhost.run
will connect a custom domain tunnel from example.com to localhost on port 3000.
ssh -R example.com:80:localhost:3000 localhost.run
将一个自定义域隧道从example.com连接到端口3000上的localhost。
ssh -R www.example.com:80:localhost:3000 -R example.com:80:localhost:3000 localhost.run
will connect a custom domain tunnel from example.com and www.example.com to localhost on port 3000. See Custom Domains for more details about using subdomains included with all custom domains.
ssh -R www.example.com:80:localhost:3000 -R example.com:80:localhost:3000 localhost.run
将从example.com和www.example.com的自定义域隧道连接到端口3000上的localhost。有关使用所有自定义域中包含的子域的详细信息,请参阅自定义域。
ssh -R admin.example.com:80:localhost:8000 -R example.com:80:localhost:3000 localhost.run
will connect a custom domain tunnel from example.com to localhost on port 3000 and a custom domain tunnel from admin.example.com to localhost on port 8000. See Custom Domains for more details about using subdomains included with all custom domains.
ssh -R admin.example.com:80:localhost:8000 -R example.com:80:localhost:3000 localhost.run
将从example.com连接到端口3000上的localhost的自定义域隧道,以及从admin.example.com连接到端口8000上的localhost的自定义域隧道。有关使用所有自定义域中包含的子域的详细信息,请参阅自定义域。
ssh -R example.com:80:localhost:3000 localhost.run -- --no-inject-http-proxy-headers
will connect a custom domain tunnel from example.com to localhost on port 3000 and not add HTTP Proxy headers.
ssh -R example.com:80:localhost:3000 localhost.run -- --no-inject-http-proxy-headers
将从example.com连接自定义域隧道到端口3000上的localhost,而不添加HTTP代理标头。
ssh -R example.com:80:localhost:3000 localhost.run -- --inject-proxy-protocol-header
will connect a custom domain tunnel from example.com to localhost on port 3000 and send a Proxy Protocol V1 header at the beginning of each TCP connection.
ssh -R example.com:80:localhost:3000 localhost.run -- --inject-proxy-protocol-header
将一个自定义域隧道从example.com连接到端口3000上的localhost,并在每个TCP连接的开始处发送代理协议V1头。
评论