frpc_full_example.toml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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. # Specify udp packet size, unit is byte. If not set, the default value is 1500.
  116. # This parameter should be same between client and server.
  117. # It affects the udp and sudp proxy.
  118. udpPacketSize = 1500
  119. # Feature gates allows you to enable or disable experimental features
  120. # Format is a map of feature names to boolean values
  121. # You can enable specific features:
  122. #featureGates = { VirtualNet = true }
  123. # VirtualNet settings for experimental virtual network capabilities
  124. # The virtual network feature requires enabling the VirtualNet feature gate above
  125. # virtualNet.address = "100.86.1.1/24"
  126. # Additional metadatas for client.
  127. metadatas.var1 = "abc"
  128. metadatas.var2 = "123"
  129. # Include other config files for proxies.
  130. # includes = ["./confd/*.ini"]
  131. [[proxies]]
  132. # 'ssh' is the unique proxy name
  133. # If global user is not empty, it will be changed to {user}.{proxy} such as 'your_name.ssh'
  134. name = "ssh"
  135. type = "tcp"
  136. localIP = "127.0.0.1"
  137. localPort = 22
  138. # Limit bandwidth for this proxy, unit is KB and MB
  139. transport.bandwidthLimit = "1MB"
  140. # Where to limit bandwidth, can be 'client' or 'server', default is 'client'
  141. transport.bandwidthLimitMode = "client"
  142. # If true, traffic of this proxy will be encrypted, default is false
  143. transport.useEncryption = false
  144. # If true, traffic will be compressed
  145. transport.useCompression = false
  146. # Remote port listen by frps
  147. remotePort = 6001
  148. # frps will load balancing connections for proxies in same group
  149. loadBalancer.group = "test_group"
  150. # group should have same group key
  151. loadBalancer.groupKey = "123456"
  152. # Enable health check for the backend service, it supports 'tcp' and 'http' now.
  153. # frpc will connect local service's port to detect it's healthy status
  154. healthCheck.type = "tcp"
  155. # Health check connection timeout
  156. healthCheck.timeoutSeconds = 3
  157. # If continuous failed in 3 times, the proxy will be removed from frps
  158. healthCheck.maxFailed = 3
  159. # Every 10 seconds will do a health check
  160. healthCheck.intervalSeconds = 10
  161. # Additional meta info for each proxy. It will be passed to the server-side plugin for use.
  162. metadatas.var1 = "abc"
  163. metadatas.var2 = "123"
  164. # You can add some extra information to the proxy through annotations.
  165. # These annotations will be displayed on the frps dashboard.
  166. [proxies.annotations]
  167. key1 = "value1"
  168. "prefix/key2" = "value2"
  169. [[proxies]]
  170. name = "ssh_random"
  171. type = "tcp"
  172. localIP = "192.168.31.100"
  173. localPort = 22
  174. # If remotePort is 0, frps will assign a random port for you
  175. remotePort = 0
  176. [[proxies]]
  177. name = "dns"
  178. type = "udp"
  179. localIP = "114.114.114.114"
  180. localPort = 53
  181. remotePort = 6002
  182. # 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
  183. [[proxies]]
  184. name = "web01"
  185. type = "http"
  186. localIP = "127.0.0.1"
  187. localPort = 80
  188. # http username and password are safety certification for http protocol
  189. # if not set, you can access this customDomains without certification
  190. httpUser = "admin"
  191. httpPassword = "admin"
  192. # if domain for frps is frps.com, then you can access [web01] proxy by URL http://web01.frps.com
  193. subdomain = "web01"
  194. customDomains = ["web01.yourdomain.com"]
  195. # locations is only available for http type
  196. locations = ["/", "/pic"]
  197. # route requests to this service if http basic auto user is abc
  198. # routeByHTTPUser = abc
  199. hostHeaderRewrite = "example.com"
  200. requestHeaders.set.x-from-where = "frp"
  201. responseHeaders.set.foo = "bar"
  202. healthCheck.type = "http"
  203. # frpc will send a GET http request '/status' to local http service
  204. # http service is alive when it return 2xx http response code
  205. healthCheck.path = "/status"
  206. healthCheck.intervalSeconds = 10
  207. healthCheck.maxFailed = 3
  208. healthCheck.timeoutSeconds = 3
  209. # set health check headers
  210. healthCheck.httpHeaders=[
  211. { name = "x-from-where", value = "frp" }
  212. ]
  213. [[proxies]]
  214. name = "web02"
  215. type = "https"
  216. localIP = "127.0.0.1"
  217. localPort = 8000
  218. subdomain = "web02"
  219. customDomains = ["web02.yourdomain.com"]
  220. # if not empty, frpc will use proxy protocol to transfer connection info to your local service
  221. # v1 or v2 or empty
  222. transport.proxyProtocolVersion = "v2"
  223. [[proxies]]
  224. name = "tcpmuxhttpconnect"
  225. type = "tcpmux"
  226. multiplexer = "httpconnect"
  227. localIP = "127.0.0.1"
  228. localPort = 10701
  229. customDomains = ["tunnel1"]
  230. # routeByHTTPUser = "user1"
  231. [[proxies]]
  232. name = "plugin_unix_domain_socket"
  233. type = "tcp"
  234. remotePort = 6003
  235. # if plugin is defined, localIP and localPort is useless
  236. # plugin will handle connections got from frps
  237. [proxies.plugin]
  238. type = "unix_domain_socket"
  239. unixPath = "/var/run/docker.sock"
  240. [[proxies]]
  241. name = "plugin_http_proxy"
  242. type = "tcp"
  243. remotePort = 6004
  244. [proxies.plugin]
  245. type = "http_proxy"
  246. httpUser = "abc"
  247. httpPassword = "abc"
  248. [[proxies]]
  249. name = "plugin_socks5"
  250. type = "tcp"
  251. remotePort = 6005
  252. [proxies.plugin]
  253. type = "socks5"
  254. username = "abc"
  255. password = "abc"
  256. [[proxies]]
  257. name = "plugin_static_file"
  258. type = "tcp"
  259. remotePort = 6006
  260. [proxies.plugin]
  261. type = "static_file"
  262. localPath = "/var/www/blog"
  263. stripPrefix = "static"
  264. httpUser = "abc"
  265. httpPassword = "abc"
  266. [[proxies]]
  267. name = "plugin_https2http"
  268. type = "https"
  269. customDomains = ["test.yourdomain.com"]
  270. [proxies.plugin]
  271. type = "https2http"
  272. localAddr = "127.0.0.1:80"
  273. crtPath = "./server.crt"
  274. keyPath = "./server.key"
  275. hostHeaderRewrite = "127.0.0.1"
  276. requestHeaders.set.x-from-where = "frp"
  277. [[proxies]]
  278. name = "plugin_https2https"
  279. type = "https"
  280. customDomains = ["test.yourdomain.com"]
  281. [proxies.plugin]
  282. type = "https2https"
  283. localAddr = "127.0.0.1:443"
  284. crtPath = "./server.crt"
  285. keyPath = "./server.key"
  286. hostHeaderRewrite = "127.0.0.1"
  287. requestHeaders.set.x-from-where = "frp"
  288. [[proxies]]
  289. name = "plugin_http2https"
  290. type = "http"
  291. customDomains = ["test.yourdomain.com"]
  292. [proxies.plugin]
  293. type = "http2https"
  294. localAddr = "127.0.0.1:443"
  295. hostHeaderRewrite = "127.0.0.1"
  296. requestHeaders.set.x-from-where = "frp"
  297. [[proxies]]
  298. name = "plugin_http2http"
  299. type = "tcp"
  300. remotePort = 6007
  301. [proxies.plugin]
  302. type = "http2http"
  303. localAddr = "127.0.0.1:80"
  304. hostHeaderRewrite = "127.0.0.1"
  305. requestHeaders.set.x-from-where = "frp"
  306. [[proxies]]
  307. name = "plugin_tls2raw"
  308. type = "tcp"
  309. remotePort = 6008
  310. [proxies.plugin]
  311. type = "tls2raw"
  312. localAddr = "127.0.0.1:80"
  313. crtPath = "./server.crt"
  314. keyPath = "./server.key"
  315. [[proxies]]
  316. name = "secret_tcp"
  317. # If the type is secret tcp, remotePort is useless
  318. # Who want to connect local port should deploy another frpc with stcp proxy and role is visitor
  319. type = "stcp"
  320. # secretKey is used for authentication for visitors
  321. secretKey = "abcdefg"
  322. localIP = "127.0.0.1"
  323. localPort = 22
  324. # If not empty, only visitors from specified users can connect.
  325. # Otherwise, visitors from same user can connect. '*' means allow all users.
  326. allowUsers = ["*"]
  327. [[proxies]]
  328. name = "p2p_tcp"
  329. type = "xtcp"
  330. secretKey = "abcdefg"
  331. localIP = "127.0.0.1"
  332. localPort = 22
  333. # If not empty, only visitors from specified users can connect.
  334. # Otherwise, visitors from same user can connect. '*' means allow all users.
  335. allowUsers = ["user1", "user2"]
  336. # NAT traversal configuration (optional)
  337. [proxies.natTraversal]
  338. # Disable the use of local network interfaces (assisted addresses) for NAT traversal.
  339. # When enabled, only STUN-discovered public addresses will be used.
  340. # This can improve performance when you have slow VPN connections.
  341. # Default: false
  342. disableAssistedAddrs = false
  343. [[proxies]]
  344. name = "vnet-server"
  345. type = "stcp"
  346. secretKey = "your-secret-key"
  347. [proxies.plugin]
  348. type = "virtual_net"
  349. # frpc role visitor -> frps -> frpc role server
  350. [[visitors]]
  351. name = "secret_tcp_visitor"
  352. type = "stcp"
  353. # the server name you want to visitor
  354. serverName = "secret_tcp"
  355. secretKey = "abcdefg"
  356. # connect this address to visitor stcp server
  357. bindAddr = "127.0.0.1"
  358. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  359. # other visitors. (This is not supported for SUDP now)
  360. bindPort = 9000
  361. [[visitors]]
  362. name = "p2p_tcp_visitor"
  363. type = "xtcp"
  364. # if the server user is not set, it defaults to the current user
  365. serverUser = "user1"
  366. serverName = "p2p_tcp"
  367. secretKey = "abcdefg"
  368. bindAddr = "127.0.0.1"
  369. # bindPort can be less than 0, it means don't bind to the port and only receive connections redirected from
  370. # other visitors. (This is not supported for SUDP now)
  371. bindPort = 9001
  372. # when automatic tunnel persistence is required, set it to true
  373. keepTunnelOpen = false
  374. # effective when keepTunnelOpen is set to true, the number of attempts to punch through per hour
  375. maxRetriesAnHour = 8
  376. minRetryInterval = 90
  377. # fallbackTo = "stcp_visitor"
  378. # fallbackTimeoutMs = 500
  379. # NAT traversal configuration (optional)
  380. [visitors.natTraversal]
  381. # Disable the use of local network interfaces (assisted addresses) for NAT traversal.
  382. # When enabled, only STUN-discovered public addresses will be used.
  383. # Default: false
  384. disableAssistedAddrs = false
  385. [[visitors]]
  386. name = "vnet-visitor"
  387. type = "stcp"
  388. serverName = "vnet-server"
  389. secretKey = "your-secret-key"
  390. bindPort = -1
  391. [visitors.plugin]
  392. type = "virtual_net"
  393. destinationIP = "100.86.0.1"