1
0

frpc_full_example.toml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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 = 60
  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. healthCheck.type = "http"
  180. # frpc will send a GET http request '/status' to local http service
  181. # http service is alive when it return 2xx http response code
  182. healthCheck.path = "/status"
  183. healthCheck.intervalSeconds = 10
  184. healthCheck.maxFailed = 3
  185. healthCheck.timeoutSeconds = 3
  186. # set health check headers
  187. healthCheck.httpHeaders=[
  188. { name = "x-from-where", value = "frp" }
  189. ]
  190. [[proxies]]
  191. name = "web02"
  192. type = "https"
  193. localIP = "127.0.0.1"
  194. localPort = 8000
  195. subdomain = "web02"
  196. customDomains = ["web02.yourdomain.com"]
  197. # if not empty, frpc will use proxy protocol to transfer connection info to your local service
  198. # v1 or v2 or empty
  199. transport.proxyProtocolVersion = "v2"
  200. [[proxies]]
  201. name = "tcpmuxhttpconnect"
  202. type = "tcpmux"
  203. multiplexer = "httpconnect"
  204. localIP = "127.0.0.1"
  205. localPort = 10701
  206. customDomains = ["tunnel1"]
  207. # routeByHTTPUser = "user1"
  208. [[proxies]]
  209. name = "plugin_unix_domain_socket"
  210. type = "tcp"
  211. remotePort = 6003
  212. # if plugin is defined, localIP and localPort is useless
  213. # plugin will handle connections got from frps
  214. [proxies.plugin]
  215. type = "unix_domain_socket"
  216. unixPath = "/var/run/docker.sock"
  217. [[proxies]]
  218. name = "plugin_http_proxy"
  219. type = "tcp"
  220. remotePort = 6004
  221. [proxies.plugin]
  222. type = "http_proxy"
  223. httpUser = "abc"
  224. httpPassword = "abc"
  225. [[proxies]]
  226. name = "plugin_socks5"
  227. type = "tcp"
  228. remotePort = 6005
  229. [proxies.plugin]
  230. type = "socks5"
  231. username = "abc"
  232. password = "abc"
  233. [[proxies]]
  234. name = "plugin_static_file"
  235. type = "tcp"
  236. remotePort = 6006
  237. [proxies.plugin]
  238. type = "static_file"
  239. localPath = "/var/www/blog"
  240. stripPrefix = "static"
  241. httpUser = "abc"
  242. httpPassword = "abc"
  243. [[proxies]]
  244. name = "plugin_https2http"
  245. type = "https"
  246. customDomains = ["test.yourdomain.com"]
  247. [proxies.plugin]
  248. type = "https2http"
  249. localAddr = "127.0.0.1:80"
  250. crtPath = "./server.crt"
  251. keyPath = "./server.key"
  252. hostHeaderRewrite = "127.0.0.1"
  253. requestHeaders.set.x-from-where = "frp"
  254. [[proxies]]
  255. name = "plugin_https2https"
  256. type = "https"
  257. customDomains = ["test.yourdomain.com"]
  258. [proxies.plugin]
  259. type = "https2https"
  260. localAddr = "127.0.0.1:443"
  261. crtPath = "./server.crt"
  262. keyPath = "./server.key"
  263. hostHeaderRewrite = "127.0.0.1"
  264. requestHeaders.set.x-from-where = "frp"
  265. [[proxies]]
  266. name = "plugin_http2https"
  267. type = "http"
  268. customDomains = ["test.yourdomain.com"]
  269. [proxies.plugin]
  270. type = "http2https"
  271. localAddr = "127.0.0.1:443"
  272. hostHeaderRewrite = "127.0.0.1"
  273. requestHeaders.set.x-from-where = "frp"
  274. [[proxies]]
  275. name = "secret_tcp"
  276. # If the type is secret tcp, remotePort is useless
  277. # Who want to connect local port should deploy another frpc with stcp proxy and role is visitor
  278. type = "stcp"
  279. # secretKey is used for authentication for visitors
  280. secretKey = "abcdefg"
  281. localIP = "127.0.0.1"
  282. localPort = 22
  283. # If not empty, only visitors from specified users can connect.
  284. # Otherwise, visitors from same user can connect. '*' means allow all users.
  285. allowUsers = ["*"]
  286. [[proxies]]
  287. name = "p2p_tcp"
  288. type = "xtcp"
  289. secretKey = "abcdefg"
  290. localIP = "127.0.0.1"
  291. localPort = 22
  292. # If not empty, only visitors from specified users can connect.
  293. # Otherwise, visitors from same user can connect. '*' means allow all users.
  294. allowUsers = ["user1", "user2"]
  295. # frpc role visitor -> frps -> frpc role server
  296. [[visitors]]
  297. name = "secret_tcp_visitor"
  298. type = "stcp"
  299. # the server name you want to visitor
  300. serverName = "secret_tcp"
  301. secretKey = "abcdefg"
  302. # connect this address to visitor stcp server
  303. bindAddr = "127.0.0.1"
  304. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  305. # other visitors. (This is not supported for SUDP now)
  306. bindPort = 9000
  307. [[visitors]]
  308. name = "p2p_tcp_visitor"
  309. type = "xtcp"
  310. # if the server user is not set, it defaults to the current user
  311. serverUser = "user1"
  312. serverName = "p2p_tcp"
  313. secretKey = "abcdefg"
  314. bindAddr = "127.0.0.1"
  315. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  316. # other visitors. (This is not supported for SUDP now)
  317. bindPort = 9001
  318. # when automatic tunnel persistence is required, set it to true
  319. keepTunnelOpen = false
  320. # effective when keepTunnelOpen is set to true, the number of attempts to punch through per hour
  321. maxRetriesAnHour = 8
  322. minRetryInterval = 90
  323. # fallbackTo = "stcp_visitor"
  324. # fallbackTimeoutMs = 500