1
0

frpc_full_example.toml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. # This configuration file is for reference only. Please do not use this configuration directly to run the program as it may have various issues.
  2. # your proxy name will be changed to {user}.{proxy}
  3. user = "your_name"
  4. # A literal address or host name for IPv6 must be enclosed
  5. # in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
  6. # For single serverAddr field, no need square brackets, like serverAddr = "::".
  7. serverAddr = "0.0.0.0"
  8. serverPort = 7000
  9. # STUN server to help penetrate NAT hole.
  10. # natHoleStunServer = "stun.easyvoip.com:3478"
  11. # Decide if exit program when first login failed, otherwise continuous relogin to frps
  12. # default is true
  13. loginFailExit = true
  14. # console or real logFile path like ./frpc.log
  15. log.to = "./frpc.log"
  16. # trace, debug, info, warn, error
  17. log.level = "info"
  18. log.maxDays = 3
  19. # disable log colors when log.to is console, default is false
  20. log.disablePrintColor = false
  21. auth.method = "token"
  22. # auth.additionalScopes specifies additional scopes to include authentication information.
  23. # Optional values are HeartBeats, NewWorkConns.
  24. # auth.additionalScopes = ["HeartBeats", "NewWorkConns"]
  25. # auth token
  26. auth.token = "12345678"
  27. # oidc.clientID specifies the client ID to use to get a token in OIDC authentication.
  28. # auth.oidc.clientID = ""
  29. # oidc.clientSecret specifies the client secret to use to get a token in OIDC authentication.
  30. # auth.oidc.clientSecret = ""
  31. # oidc.audience specifies the audience of the token in OIDC authentication.
  32. # auth.oidc.audience = ""
  33. # oidc.scope specifies the permissions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "".
  34. # auth.oidc.scope = ""
  35. # oidc.tokenEndpointURL specifies the URL which implements OIDC Token Endpoint.
  36. # It will be used to get an OIDC token.
  37. # auth.oidc.tokenEndpointURL = ""
  38. # oidc.additionalEndpointParams specifies additional parameters to be sent to the OIDC Token Endpoint.
  39. # For example, if you want to specify the "audience" parameter, you can set as follow.
  40. # frp will add "audience=<value>" "var1=<value>" to the additional parameters.
  41. # auth.oidc.additionalEndpointParams.audience = "https://dev.auth.com/api/v2/"
  42. # auth.oidc.additionalEndpointParams.var1 = "foobar"
  43. # Set admin address for control frpc's action by http api such as reload
  44. webServer.addr = "127.0.0.1"
  45. webServer.port = 7400
  46. webServer.user = "admin"
  47. webServer.password = "admin"
  48. # Admin assets directory. By default, these assets are bundled with frpc.
  49. # webServer.assetsDir = "./static"
  50. # Enable golang pprof handlers in admin listener.
  51. webServer.pprofEnable = false
  52. # The maximum amount of time a dial to server will wait for a connect to complete. Default value is 10 seconds.
  53. # transport.dialServerTimeout = 10
  54. # dialServerKeepalive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
  55. # If negative, keep-alive probes are disabled.
  56. # transport.dialServerKeepalive = 7200
  57. # connections will be established in advance, default value is zero
  58. transport.poolCount = 5
  59. # If tcp stream multiplexing is used, default is true, it must be same with frps
  60. # transport.tcpMux = true
  61. # Specify keep alive interval for tcp mux.
  62. # only valid if tcpMux is enabled.
  63. # transport.tcpMuxKeepaliveInterval = 30
  64. # Communication protocol used to connect to server
  65. # supports tcp, kcp, quic, websocket and wss now, default is tcp
  66. transport.protocol = "tcp"
  67. # set client binding ip when connect server, default is empty.
  68. # only when protocol = tcp or websocket, the value will be used.
  69. transport.connectServerLocalIP = "0.0.0.0"
  70. # if you want to connect frps by http proxy or socks5 proxy or ntlm proxy, you can set proxyURL here or in global environment variables
  71. # it only works when protocol is tcp
  72. # transport.proxyURL = "http://user:passwd@192.168.1.128:8080"
  73. # transport.proxyURL = "socks5://user:passwd@192.168.1.128:1080"
  74. # transport.proxyURL = "ntlm://user:passwd@192.168.1.128:2080"
  75. # quic protocol options
  76. # transport.quic.keepalivePeriod = 10
  77. # transport.quic.maxIdleTimeout = 30
  78. # transport.quic.maxIncomingStreams = 100000
  79. # If tls.enable is true, frpc will connect frps by tls.
  80. # Since v0.50.0, the default value has been changed to true, and tls is enabled by default.
  81. transport.tls.enable = true
  82. # transport.tls.certFile = "client.crt"
  83. # transport.tls.keyFile = "client.key"
  84. # transport.tls.trustedCaFile = "ca.crt"
  85. # transport.tls.serverName = "example.com"
  86. # If the disableCustomTLSFirstByte is set to false, frpc will establish a connection with frps using the
  87. # first custom byte when tls is enabled.
  88. # Since v0.50.0, the default value has been changed to true, and the first custom byte is disabled by default.
  89. # transport.tls.disableCustomTLSFirstByte = true
  90. # Heartbeat configure, it's not recommended to modify the default value.
  91. # The default value of heartbeatInterval is 10 and heartbeatTimeout is 90. Set negative value
  92. # to disable it.
  93. # transport.heartbeatInterval = 30
  94. # transport.heartbeatTimeout = 90
  95. # Specify a dns server, so frpc will use this instead of default one
  96. # dnsServer = "8.8.8.8"
  97. # Proxy names you want to start.
  98. # Default is empty, means all proxies.
  99. # start = ["ssh", "dns"]
  100. # Specify udp packet size, unit is byte. If not set, the default value is 1500.
  101. # This parameter should be same between client and server.
  102. # It affects the udp and sudp proxy.
  103. udpPacketSize = 1500
  104. # Additional metadatas for client.
  105. metadatas.var1 = "abc"
  106. metadatas.var2 = "123"
  107. # Include other config files for proxies.
  108. # includes = ["./confd/*.ini"]
  109. [[proxies]]
  110. # 'ssh' is the unique proxy name
  111. # If global user is not empty, it will be changed to {user}.{proxy} such as 'your_name.ssh'
  112. name = "ssh"
  113. type = "tcp"
  114. localIP = "127.0.0.1"
  115. localPort = 22
  116. # Limit bandwidth for this proxy, unit is KB and MB
  117. transport.bandwidthLimit = "1MB"
  118. # Where to limit bandwidth, can be 'client' or 'server', default is 'client'
  119. transport.bandwidthLimitMode = "client"
  120. # If true, traffic of this proxy will be encrypted, default is false
  121. transport.useEncryption = false
  122. # If true, traffic will be compressed
  123. transport.useCompression = false
  124. # Remote port listen by frps
  125. remotePort = 6001
  126. # frps will load balancing connections for proxies in same group
  127. loadBalancer.group = "test_group"
  128. # group should have same group key
  129. loadBalancer.groupKey = "123456"
  130. # Enable health check for the backend service, it supports 'tcp' and 'http' now.
  131. # frpc will connect local service's port to detect it's healthy status
  132. healthCheck.type = "tcp"
  133. # Health check connection timeout
  134. healthCheck.timeoutSeconds = 3
  135. # If continuous failed in 3 times, the proxy will be removed from frps
  136. healthCheck.maxFailed = 3
  137. # Every 10 seconds will do a health check
  138. healthCheck.intervalSeconds = 10
  139. # Additional meta info for each proxy. It will be passed to the server-side plugin for use.
  140. metadatas.var1 = "abc"
  141. metadatas.var2 = "123"
  142. # You can add some extra information to the proxy through annotations.
  143. # These annotations will be displayed on the frps dashboard.
  144. [proxies.annotations]
  145. key1 = "value1"
  146. "prefix/key2" = "value2"
  147. [[proxies]]
  148. name = "ssh_random"
  149. type = "tcp"
  150. localIP = "192.168.31.100"
  151. localPort = 22
  152. # If remotePort is 0, frps will assign a random port for you
  153. remotePort = 0
  154. [[proxies]]
  155. name = "dns"
  156. type = "udp"
  157. localIP = "114.114.114.114"
  158. localPort = 53
  159. remotePort = 6002
  160. # Resolve your domain names to [serverAddr] so you can use http://web01.yourdomain.com to browse web01 and http://web02.yourdomain.com to browse web02
  161. [[proxies]]
  162. name = "web01"
  163. type = "http"
  164. localIP = "127.0.0.1"
  165. localPort = 80
  166. # http username and password are safety certification for http protocol
  167. # if not set, you can access this customDomains without certification
  168. httpUser = "admin"
  169. httpPassword = "admin"
  170. # if domain for frps is frps.com, then you can access [web01] proxy by URL http://web01.frps.com
  171. subdomain = "web01"
  172. customDomains = ["web01.yourdomain.com"]
  173. # locations is only available for http type
  174. locations = ["/", "/pic"]
  175. # route requests to this service if http basic auto user is abc
  176. # routeByHTTPUser = abc
  177. hostHeaderRewrite = "example.com"
  178. requestHeaders.set.x-from-where = "frp"
  179. responseHeaders.set.foo = "bar"
  180. healthCheck.type = "http"
  181. # frpc will send a GET http request '/status' to local http service
  182. # http service is alive when it return 2xx http response code
  183. healthCheck.path = "/status"
  184. healthCheck.intervalSeconds = 10
  185. healthCheck.maxFailed = 3
  186. healthCheck.timeoutSeconds = 3
  187. # set health check headers
  188. healthCheck.httpHeaders=[
  189. { name = "x-from-where", value = "frp" }
  190. ]
  191. [[proxies]]
  192. name = "web02"
  193. type = "https"
  194. localIP = "127.0.0.1"
  195. localPort = 8000
  196. subdomain = "web02"
  197. customDomains = ["web02.yourdomain.com"]
  198. # if not empty, frpc will use proxy protocol to transfer connection info to your local service
  199. # v1 or v2 or empty
  200. transport.proxyProtocolVersion = "v2"
  201. [[proxies]]
  202. name = "tcpmuxhttpconnect"
  203. type = "tcpmux"
  204. multiplexer = "httpconnect"
  205. localIP = "127.0.0.1"
  206. localPort = 10701
  207. customDomains = ["tunnel1"]
  208. # routeByHTTPUser = "user1"
  209. [[proxies]]
  210. name = "plugin_unix_domain_socket"
  211. type = "tcp"
  212. remotePort = 6003
  213. # if plugin is defined, localIP and localPort is useless
  214. # plugin will handle connections got from frps
  215. [proxies.plugin]
  216. type = "unix_domain_socket"
  217. unixPath = "/var/run/docker.sock"
  218. [[proxies]]
  219. name = "plugin_http_proxy"
  220. type = "tcp"
  221. remotePort = 6004
  222. [proxies.plugin]
  223. type = "http_proxy"
  224. httpUser = "abc"
  225. httpPassword = "abc"
  226. [[proxies]]
  227. name = "plugin_socks5"
  228. type = "tcp"
  229. remotePort = 6005
  230. [proxies.plugin]
  231. type = "socks5"
  232. username = "abc"
  233. password = "abc"
  234. [[proxies]]
  235. name = "plugin_static_file"
  236. type = "tcp"
  237. remotePort = 6006
  238. [proxies.plugin]
  239. type = "static_file"
  240. localPath = "/var/www/blog"
  241. stripPrefix = "static"
  242. httpUser = "abc"
  243. httpPassword = "abc"
  244. [[proxies]]
  245. name = "plugin_https2http"
  246. type = "https"
  247. customDomains = ["test.yourdomain.com"]
  248. [proxies.plugin]
  249. type = "https2http"
  250. localAddr = "127.0.0.1:80"
  251. crtPath = "./server.crt"
  252. keyPath = "./server.key"
  253. hostHeaderRewrite = "127.0.0.1"
  254. requestHeaders.set.x-from-where = "frp"
  255. [[proxies]]
  256. name = "plugin_https2https"
  257. type = "https"
  258. customDomains = ["test.yourdomain.com"]
  259. [proxies.plugin]
  260. type = "https2https"
  261. localAddr = "127.0.0.1:443"
  262. crtPath = "./server.crt"
  263. keyPath = "./server.key"
  264. hostHeaderRewrite = "127.0.0.1"
  265. requestHeaders.set.x-from-where = "frp"
  266. [[proxies]]
  267. name = "plugin_http2https"
  268. type = "http"
  269. customDomains = ["test.yourdomain.com"]
  270. [proxies.plugin]
  271. type = "http2https"
  272. localAddr = "127.0.0.1:443"
  273. hostHeaderRewrite = "127.0.0.1"
  274. requestHeaders.set.x-from-where = "frp"
  275. [[proxies]]
  276. name = "plugin_http2http"
  277. type = "tcp"
  278. remotePort = 6007
  279. [proxies.plugin]
  280. type = "http2http"
  281. localAddr = "127.0.0.1:80"
  282. hostHeaderRewrite = "127.0.0.1"
  283. requestHeaders.set.x-from-where = "frp"
  284. [[proxies]]
  285. name = "plugin_tls2raw"
  286. type = "tcp"
  287. remotePort = 6008
  288. [proxies.plugin]
  289. type = "tls2raw"
  290. localAddr = "127.0.0.1:80"
  291. crtPath = "./server.crt"
  292. keyPath = "./server.key"
  293. [[proxies]]
  294. name = "secret_tcp"
  295. # If the type is secret tcp, remotePort is useless
  296. # Who want to connect local port should deploy another frpc with stcp proxy and role is visitor
  297. type = "stcp"
  298. # secretKey is used for authentication for visitors
  299. secretKey = "abcdefg"
  300. localIP = "127.0.0.1"
  301. localPort = 22
  302. # If not empty, only visitors from specified users can connect.
  303. # Otherwise, visitors from same user can connect. '*' means allow all users.
  304. allowUsers = ["*"]
  305. [[proxies]]
  306. name = "p2p_tcp"
  307. type = "xtcp"
  308. secretKey = "abcdefg"
  309. localIP = "127.0.0.1"
  310. localPort = 22
  311. # If not empty, only visitors from specified users can connect.
  312. # Otherwise, visitors from same user can connect. '*' means allow all users.
  313. allowUsers = ["user1", "user2"]
  314. # frpc role visitor -> frps -> frpc role server
  315. [[visitors]]
  316. name = "secret_tcp_visitor"
  317. type = "stcp"
  318. # the server name you want to visitor
  319. serverName = "secret_tcp"
  320. secretKey = "abcdefg"
  321. # connect this address to visitor stcp server
  322. bindAddr = "127.0.0.1"
  323. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  324. # other visitors. (This is not supported for SUDP now)
  325. bindPort = 9000
  326. [[visitors]]
  327. name = "p2p_tcp_visitor"
  328. type = "xtcp"
  329. # if the server user is not set, it defaults to the current user
  330. serverUser = "user1"
  331. serverName = "p2p_tcp"
  332. secretKey = "abcdefg"
  333. bindAddr = "127.0.0.1"
  334. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  335. # other visitors. (This is not supported for SUDP now)
  336. bindPort = 9001
  337. # when automatic tunnel persistence is required, set it to true
  338. keepTunnelOpen = false
  339. # effective when keepTunnelOpen is set to true, the number of attempts to punch through per hour
  340. maxRetriesAnHour = 8
  341. minRetryInterval = 90
  342. # fallbackTo = "stcp_visitor"
  343. # fallbackTimeoutMs = 500