1
0

frpc_full_example.toml 14 KB

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