frpc_full_example.toml 13 KB

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