1
0

frpc_full_example.toml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  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. # alternatively, you can use tokenSource to load the token from a file
  28. # this is mutually exclusive with auth.token
  29. # auth.tokenSource.type = "file"
  30. # auth.tokenSource.file.path = "/etc/frp/token"
  31. # oidc.clientID specifies the client ID to use to get a token in OIDC authentication.
  32. # auth.oidc.clientID = ""
  33. # oidc.clientSecret specifies the client secret to use to get a token in OIDC authentication.
  34. # auth.oidc.clientSecret = ""
  35. # oidc.audience specifies the audience of the token in OIDC authentication.
  36. # auth.oidc.audience = ""
  37. # oidc.scope specifies the permissions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "".
  38. # auth.oidc.scope = ""
  39. # oidc.tokenEndpointURL specifies the URL which implements OIDC Token Endpoint.
  40. # It will be used to get an OIDC token.
  41. # auth.oidc.tokenEndpointURL = ""
  42. # oidc.additionalEndpointParams specifies additional parameters to be sent to the OIDC Token Endpoint.
  43. # For example, if you want to specify the "audience" parameter, you can set as follow.
  44. # frp will add "audience=<value>" "var1=<value>" to the additional parameters.
  45. # auth.oidc.additionalEndpointParams.audience = "https://dev.auth.com/api/v2/"
  46. # auth.oidc.additionalEndpointParams.var1 = "foobar"
  47. # OIDC TLS and proxy configuration
  48. # Specify a custom CA certificate file for verifying the OIDC token endpoint's TLS certificate.
  49. # This is useful when the OIDC provider uses a self-signed certificate or a custom CA.
  50. # auth.oidc.trustedCaFile = "/path/to/ca.crt"
  51. # Skip TLS certificate verification for the OIDC token endpoint.
  52. # INSECURE: Only use this for debugging purposes, not recommended for production.
  53. # auth.oidc.insecureSkipVerify = false
  54. # Specify a proxy server for OIDC token endpoint connections.
  55. # Supports http, https, socks5, and socks5h proxy protocols.
  56. # If not specified, no proxy is used for OIDC connections.
  57. # auth.oidc.proxyURL = "http://proxy.example.com:8080"
  58. # Set admin address for control frpc's action by http api such as reload
  59. webServer.addr = "127.0.0.1"
  60. webServer.port = 7400
  61. webServer.user = "admin"
  62. webServer.password = "admin"
  63. # Admin assets directory. By default, these assets are bundled with frpc.
  64. # webServer.assetsDir = "./static"
  65. # Enable golang pprof handlers in admin listener.
  66. webServer.pprofEnable = false
  67. # The maximum amount of time a dial to server will wait for a connect to complete. Default value is 10 seconds.
  68. # transport.dialServerTimeout = 10
  69. # dialServerKeepalive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
  70. # If negative, keep-alive probes are disabled.
  71. # transport.dialServerKeepalive = 7200
  72. # connections will be established in advance, default value is zero
  73. transport.poolCount = 5
  74. # If tcp stream multiplexing is used, default is true, it must be same with frps
  75. # transport.tcpMux = true
  76. # Specify keep alive interval for tcp mux.
  77. # only valid if tcpMux is enabled.
  78. # transport.tcpMuxKeepaliveInterval = 30
  79. # Communication protocol used to connect to server
  80. # supports tcp, kcp, quic, websocket and wss now, default is tcp
  81. transport.protocol = "tcp"
  82. # set client binding ip when connect server, default is empty.
  83. # only when protocol = tcp or websocket, the value will be used.
  84. transport.connectServerLocalIP = "0.0.0.0"
  85. # 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
  86. # it only works when protocol is tcp
  87. # transport.proxyURL = "http://user:passwd@192.168.1.128:8080"
  88. # transport.proxyURL = "socks5://user:passwd@192.168.1.128:1080"
  89. # transport.proxyURL = "ntlm://user:passwd@192.168.1.128:2080"
  90. # quic protocol options
  91. # transport.quic.keepalivePeriod = 10
  92. # transport.quic.maxIdleTimeout = 30
  93. # transport.quic.maxIncomingStreams = 100000
  94. # If tls.enable is true, frpc will connect frps by tls.
  95. # Since v0.50.0, the default value has been changed to true, and tls is enabled by default.
  96. transport.tls.enable = true
  97. # transport.tls.certFile = "client.crt"
  98. # transport.tls.keyFile = "client.key"
  99. # transport.tls.trustedCaFile = "ca.crt"
  100. # transport.tls.serverName = "example.com"
  101. # If the disableCustomTLSFirstByte is set to false, frpc will establish a connection with frps using the
  102. # first custom byte when tls is enabled.
  103. # Since v0.50.0, the default value has been changed to true, and the first custom byte is disabled by default.
  104. # transport.tls.disableCustomTLSFirstByte = true
  105. # Heartbeat configure, it's not recommended to modify the default value.
  106. # The default value of heartbeatInterval is 10 and heartbeatTimeout is 90. Set negative value
  107. # to disable it.
  108. # transport.heartbeatInterval = 30
  109. # transport.heartbeatTimeout = 90
  110. # Specify a dns server, so frpc will use this instead of default one
  111. # dnsServer = "8.8.8.8"
  112. # Proxy names you want to start.
  113. # Default is empty, means all proxies.
  114. # start = ["ssh", "dns"]
  115. # Alternative to 'start': You can control each proxy individually using the 'enabled' field.
  116. # Set 'enabled = false' in a proxy configuration to disable it.
  117. # If 'enabled' is not set or set to true, the proxy is enabled by default.
  118. # The 'enabled' field provides more granular control and is recommended over 'start'.
  119. # Specify udp packet size, unit is byte. If not set, the default value is 1500.
  120. # This parameter should be same between client and server.
  121. # It affects the udp and sudp proxy.
  122. udpPacketSize = 1500
  123. # Feature gates allows you to enable or disable experimental features
  124. # Format is a map of feature names to boolean values
  125. # You can enable specific features:
  126. #featureGates = { VirtualNet = true }
  127. # VirtualNet settings for experimental virtual network capabilities
  128. # The virtual network feature requires enabling the VirtualNet feature gate above
  129. # virtualNet.address = "100.86.1.1/24"
  130. # Additional metadatas for client.
  131. metadatas.var1 = "abc"
  132. metadatas.var2 = "123"
  133. # Include other config files for proxies.
  134. # includes = ["./confd/*.ini"]
  135. [[proxies]]
  136. # 'ssh' is the unique proxy name
  137. # If global user is not empty, it will be changed to {user}.{proxy} such as 'your_name.ssh'
  138. name = "ssh"
  139. type = "tcp"
  140. # Enable or disable this proxy. true or omit this field to enable, false to disable.
  141. # enabled = true
  142. localIP = "127.0.0.1"
  143. localPort = 22
  144. # Limit bandwidth for this proxy, unit is KB and MB
  145. transport.bandwidthLimit = "1MB"
  146. # Where to limit bandwidth, can be 'client' or 'server', default is 'client'
  147. transport.bandwidthLimitMode = "client"
  148. # If true, traffic of this proxy will be encrypted, default is false
  149. transport.useEncryption = false
  150. # If true, traffic will be compressed
  151. transport.useCompression = false
  152. # Remote port listen by frps
  153. remotePort = 6001
  154. # frps will load balancing connections for proxies in same group
  155. loadBalancer.group = "test_group"
  156. # group should have same group key
  157. loadBalancer.groupKey = "123456"
  158. # Enable health check for the backend service, it supports 'tcp' and 'http' now.
  159. # frpc will connect local service's port to detect it's healthy status
  160. healthCheck.type = "tcp"
  161. # Health check connection timeout
  162. healthCheck.timeoutSeconds = 3
  163. # If continuous failed in 3 times, the proxy will be removed from frps
  164. healthCheck.maxFailed = 3
  165. # Every 10 seconds will do a health check
  166. healthCheck.intervalSeconds = 10
  167. # Additional meta info for each proxy. It will be passed to the server-side plugin for use.
  168. metadatas.var1 = "abc"
  169. metadatas.var2 = "123"
  170. # You can add some extra information to the proxy through annotations.
  171. # These annotations will be displayed on the frps dashboard.
  172. [proxies.annotations]
  173. key1 = "value1"
  174. "prefix/key2" = "value2"
  175. [[proxies]]
  176. name = "ssh_random"
  177. type = "tcp"
  178. localIP = "192.168.31.100"
  179. localPort = 22
  180. # If remotePort is 0, frps will assign a random port for you
  181. remotePort = 0
  182. [[proxies]]
  183. name = "dns"
  184. type = "udp"
  185. localIP = "114.114.114.114"
  186. localPort = 53
  187. remotePort = 6002
  188. # 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
  189. [[proxies]]
  190. name = "web01"
  191. type = "http"
  192. localIP = "127.0.0.1"
  193. localPort = 80
  194. # http username and password are safety certification for http protocol
  195. # if not set, you can access this customDomains without certification
  196. httpUser = "admin"
  197. httpPassword = "admin"
  198. # if domain for frps is frps.com, then you can access [web01] proxy by URL http://web01.frps.com
  199. subdomain = "web01"
  200. customDomains = ["web01.yourdomain.com"]
  201. # locations is only available for http type
  202. locations = ["/", "/pic"]
  203. # route requests to this service if http basic auto user is abc
  204. # routeByHTTPUser = abc
  205. hostHeaderRewrite = "example.com"
  206. requestHeaders.set.x-from-where = "frp"
  207. responseHeaders.set.foo = "bar"
  208. healthCheck.type = "http"
  209. # frpc will send a GET http request '/status' to local http service
  210. # http service is alive when it return 2xx http response code
  211. healthCheck.path = "/status"
  212. healthCheck.intervalSeconds = 10
  213. healthCheck.maxFailed = 3
  214. healthCheck.timeoutSeconds = 3
  215. # set health check headers
  216. healthCheck.httpHeaders=[
  217. { name = "x-from-where", value = "frp" }
  218. ]
  219. [[proxies]]
  220. name = "web02"
  221. type = "https"
  222. # Disable this proxy by setting enabled to false
  223. # enabled = false
  224. localIP = "127.0.0.1"
  225. localPort = 8000
  226. subdomain = "web02"
  227. customDomains = ["web02.yourdomain.com"]
  228. # if not empty, frpc will use proxy protocol to transfer connection info to your local service
  229. # v1 or v2 or empty
  230. transport.proxyProtocolVersion = "v2"
  231. [[proxies]]
  232. name = "tcpmuxhttpconnect"
  233. type = "tcpmux"
  234. multiplexer = "httpconnect"
  235. localIP = "127.0.0.1"
  236. localPort = 10701
  237. customDomains = ["tunnel1"]
  238. # routeByHTTPUser = "user1"
  239. [[proxies]]
  240. name = "plugin_unix_domain_socket"
  241. type = "tcp"
  242. remotePort = 6003
  243. # if plugin is defined, localIP and localPort is useless
  244. # plugin will handle connections got from frps
  245. [proxies.plugin]
  246. type = "unix_domain_socket"
  247. unixPath = "/var/run/docker.sock"
  248. [[proxies]]
  249. name = "plugin_http_proxy"
  250. type = "tcp"
  251. remotePort = 6004
  252. [proxies.plugin]
  253. type = "http_proxy"
  254. httpUser = "abc"
  255. httpPassword = "abc"
  256. [[proxies]]
  257. name = "plugin_socks5"
  258. type = "tcp"
  259. remotePort = 6005
  260. [proxies.plugin]
  261. type = "socks5"
  262. username = "abc"
  263. password = "abc"
  264. [[proxies]]
  265. name = "plugin_static_file"
  266. type = "tcp"
  267. remotePort = 6006
  268. [proxies.plugin]
  269. type = "static_file"
  270. localPath = "/var/www/blog"
  271. stripPrefix = "static"
  272. httpUser = "abc"
  273. httpPassword = "abc"
  274. [[proxies]]
  275. name = "plugin_https2http"
  276. type = "https"
  277. customDomains = ["test.yourdomain.com"]
  278. [proxies.plugin]
  279. type = "https2http"
  280. localAddr = "127.0.0.1:80"
  281. crtPath = "./server.crt"
  282. keyPath = "./server.key"
  283. hostHeaderRewrite = "127.0.0.1"
  284. requestHeaders.set.x-from-where = "frp"
  285. [[proxies]]
  286. name = "plugin_https2https"
  287. type = "https"
  288. customDomains = ["test.yourdomain.com"]
  289. [proxies.plugin]
  290. type = "https2https"
  291. localAddr = "127.0.0.1:443"
  292. crtPath = "./server.crt"
  293. keyPath = "./server.key"
  294. hostHeaderRewrite = "127.0.0.1"
  295. requestHeaders.set.x-from-where = "frp"
  296. [[proxies]]
  297. name = "plugin_http2https"
  298. type = "http"
  299. customDomains = ["test.yourdomain.com"]
  300. [proxies.plugin]
  301. type = "http2https"
  302. localAddr = "127.0.0.1:443"
  303. hostHeaderRewrite = "127.0.0.1"
  304. requestHeaders.set.x-from-where = "frp"
  305. [[proxies]]
  306. name = "plugin_http2http"
  307. type = "tcp"
  308. remotePort = 6007
  309. [proxies.plugin]
  310. type = "http2http"
  311. localAddr = "127.0.0.1:80"
  312. hostHeaderRewrite = "127.0.0.1"
  313. requestHeaders.set.x-from-where = "frp"
  314. [[proxies]]
  315. name = "plugin_tls2raw"
  316. type = "tcp"
  317. remotePort = 6008
  318. [proxies.plugin]
  319. type = "tls2raw"
  320. localAddr = "127.0.0.1:80"
  321. crtPath = "./server.crt"
  322. keyPath = "./server.key"
  323. [[proxies]]
  324. name = "secret_tcp"
  325. # If the type is secret tcp, remotePort is useless
  326. # Who want to connect local port should deploy another frpc with stcp proxy and role is visitor
  327. type = "stcp"
  328. # secretKey is used for authentication for visitors
  329. secretKey = "abcdefg"
  330. localIP = "127.0.0.1"
  331. localPort = 22
  332. # If not empty, only visitors from specified users can connect.
  333. # Otherwise, visitors from same user can connect. '*' means allow all users.
  334. allowUsers = ["*"]
  335. [[proxies]]
  336. name = "p2p_tcp"
  337. type = "xtcp"
  338. secretKey = "abcdefg"
  339. localIP = "127.0.0.1"
  340. localPort = 22
  341. # If not empty, only visitors from specified users can connect.
  342. # Otherwise, visitors from same user can connect. '*' means allow all users.
  343. allowUsers = ["user1", "user2"]
  344. # NAT traversal configuration (optional)
  345. [proxies.natTraversal]
  346. # Disable the use of local network interfaces (assisted addresses) for NAT traversal.
  347. # When enabled, only STUN-discovered public addresses will be used.
  348. # This can improve performance when you have slow VPN connections.
  349. # Default: false
  350. disableAssistedAddrs = false
  351. [[proxies]]
  352. name = "vnet-server"
  353. type = "stcp"
  354. secretKey = "your-secret-key"
  355. [proxies.plugin]
  356. type = "virtual_net"
  357. # frpc role visitor -> frps -> frpc role server
  358. [[visitors]]
  359. name = "secret_tcp_visitor"
  360. type = "stcp"
  361. # the server name you want to visitor
  362. serverName = "secret_tcp"
  363. secretKey = "abcdefg"
  364. # connect this address to visitor stcp server
  365. bindAddr = "127.0.0.1"
  366. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  367. # other visitors. (This is not supported for SUDP now)
  368. bindPort = 9000
  369. [[visitors]]
  370. name = "p2p_tcp_visitor"
  371. type = "xtcp"
  372. # if the server user is not set, it defaults to the current user
  373. serverUser = "user1"
  374. serverName = "p2p_tcp"
  375. secretKey = "abcdefg"
  376. bindAddr = "127.0.0.1"
  377. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  378. # other visitors. (This is not supported for SUDP now)
  379. bindPort = 9001
  380. # when automatic tunnel persistence is required, set it to true
  381. keepTunnelOpen = false
  382. # effective when keepTunnelOpen is set to true, the number of attempts to punch through per hour
  383. maxRetriesAnHour = 8
  384. minRetryInterval = 90
  385. # fallbackTo = "stcp_visitor"
  386. # fallbackTimeoutMs = 500
  387. # NAT traversal configuration (optional)
  388. [visitors.natTraversal]
  389. # Disable the use of local network interfaces (assisted addresses) for NAT traversal.
  390. # When enabled, only STUN-discovered public addresses will be used.
  391. # Default: false
  392. disableAssistedAddrs = false
  393. [[visitors]]
  394. name = "vnet-visitor"
  395. type = "stcp"
  396. serverName = "vnet-server"
  397. secretKey = "your-secret-key"
  398. bindPort = -1
  399. [visitors.plugin]
  400. type = "virtual_net"
  401. destinationIP = "100.86.0.1"