分享
首页 留言 网盘 登录
frp 配置文件

客户端

frpc.toml

#此配置文件仅供参考。请不要直接使用此配置来运行程序,因为它可能存在各种问题。
# 您的代理名称将更改为 {user}.{proxy}
user = "your_name"

#IPv6的文字地址或主机名必须包含在内
#方括号中,如“[::1]:80”、“[ipv6-host]:http”或“[ipv6host%zone]:80”
#对于单个serverAddr字段,不需要方括号,如serverAddr=“:”。
serverAddr = "0.0.0.0"
serverPort = 7000

#STUN服务器帮助穿透NAT漏洞。
# natHoleStunServer = "stun.easyvoip.com:3478"

#决定第一次登录失败时是否退出程序,否则继续重新登录到frps
#默认为true
loginFailExit = true

#控制台或真实的logFile路径类似./frpc.log
log.to = "./frpc.log"
#跟踪、调试、信息、警告、错误
log.level = "info"
log.maxDays = 3
#当log.to为控制台时禁用日志颜色,默认值为false
log.disablePrintColor = false

auth.method = "token"
#auth.additionalScopes指定要包括身份验证信息的其他作用域。
#可选值为HeartBeats、NewWorkConns
# auth.additionalScopes = ["HeartBeats", "NewWorkConns"]

#身份验证令牌
auth.token = "12345678"

#oidc.clientID指定用于在oidc身份验证中获取令牌的客户端ID。
#auth.oidc.clientID=“”
#oidc.clientSecret指定用于在oidc身份验证中获取令牌的客户端机密。
#auth.oidc.clientSecret=“”
#oidc.audience指定oidc身份验证中令牌的受众。
#auth.oidc.audience=“”
#如果AuthenticationMethod==“oidc”,则oidc.scope指定oidc身份验证中令牌的权限。默认情况下,此值为“”。
#auth.oidc.scope=“”
#oidc.tokenEndpointURL指定实现oidc令牌端点的URL。
#它将用于获取OIDC令牌。
#auth.oidc.tokenEndpointURL=“”

#oidc.additionalEndpointParams指定要发送到oidc令牌端点的其他参数。
#例如,如果要指定“访问群体”参数,可以按如下方式进行设置。
#frp将在附加参数中添加"audience=<value>" "var1=<value>" 
# auth.oidc.additionalEndpointParams.audience = "https://dev.auth.com/api/v2/"
# auth.oidc.additionalEndpointParams.var1 = "foobar"

#通过http api(如reload)为控制frpc的操作设置管理地址
webServer.addr = "127.0.0.1"
webServer.port = 7400
webServer.user = "admin"
webServer.password = "admin"
#管理资产目录。默认情况下,这些资产与frpc捆绑在一起。
# webServer.assetsDir = "./static"

#在管理侦听器中启用golang-prof处理程序。
webServer.pprofEnable = false

#拨号到服务器等待连接完成的最长时间。默认值为10秒。
# transport.dialServerTimeout = 10

#dialServerKeepalive指定frpc和frps之间活动网络连接的保持活动探测之间的间隔。
#如果为不积极的,则禁用保活探针。
# transport.dialServerKeepalive = 7200

#连接将提前建立,默认值为零
transport.poolCount = 5

#如果使用tcp流复用,默认值为true,则必须与frps相同
# transport.tcpMux = true

#指定tcp mux的保持活动间隔。
#仅当tcpMux已启用时有效。
# transport.tcpMuxKeepaliveInterval = 60

#用于连接到服务器的通信协议
#现在支持tcp、kcp、quic、websocket和wss,默认为tcp
transport.protocol = "tcp"

#在连接服务器时设置客户端绑定ip,默认为空。
#只有当protocol=tcp或websocket时,才会使用该值
transport.connectServerLocalIP = "0.0.0.0"

#如果要通过http代理、socks5代理或ntlm代理连接frps,可以在此处或全局环境变量中设置proxyURL
#它只在协议为tcp时工作
# transport.proxyURL = "http://user:passwd@192.168.1.128:8080"
# transport.proxyURL = "socks5://user:passwd@192.168.1.128:1080"
# transport.proxyURL = "ntlm://user:passwd@192.168.1.128:2080"

#quic协议选项
# transport.quic.keepalivePeriod = 10
# transport.quic.maxIdleTimeout = 30
# transport.quic.maxIncomingStreams = 100000

#如果tls.enable为true,则frpc将通过tls连接frps。
#自v0.50.0以来,默认值已更改为true,并且默认情况下启用tls。
transport.tls.enable = true

# transport.tls.certFile = "client.crt"
# transport.tls.keyFile = "client.key"
# transport.tls.trustedCaFile = "ca.crt"
# transport.tls.serverName = "example.com"

#如果disableCustomTLSFirstByte设置为false,则frpc将使用
#启用tls时的第一个自定义字节。
#自v0.50.0以来,默认值已更改为true,并且默认情况下禁用第一个自定义字节。
# transport.tls.disableCustomTLSFirstByte = true

#心跳配置,不建议修改默认值。
#heartbeatInterval的默认值为10,heartbeatTimeout为90。设置负值
#以禁用它。
# transport.heartbeatInterval = 30
# transport.heartbeatTimeout = 90

#指定一个dns服务器,因此frpc将使用此服务器而不是默认服务器
# dnsServer = "8.8.8.8"

#要启动的代理名称。
#默认值为空,表示所有代理。
# start = ["ssh", "dns"]

#指定udp数据包大小,单位为字节。如果未设置,则默认值为1500。
#此参数在客户端和服务器之间应该相同。
#它会影响udp和sudp代理。
udpPacketSize = 1500

#客户端的其他元数据。
metadatas.var1 = "abc"
metadatas.var2 = "123"

#包括代理的其他配置文件。
# includes = ["./confd/*.ini"]

[[proxies]]
#“ssh”是唯一的代理名称
#如果全局用户不为空,它将被更改为{user}.{proxy},如“your_name.ssh”
name=“ssh”
type=“tcp”
localIP=“127.0.0.1”
localPort=22
#限制此代理的带宽,单位为KB和MB
transport.bwidthLimit=“1MB”
#限制带宽的位置,可以是“客户端”或“服务器”,默认为“客户端”
transport.bwidthLimitMode=“客户端”
#如果为true,则此代理的流量将被加密,默认为false
transport.useEncryption=false
#如果为true,则流量将被压缩
transport.useCompression=false
#通过frp进行远程端口侦听
remotePort=6001
#frp将对同一组中的代理进行负载平衡连接
loadBalancer.group=“test_group”
#组应具有相同的组密钥
loadBalancer.groupKey=“123456”
#启用后端服务的健康检查,它现在支持“tcp”和“http”。
#frpc将连接本地服务的端口以检测其健康状态
healthCheck.type=“tcp”
#健康检查连接超时
healthCheck.timeoutSeconds=3
#如果连续3次失败,代理将从frps中删除
healthCheck.maxFailed=3
#每10秒进行一次健康检查
healthCheck.intervalSeconds=10
#每个代理的附加元信息。它将被传递给服务器端插件使用。
metadatas.var1 = "abc"
metadatas.var2 = "123"
#您可以通过注释向代理添加一些额外信息。
#这些注释将显示在frps面板上。
[proxies.annotations]
key1 = "value1"
"prefix/key2" = "value2"

[[proxies]]
name = "ssh_random"
type = "tcp"
localIP = "192.168.31.100"
localPort = 22
#如果remotePort为0,frps将为您分配一个随机端口
remotePort = 0

[[proxies]]
name = "dns"
type = "udp"
localIP = "114.114.114.114"
localPort = 53
remotePort = 6002

#将域名解析到[serverAddr],以便使用http://web01.yourdomain.com浏览web01和http://web02.yourdomain.com浏览web02
[[proxies]]
name = "web01"
type = "http"
localIP = "127.0.0.1"
localPort = 80
# http username and password are safety certification for http protocol
# if not set, you can access this customDomains without certification
httpUser = "admin"
httpPassword = "admin"
#如果frps的域是frps.com,那么您可以通过URL http://web01.frps.com 访问[web01]代理

subdomain = "web01"
customDomains = ["web01.yourdomain.com"]
# locations is only available for http type
locations = ["/", "/pic"]
#如果http基本自动用户是abc,则将请求路由到此服务
# routeByHTTPUser = abc
hostHeaderRewrite = "example.com"
requestHeaders.set.x-from-where = "frp"
healthCheck.type = "http"
#frpc将向本地http服务发送GET http请求“/status”
#http服务在返回2xx http响应代码时处于活动状态
healthCheck.path = "/status"
healthCheck.intervalSeconds = 10
healthCheck.maxFailed = 3
healthCheck.timeoutSeconds = 3

[[proxies]]
name = "web02"
type = "https"
localIP = "127.0.0.1"
localPort = 8000
subdomain = "web02"
customDomains = ["web02.yourdomain.com"]
#如果不为空,frpc将使用代理协议将连接信息传输到您的本地服务
#v1或v2或为空
transport.proxyProtocolVersion = "v2"

[[proxies]]
name = "tcpmuxhttpconnect"
type = "tcpmux"
multiplexer = "httpconnect"
localIP = "127.0.0.1"
localPort = 10701
customDomains = ["tunnel1"]
# routeByHTTPUser = "user1"

[[proxies]]
name = "plugin_unix_domain_socket"
type = "tcp"
remotePort = 6003
#如果定义了插件,localIP和localPort就没用了
#插件将处理从frps获得的连接
[proxies.plugin]
type = "unix_domain_socket"
unixPath = "/var/run/docker.sock"

[[proxies]]
name = "plugin_http_proxy"
type = "tcp"
remotePort = 6004
[proxies.plugin]
type = "http_proxy"
httpUser = "abc"
httpPassword = "abc"

[[proxies]]
name = "plugin_socks5"
type = "tcp"
remotePort = 6005
[proxies.plugin]
type = "socks5"
username = "abc"
password = "abc"

[[proxies]]
name = "plugin_static_file"
type = "tcp"
remotePort = 6006
[proxies.plugin]
type = "static_file"
localPath = "/var/www/blog"
stripPrefix = "static"
httpUser = "abc"
httpPassword = "abc"

[[proxies]]
name = "plugin_https2http"
type = "https"
customDomains = ["test.yourdomain.com"]
[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:80"
crtPath = "./server.crt"
keyPath = "./server.key"
hostHeaderRewrite = "127.0.0.1"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "plugin_https2https"
type = "https"
customDomains = ["test.yourdomain.com"]
[proxies.plugin]
type = "https2https"
localAddr = "127.0.0.1:443"
crtPath = "./server.crt"
keyPath = "./server.key"
hostHeaderRewrite = "127.0.0.1"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "plugin_http2https"
type = "http"
customDomains = ["test.yourdomain.com"]
[proxies.plugin]
type = "http2https"
localAddr = "127.0.0.1:443"
hostHeaderRewrite = "127.0.0.1"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "secret_tcp"
#如果类型是secret tcp,则remotePort无效
#想要连接本地端口的人应该部署另一个带有stcp代理的frpc,并且角色是访问者
type = "stcp"
#secretKey用于访问者的身份验证
secretKey = "abcdefg"
localIP = "127.0.0.1"
localPort = 22
#如果不为空,则只有来自指定用户的访问者才能连接。
#否则,来自同一用户的访问者可以连接。'*'意味着允许所有用户
allowUsers = ["*"]

[[proxies]]
name = "p2p_tcp"
type = "xtcp"
secretKey = "abcdefg"
localIP = "127.0.0.1"
localPort = 22
#如果不为空,则只有来自指定用户的访问者才能连接。
#否则,来自同一用户的访问者可以连接。'*'意味着允许所有用户
allowUsers = ["user1", "user2"]

#frpc角色访问者->frps->frpc角色服务器
[[visitors]]
name = "secret_tcp_visitor"
type = "stcp"
#要访问的服务器名称
serverName = "secret_tcp"
secretKey = "abcdefg"
#将此地址连接到访问者stcp服务器
bindAddr = "127.0.0.1"
#bindPort可以小于0,这意味着不绑定到端口,只接收重定向的连接
#其他访客。(SUDP现在不支持此功能)
bindPort = 9000

[[visitors]]
name = "p2p_tcp_visitor"
type = "xtcp"
#如果未设置服务器用户,则默认为当前用户
serverUser = "user1"
serverName = "p2p_tcp"
secretKey = "abcdefg"
bindAddr = "127.0.0.1"
#bindPort可以小于0,这意味着不绑定到端口,只接收重定向的连接
#其他访客。(SUDP现在不支持此功能)
bindPort = 9001
#当需要自动隧道持久性时,将其设置为true
keepTunnelOpen = false
#当keepTunnelOpen设置为true时有效,即每小时打卡的尝试次数
maxRetriesAnHour = 8
minRetryInterval = 90
# fallbackTo = "stcp_visitor"
# fallbackTimeoutMs = 500

服务端

frps.toml

#此配置文件仅供参考。请不要直接使用此配置来运行程序,因为它可能存在各种问题。
#IPv6的文字地址或主机名必须包含在内
#方括号中,如“[::1]:80”、“[ipv6-host]:http”或“[ipv6host%zone]:80”
#对于单个“bindAddr”字段,不需要方括号,如`bindAddr=“::”`。
bindAddr = "0.0.0.0"
bindPort = 7000

#用于kcp协议的udp端口,它可以与“bindPort”相同。
#如果未设置,则在frp中禁用kcp。
kcpBindPort = 7000

#用于quic协议的udp端口。
#如果未设置,则在frps中禁用quic。
# quicBindPort = 7002

#指定代理将侦听的地址,默认值与bindAddr相同
# proxyBindAddr = "127.0.0.1"

#quic协议选项
# transport.quic.keepalivePeriod = 10
# transport.quic.maxIdleTimeout = 30
# transport.quic.maxIncomingStreams = 100000

#心跳配置,不建议修改默认值
#heartbeatTimeout的默认值为90。设置负值以禁用它。
# transport.heartbeatTimeout = 90

#每个代理中的池计数将保持不超过maxPoolCount。
transport.maxPoolCount = 5

#如果使用tcp流复用,则默认为true
# transport.tcpMux = true

#指定tcp mux的保持活动间隔。
#仅当tcpMux为true时有效。
# transport.tcpMuxKeepaliveInterval = 60

#tcpKeepalive指定frpc和frps之间活动网络连接的保持活动探测之间的间隔。
#如果为阴性,则禁用保活探针。
# transport.tcpKeepalive = 7200

#transport.tls.force指定是否只接受tls加密的连接。默认情况下,该值为false。
transport.tls.force = false

# transport.tls.certFile = "server.crt"
# transport.tls.keyFile = "server.key"
# transport.tls.trustedCaFile = "ca.crt"

#如果要支持虚拟主机,则必须设置用于侦听的http端口(可选)
#注意:http端口和https端口可以与bindPort相同
vhostHTTPPort = 80
vhostHTTPSPort = 443

#vhosthttp服务器的响应标头超时(秒),默认值为60s
# vhostHTTPTimeout = 60

#tcpmuxHTTPConnectPort指定服务器侦听TCP的端口
#HTTP CONNECT请求。如果该值为0,则服务器将不会多路传输TCP
#一个端口上的请求。如果不是,它将侦听的此值
#HTTP CONNECT请求。默认情况下,此值为0。
# tcpmuxHTTPConnectPort = 1337

#如果tcpmuxPassthrough为true,则frps不会对流量进行任何更新。
# tcpmuxPassthrough = false

#配置web服务器以启用frps的仪表板。
#只有在设置了webServer.port时,仪表板才可用。
webServer.addr = "127.0.0.1"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"
# webServer.tls.certFile = "server.crt"
# webServer.tls.keyFile = "server.key"

#仪表板资产目录(仅适用于调试模式)
# webServer.assetsDir = "./static"

#在仪表板侦听器中启用golang-prof处理程序。
#必须首先设置仪表板端口
webServer.pprofEnable = false

#enablePrometheus将在webServer上的/metrics-api中导出prometheus度量。
enablePrometheus = true

#控制台或真实的logFile路径类似./frps.log
log.to = "./frps.log"
#跟踪、调试、信息、警告、错误
log.level = "info"
log.maxDays = 3
#当log.to为控制台时禁用日志颜色,默认值为false
log.disablePrintColor = false

#DetailedErrorsToClient定义是否将特定错误(带有调试信息)发送到frpc。默认情况下,此值为true。
detailedErrorsToClient = true

#auth.method指定使用何种身份验证方法将frpc与frps进行身份验证。
#如果指定了“token”,则token将被读取到登录消息中。
#如果指定了“oidc”-将使用oidc设置颁发oidc(Open ID Connect)令牌。默认情况下,此值为“token”。
auth.method = "token"

#auth.additionalScopes指定要包括身份验证信息的其他作用域。
#可选值为HeartBeats、NewWorkConns。
# auth.additionalScopes = ["HeartBeats", "NewWorkConns"]

#身份验证令牌
auth.token = "12345678"

#oidc颁发者指定用于验证oidc令牌的颁发者。
auth.oidc.issuer = ""
#oidc访问群体指定验证时oidc令牌应包含的访问群体。
auth.oidc.audience = ""
#oidc skipExpiryCheck指定如果oidc令牌已过期,是否跳过检查。
auth.oidc.skipExpiryCheck = false
#oidc skipIssuerCheck指定是否跳过检查oidc令牌的颁发者声明是否与OidcIssuer中指定的颁发者匹配。
auth.oidc.skipIssuerCheck = false

#userConnTimeout指定等待工作连接的最长时间。
# userConnTimeout = 10

#只允许frpc绑定您列出的端口。默认情况下,不会有任何限制。
allowPorts = [
  { start = 2000, end = 3000 },
  { single = 3001 },
  { single = 3003 },
  { start = 4000, end = 50000 }
]

#每个客户端可以使用的最大端口数,默认值为0表示没有限制
maxPortsPerClient = 0

#如果subDomainHost不为空,则可以在frpc的配置文件中设置类型为http或https时的子域
#子域为测试时,路由使用的主机为test.frps.com
subDomainHost = "frps.com"

#用于HTTP请求的自定义404页面
# custom404Page = "/path/to/404.html"

#指定udp数据包大小,单位为字节。如果未设置,则默认值为1500。
#此参数在客户端和服务器之间应该相同。
#它会影响udp和sudp代理。
udpPacketSize = 1500

#NAT打孔策略数据的保留时间。
natholeAnalysisDataReserveHours = 168

#ssh隧道网关
#如果要启用此功能,bindPort参数是必需的,而其他参数是可选的。
#默认情况下,此功能处于禁用状态。如果bindPort大于0,它将被启用。
# sshTunnelGateway.bindPort = 2200
# sshTunnelGateway.privateKeyFile = "/home/frp-user/.ssh/id_rsa"
# sshTunnelGateway.autoGenPrivateKeyPath = ""
# sshTunnelGateway.authorizedKeysFile = "/home/frp-user/.ssh/authorized_keys"

[[httpPlugins]]
name = "user-manager"
addr = "127.0.0.1:9000"
path = "/handler"
ops = ["Login"]

[[httpPlugins]]
name = "port-manager"
addr = "127.0.0.1:9001"
path = "/handler"
ops = ["NewProxy"]
x
欢迎赞助本网站
赞助码
评论留言
一共1条留言

网站勉强运行:

富强民主文明和谐自由平等公正法制丨爱国敬业诚信友善

我们一直用心在做

本站支持IPv6访问