2023 The frp Authors 保留所有权利
中文|English
Starting from v0.52.0, frp supports TOML, YAML, and JSON As a Configuration file format.
Please note, INI It has been deprecated and will be removed in future releases. New features can only be found in TOML, YAML, or JSON Use. Users who use these new features should switch their Configuration format accordingly.
You can use any format you like, TOML/YAML/JSON, to write Configuration File and frp will automatically adapt for parsing.
DocumentExample mainly relies on TOML Write the following ExampleConfiguration to penetrate local SSH services into the public network.
frps Configuration:
bindPort = 7000
frpc Configuration:
serverAddr = "x.x.x.x"
serverPort = 7000
[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000
The same client can configure multiple agents, but name Must ensure uniqueness.
Different clients can be configured with different users to ensure the Agent Unique name.
Configuration file supports template rendering using environment variables, using Go as the template format Standard format for.
ExampleConfiguration如下:
serverAddr = "{{ .Envs.FRP_SERVER_ADDR }}"
serverPort = 7000
[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = {{ .Envs.FRP_SSH_REMOTE_PORT }}
Start the frpc program:
export FRP_SERVER_ADDR="x.x.x.x"
export FRP_SSH_REMOTE_PORT="6000"
./frpc -c ./frpc.toml
FRPC will automatically use environment variables to render
Configuration File template, all environment variables need to
be specified as
Envs
is the prefix.
By executingfrpc verify - c/ Frpc. toml
or
frps verify - c/ Frps. toml
The parameters in the Configuration file can be pre validated.
frpc: The configuration file/ Frpc.toml syntax is okay
If this result occurs, it indicates a new Configuration File has no errors, otherwise specific error information will be output.
adopt
includes
Parameters can include other configurations in the main
configuration File to split Agent Configuration into multiple
files for management.
# frpc.toml
serverAddr = "x.x.x.x"
serverPort = 7000
includes = ["./confd/*.toml"]
# ./confd/test.toml
[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000
The above Configuration is additionally included in frpc.toml
through includes
/ Agent for all toml files in the confd
directory
The Configuration content is equivalent to merging these two
files into one file.
It should be noted that the file specified by includes can only contain Agent Configuration, the configuration of general parameters can only be placed in the main configuration In file.
Due to FRP At present, there are many supported functions and Configuration items. Function parameters that are not listed in the Document can be found in the View inReferenc.